Algorithm help per favore

Skip Montanaro skip at pobox.com
Wed Jun 18 22:45:34 CEST 2003


    David> It's tempting to use "not L[0]" instead (since what I want is an
    David> object that's not equal to L[0]) but that fails when L is empty.

How about "not L[0:1]"?  Since L is a sequence (right?), "not L[0:1]" will
be True if L is empty and False otherwise.

Skip





More information about the Python-list mailing list