Misuse of list comprehensions?

John Salerno johnjsal at NOSPAMgmail.com
Tue May 20 16:21:04 EDT 2008


"Thomas Bellman" <bellman at lysator.liu.se> wrote in message 
news:g0umoh$i0s$1 at news.lysator.liu.se...
> "John Salerno" <johnjsal at NOSPAMgmail.com> writes:
>
>> "Diez B. Roggisch" <deets at nospam.web.de> wrote in message
>> news:69g2bpF31ttuuU1 at mid.uni-berlin.de...
>>> the above code is pretty much of a no-no because it has quadratic 
>>> runtime
>>> behavior.
>
>> What's that mean, exactly?

> However, it actually depends on what your input is.  For the
> runtime to increase with the square of the input length in your
> function, the number of *unique* items on the input must be a
> constant fraction of the input length.

Whew! Let me re-read your post...........   :) 





More information about the Python-list mailing list