On Monday, April 15, 2013 2:35:10 PM UTC-6, Tobiah wrote:
> > tup = *func()
> What is the asterisk for? I assume it's a python 3
Not Python 3, pseudocode. I should have said as such, sorry. Supposed to
indicate an expanded tuple.
-- Gnarlie
--
http://mail.python.org/mailman/listinfo/python-li
On 04/15/2013 02:35 PM, Tobiah wrote:
> On 04/15/2013 11:25 AM, Gnarlodious wrote:
>> Say I have a tuple I want to expand assigning to variables:
>>
>> tup = *func()
>
> What is the asterisk for? I assume it's a python 3
> thing, because I get a syntax error, but I'm having
> trouble Googling it.
On 04/15/2013 11:25 AM, Gnarlodious wrote:
Say I have a tuple I want to expand assigning to variables:
tup = *func()
What is the asterisk for? I assume it's a python 3
thing, because I get a syntax error, but I'm having
trouble Googling it.
Thanks,
Tobiah
--
http://mail.python.org/mailman/
On 15/04/2013 20:05, Barrett Lewis wrote:
d = {}
for key, d[key] in (("this",18), ("that",17), ("other",38)):
print key
do_something(d)
Why not use a dict comprehension?
d = {k:v for k,v in (("this",18), ("that",17), ("other",38))}
I feel this is more straig
> In the particular case I did it in, I needed the incremental results
> passed to a function, not just the final result. I don't think this
> made it into the final code, rather it was expanded to be more
> readable. But the discovery made me feel a disturbance in the
> Pythonic force of the uni
On 2013-04-15 12:05, Barrett Lewis wrote:
> > d = {}
> > for key, d[key] in (("this",18), ("that",17), ("other",38)):
> > print key
> > do_something(d)
>
> Why not use a dict comprehension?
> d = {k:v for k,v in (("this",18), ("that",17), ("other",38))}
>
> I feel this is more straig
Tim Chase wrote:
> On 2013-04-15 11:25, Gnarlodious wrote:
>> Say I have a tuple I want to expand assigning to variables:
>>
>> tup = *func()
>> var = tup[0]
>> lst.append(tup[1])
>>
>> Or could I do it in one line?
>>
>> var, lst.append() = *func()
>>
>> So I want to append one variable to a
> d = {}
> for key, d[key] in (("this",18), ("that",17), ("other",38)):
> print key
> do_something(d)
>
Why not use a dict comprehension?
d = {k:v for k,v in (("this",18), ("that",17), ("other",38))}
I feel this is more straightforward and easier to read. the results are the
same how
On 2013-04-15 11:25, Gnarlodious wrote:
> Say I have a tuple I want to expand assigning to variables:
>
> tup = *func()
> var = tup[0]
> lst.append(tup[1])
>
> Or could I do it in one line?
>
> var, lst.append() = *func()
>
> So I want to append one variable to a list on the fly, is it
> possib