Strange(?) list comprehension behavior

Scott David Daniels Scott.Daniels at Acm.Org
Sat Jul 19 22:15:20 EDT 2003


George Henry wrote:
> Never mind, my result was due to a typo. Have you ever typed "<" rather 
> than "," ... and structured your code in such a way that the error 
> escpaed your notice on casual perusal? So ... [ "s1", ... "sj"< "sk", 
> ... "sn"] does indeed produce an int.

One way that I reduce these problems is defining longer lists
like this:
     ops = '~ ! @ + - | || < << > >> ...'.split()

-Scott David Daniels
Scott.Daniels at Acm.Org





More information about the Python-list mailing list