ml1n wrote: > [EMAIL PROTECTED] wrote: > > This may be what you need: > > > > class foo: > > def __init__(self, a, b): > > self.a = a > > self.b = b > > > > vars = [1,2,3,4,5,6] > > objects = [foo(a, 1) for a in vars] > > > > > > Note that in Python the new is expressed wit the () at the end: > > > > > f = new foo() > > > > Bye, > > bearophile > > (Not sure if this group likes top or bottom posts, sorry) > Thanks for the reply, > In the interests of speed my thinking was that using map would move the > loop out of Python and into C, is that the case when using list > comprehension? I'd always thought it was just syntatic short hand for > a Python loop. > > M.
Your thinking is correct. :-) Check out http://groups.google.ca/group/comp.lang.python/msg/7a56cf1a052b9c5d wherein Fredrik Lundh shows the difference by bytecode disassembly. Peace, ~Simon P.S. Bottom posts. -- http://mail.python.org/mailman/listinfo/python-list