while true: !!!

Tim Peters tim.one at home.com
Wed Dec 20 20:11:55 CET 2000


[gbreed at cix.compulink.co.uk]
> ...
> If you want to empty a sequence, but preserve the type, try
> filter(lambda x:0, asequence).

Picking a nit:  that returns an empty list, regardless of type(asequence).
To get an empty sequence of the same type, do

    asequence[:0]

or even

    asequence * 0

there's-only-one-way-to-do-it-ly y'rs  - tim





More information about the Python-list mailing list