[Python-ideas] Assignments in list/generator expressions

Greg Ewing greg.ewing at canterbury.ac.nz
Wed Apr 13 00:34:29 CEST 2011


M.-A. Lemburg wrote:

> This is already possible using the "class" keyword
> 
> class myData:
>   x = setup_x()
>   y = setup_y()

Only for certain values of "possible". It potentially
confuses the reader by using a class in an unusual way.
When one sees a class definition, one's first thought
is that instances of it are going to be created at some
point, but that's not the case here.

-- 
Greg



More information about the Python-ideas mailing list