Looking for the best way to translate an idiom

James Stroud jstroud at mbi.ucla.edu
Sun Dec 14 20:07:20 EST 2008


drobinow at gmail.com wrote:
> 
> I'm baffled by this discussion.
> What's wrong with
>    a, dontcare, dontcare2 = f()
>    a = a + 1
> 
>  Simple, clear, and correct.

1. This can't apply to a generalized f() that may return an arbitrary 
number of arguments >= len(num_assignments_you_care_about).
2. The example chosen was misleading. You don't want to add 1 to the 
first element of the tuple, you want to move the "start" of the returned 
tuple up 1 and start assignment on the left from there.

James




More information about the Python-list mailing list