Newbie ?:A more concise way?

Carel Fellinger cfelling at iae.nl
Sun Mar 3 21:30:01 EST 2002


Brian <brian at lodoss.org> wrote:
> Regarding:

> z = [MyClass() for i in xrange(y)]

> Is there a way to do this without the use of i?

ofcourse, if you incist:)

    >>> class MyClass: pass
    ...
    >>> z = map(lambda x: C(), range(3))


    
-- 
groetjes, carel



More information about the Python-list mailing list