
On Mon, Oct 17, 2011 at 11:00 PM, Paul Moore <p.f.moore@gmail.com> wrote:
I'd expect the given suite to only contain name-definition statements (assignments, function and class definitions). Anything else should be at least bad practice, if not out and out illegal...
It would be perfectly legal, just inadvisable most of the time (as the suggested PEP 8 addition says, if your given clause gets unwieldy, it's probably a bad idea). However, those expansions are almost exactly what 3.x comprehensions look like from the interpreter's point of view. And the assignment between the given statement and the colon wasn't a typo - that was the explicit early binding of an expression evaluated in the outer scope. It's the way comprehensions behave, and I suspect it may be a good compromise for given statements as well (to make their scoping rules more consistent with the rest of the language, while still having them be vaguely usable at class scope) Cheers, Nick. -- Nick Coghlan | ncoghlan@gmail.com | Brisbane, Australia