Scott David Daniels:
> If you want to keep the original's method, but do it in a more Pythonic
> way, I would suggest:
>
>      def deNone4(alist):
>          j = 0
>          for val in alist:
>              if val is not None:
>                  alist[j] = val
>                  j += 1
>          del alist[j :]

For my benchmarks this is also the faster version with and without
Psyco :-)
(Even it's a bit slow when given a list that has no Nones).

Bye,
bearophile
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to