Documentation, assignment in expression.

Chris Angelico rosuav at gmail.com
Sun Mar 25 09:11:22 EDT 2012


On Mon, Mar 26, 2012 at 12:03 AM, Tim Chase
<python.list at tim.thechases.com> wrote:
> Granted, this can be turned into an iterator with a yield, making the issue
> somewhat moot:

No, just moving the issue to the iterator. Your iterator has exactly
the same structure in it.

Personally, I quite like assignment-in-conditional notation. Yes, it's
a pretty common cause of problems; but what happened to the
"consenting adults" policy? Python permits operator overloading and
even the reassignment of builtins, both of which can cause similar
confusion.

But, that's the choice Python's made. And being able to use the same
symbol for assignment and comparison does have its advantages.

ChrisA



More information about the Python-list mailing list