
Aug. 6, 2004
12:35 a.m.
class C(random.choice([dict, list])): pass
is my favourite example of this :-)
Where is THAT monstrocity used!?
Well, it's not, I hope :-)
Hmmm... maybe if you had some algorithm that was more efficient using either a list or a dict, depending on the input data, but in a way that makes it difficult to tell ahead of time which to use, and you want to improve the average behaviour... Greg Ewing, Computer Science Dept, +--------------------------------------+ University of Canterbury, | A citizen of NewZealandCorp, a | Christchurch, New Zealand | wholly-owned subsidiary of USA Inc. | greg@cosc.canterbury.ac.nz +--------------------------------------+