Python Forum
How to use a returned value?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to use a returned value?
#11
(Jan-15-2020, 02:53 PM)joe_momma Wrote: clear as mud?

exactly. but no, I do understand (for the most part) the gist of what everybody is saying. would it be best practice to use different names when calling/re-using the returned values, does it matter?
Reply
#12
Quote:would it be best practice to use different names when calling/re-using the returned values, does it matter?

It depends. Often it's hard to find different names.

If you want to understand this:
msg, destPhone, caseNum, timeStamp, sender= pullData()
Then you should read the pep-3132 (Extended Iterable Unpacking).
A good tutorial about iterable unpacking is here: https://realpython.com/lessons/tuple-ass...unpacking/
Almost dead, but too lazy to die: https://sourceserver.info
All humans together. We don't need politicians!
Reply
#13
(Jan-15-2020, 03:23 PM)DeaD_EyE Wrote: Then you should read the pep-3132 (Extended Iterable Unpacking).

PEP-s are (usually) good reads. Me likes unpacking in for-loop (especially if one wants to have mutable list as result):

>>> for item in [(1, 2, 3), (10, 11, 12)]: 
...     print(item[1:]) 
...                                                                                                                                        
(2, 3)                                         # slices are tuples
(11, 12)
>>> for first, *rest in [(1, 2, 3), (10, 11, 12)]: 
...     print(rest)
...
[2, 3]                                         # lists
[11, 12]
I'm not 'in'-sane. Indeed, I am so far 'out' of sane that you appear a tiny blip on the distant coast of sanity. Bucky Katt, Get Fuzzy

Da Bishop: There's a dead bishop on the landing. I don't know who keeps bringing them in here. ....but society is to blame.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  How to access values returned from inquirer cspower 6 803 Dec-26-2023, 09:34 PM
Last Post: cspower
  SQLAlchemy Object Missing when Null is returned Personne 1 1,741 Feb-19-2022, 02:50 AM
Last Post: Larz60+
  Getting "name 'get_weather' is not defined error and no json_data returned? trthskr4 6 3,631 Sep-14-2021, 09:55 AM
Last Post: trthskr4
  Libraries installed with pipenv, but ModuleNotFoundError returned jpncsu 2 3,004 Sep-06-2021, 07:24 PM
Last Post: jpncsu
  Exception: Returned Type Mismatch Error devansing 1 5,157 Mar-06-2020, 07:26 PM
Last Post: ndc85430
  Strange Characters in JSON returned string fioranosnake 4 5,213 Dec-02-2019, 07:25 PM
Last Post: fioranosnake
  Not all data returned from sys.argv ecdhyne 2 2,767 Sep-05-2019, 08:27 PM
Last Post: buran
  I always get 'None' returned. Confused. What did I miss? jpezz 2 2,383 Apr-07-2019, 10:06 AM
Last Post: jpezz
  How to resolve 404 returned from web method when not running on localhost littleGreenDude 3 3,084 Feb-05-2019, 09:01 PM
Last Post: littleGreenDude
  TypeError: __str__ returned non-string error jolinchewjb 5 10,091 Jan-24-2019, 07:54 AM
Last Post: jolinchewjb

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020