Is there a commas-in-between idiom?
Magnus Lycka
lycka at carmen.se
Thu Nov 9 04:01:06 EST 2006
More information about the Python-list mailing list
Thu Nov 9 04:01:06 EST 2006
- Previous message (by thread): Is there a commas-in-between idiom?
- Next message (by thread): Is there a commas-in-between idiom?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Ernesto García García wrote: > list = [1,2,3,4,5,6] Just a nit-pick: It's considered an anti-idiom to hide builtins just as list by using it as a name for a variable. >>> list=[1,2,3,4,5] >>> tuple = (1,2,3,4,5) >>> if list == list(tuple): print "equal" ... Traceback (most recent call last): File "<stdin>", line 1, in ? TypeError: 'list' object is not callable >>> #ouch! ... >>> l=list >>> del list >>> if l == list(tuple): print "equal" ... equal >>> if tuple(l)==tuple: print "equal" ... Traceback (most recent call last): File "<stdin>", line 1, in ? TypeError: 'tuple' object is not callable >>> t=tuple >>> del tuple >>> if tuple(l)==t: print "equal" ... equal
- Previous message (by thread): Is there a commas-in-between idiom?
- Next message (by thread): Is there a commas-in-between idiom?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list