Jan-15-2020, 03:03 PM
How to use a returned value?
How to use a returned value?
|
Jan-15-2020, 03:23 PM
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!
Jan-16-2020, 06:54 AM
(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. |
|
Users browsing this thread: 2 Guest(s)