RE: [Python-Dev] 2.4a2, and @decorators

Michael Hudson writes:
that would be insane,
class C(random.choice([dict, list])): pass
is my favourite example of this :-)
Where is THAT monstrocity used!? -- Michael Chermside

Michael Chermside <mcherm@mcherm.com> writes:
Michael Hudson writes:
that would be insane,
class C(random.choice([dict, list])): pass
is my favourite example of this :-)
Where is THAT monstrocity used!?
Well, it's not, I hope :-) It might occasionally be useful for proving to people that Python really doesn't believe in declarations. Cheers, mwh -- Need to Know is usually an interesting UK digest of things that happened last week or might happen next week. [...] This week, nothing happened, and we don't care. -- NTK Now, 2000-12-29, http://www.ntk.net/

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 +--------------------------------------+

On Friday 2004-08-06 01:35, Greg Ewing wrote:
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...
... then you'd do better to find which out of (dict,list) does better on average, and always use that one. Sorry. :-) -- g

Gareth McCaughan <gmccaughan@synaptics-uk.com> writes:
On Friday 2004-08-06 01:35, Greg Ewing wrote:
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...
... then you'd do better to find which out of (dict,list) does better on average, and always use that one. Sorry. :-)
By running the above code on a wide range of inputs? :-) Cheers, mwh -- To summarise the summary of the summary:- people are a problem. -- The Hitch-Hikers Guide to the Galaxy, Episode 12

On Friday 2004-08-06 12:42, Michael Hudson wrote:
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...
... then you'd do better to find which out of (dict,list) does better on average, and always use that one. Sorry. :-)
By running the above code on a wide range of inputs? :-)
<boring>No, you'd get more reliable results for a given expenditure of effort by running half as many input datasets with class C(dict) and class C(list).</boring> -- g
participants (4)
-
Gareth McCaughan
-
Greg Ewing
-
Michael Chermside
-
Michael Hudson