Ad hoc lists vs ad hoc tuples
Floris Bruynooghe
floris.bruynooghe at gmail.com
Wed Jan 27 05:20:53 EST 2010
One thing I ofter wonder is which is better when you just need a
throwaway sequence: a list or a tuple? E.g.:
if foo in ['some', 'random', 'strings']:
...
if [bool1, bool2, boo3].count(True) != 1:
...
(The last one only works with tuples since python 2.6)
Is a list or tuple better or more efficient in these situations?
Regards
Floris
PS: This is inspired by some of the space-efficiency comments from the
list.pop(0) discussion.
More information about the Python-list
mailing list