DXOracle / PyADO - convert lists of tuples to list of lists
Terry Hancock
hancock at anansispaceworks.com
Sat Dec 14 01:34:48 EST 2002
On Friday 13 December 2002 08:11 pm, Gerhard wrote:
> Lists are mutable, tuples aren't. Tuples are also hashable (because
> they're immutable). Unless your app depends on one of these properties,
> it shouldn't 'stumble'.
Take care with that statement...
>>> hash( ([1,'2'], {'shinobu':1}, 'ataru') )
Traceback (most recent call last):
File "<stdin>", line 1, in ?
TypeError: list objects are unhashable
>>>
i.e. it depends on what's in the tuple. Hashable means immutable throughout.
Cheers,
Terry
--
Terry Hancock ( hancock at anansispaceworks.com )
Anansi Spaceworks http://www.anansispaceworks.com
"Some things are too important to be taken seriously"
More information about the Python-list
mailing list