Re: [Python-ideas] Allow function to return multiple values

2017-06-09 Thread joannah nanjekye
Thanks Abe for the insight. On Thu, Jun 8, 2017 at 11:27 PM, Abe Dillon wrote: > Welcome to the group, Joannah! > > Now that you've been introduced to packing and unpacking in Python, I > would suggest learning the complete syntax, because it's a very useful > feature. > > >>> a, b = "hi" # you

Re: [Python-ideas] Dictionary destructing and unpacking.

2017-06-09 Thread Joao S. O. Bueno
I ha d not read all the e-mails in the thread - but just to announce to people eager for a similar feature - I have a package on pypi that enables one to do: In [74]: with extradict.MapGetter({'a': 1}) as d: ...: from d import a ...: In [75]: a Out[75]: 1 (just pip install extradict )

Re: [Python-ideas] Allow function to return multiple values

2017-06-09 Thread Mark E. Haase
On Thu, Jun 8, 2017 at 4:27 PM, Abe Dillon wrote: > >>> a, *b = 1, 2, 3, 4, 5 # NOTE: Most itterables unpack starred > variables as a list > >>> type(b) > > > >>> a, *b = "except strings" > >>> type(b) > > I was just playing around with this, and on Python 3.5.3, I see strings unpacked as li

Re: [Python-ideas] Allow function to return multiple values

2017-06-09 Thread Abe Dillon
No. You're right. I don't know why I thought strings were treated differently. On Jun 9, 2017 7:47 AM, "Mark E. Haase" wrote: > On Thu, Jun 8, 2017 at 4:27 PM, Abe Dillon wrote: > >> >>> a, *b = 1, 2, 3, 4, 5 # NOTE: Most itterables unpack starred >> variables as a list >> >>> type(b) >> >>

Re: [Python-ideas] Dictionary destructing and unpacking.

2017-06-09 Thread Chris Barker
a few notes: >From the OP: It would be cool to have a syntax that would unpack the dictionary to > values based on the names of the variables. Something perhaps like: > > a, b, c = **mydict > > which would assign the values of the keys 'a', 'b', 'c' to the variables. > a number of alternatives h