Skip to content

Update global_&_return.rst - #95

Merged
yasoob merged 1 commit into
yasoob:masterfrom
nbasu02:patch-3
Aug 28, 2015
Merged

Update global_&_return.rst#95
yasoob merged 1 commit into
yasoob:masterfrom
nbasu02:patch-3

Conversation

@nbasu02

@nbasu02 nbasu02 commented Aug 27, 2015

Copy link
Copy Markdown
Contributor

When explaining multiple return values, it shows returning a tuple in a function, and then says you can "return separate values as well as well". However, returning "separate values" is just a different way syntactically of returning a tuple. To state that they are different would be inaccurate

In [1]: def myfunc():
   ...:     return 'a', 1
   ...: 

In [2]: type(myfunc())
Out[2]: tuple

This can be seen even outside of functions:

In [3]: a = 1,2

In [4]: type(a)
Out[4]: tuple

I'm debating whether I should keep name, age = profile() in, as it shows a good example of unpacking the results of a function, though unpacking itself isn't a specific function feature

Removed detail stating "return a,b" is not a tuple
yasoob added a commit that referenced this pull request Aug 28, 2015
Update global_&_return.rst
@yasoob
yasoob merged commit 282687d into yasoob:master Aug 28, 2015
@yasoob

yasoob commented Aug 28, 2015

Copy link
Copy Markdown
Owner

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants