Implicit lists

Dale Strickland-Clark dale at riverhall.NOTHANKS.co.uk
Thu Jan 30 15:01:36 EST 2003


David Eppstein <eppstein at ics.uci.edu> wrote:

>
>One problem with it as it stands is that it won't work when lst is a 
>simple generator.
>
>how about:
>
>try:
>    lst = iter(lst)
>except TypeError:
>    lst = [lst]

Unfortunately, iter(lst) will still convert a string into a list of
chars.
--
Dale Strickland-Clark
Riverhall Systems Ltd




More information about the Python-list mailing list