meaning of: line, =
Gregory Ewing
greg.ewing at canterbury.ac.nz
Thu Feb 5 23:52:11 EST 2015
Chris Angelico wrote:
> [] = x
> # is equivalent to
> try: next(iter(x))
> except StopIteration: pass
> else: raise ValueError("too many values to unpack (expected 0)")
>
> It's a way of asserting that an iterator is exhausted!
But why disallow using () for the same thing? This
is a blatant case of outright list-ism! Tuples are
being unfairly discriminated against!
--
Greg
More information about the Python-list
mailing list