Documentation, assignment in expression.

Alexander Blinne news at blinne.net
Sun Mar 25 08:18:44 EDT 2012


I am not sure I understand your argument. The doc section states that

" [...] in Python you’re forced to write this:

while True:
    line = f.readline()
    if not line:
        break
    ... # do something with line".

That simply isn't true as one can simply write:

for line in f:
	#do stuff

which is the exact counter of the C idiom that C or perl people try to
use and complained about when they were really forced to write the above
lengthy while True loop. So there is no reason to want to do "assignment
in expression", so no real reason to use this example to explain why
they aren't there in python. I totally agree with the
error-handling-reason not allowing them.

I agree with Roy Smith saying that documentation shouldn't refer to the
"current version".



More information about the Python-list mailing list