Rustom Mody wrote:

> Well its cryptic and confusing (to me at least)
> And is helped by adding 2 characters:
> 
> (result,) = f()
> 
> instead of
> 
> result, = f()

Another alternative is to put a list literal on the lefthand side:

>>> def f(): yield 42

... 
>>> [result] = f()
>>> result
42

(If you're worried: neither the list nor the tuple will be created; the 
bytecode is identical in both cases)

-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to