Andrey Tatarinov wrote:

anyway list comprehensions are just syntaxic sugar for

 >>> for var in list:
 >>>     smth = ...
 >>>     res.append(smth)

(is that correct?)

so there will be no speed gain, while map etc. are C-implemented

It depends.

Try

  def square(x):
      return x*x
  map(square, range(1000))

versus

  [x*x for x in range(1000)]

Hint: function calls are expensive.

--
Robert Kern
[EMAIL PROTECTED]

"In the fields of hell where the grass grows high
 Are the graves of dreams allowed to die."
  -- Richard Harter
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to