Rich Comparisons Gotcha

Rasmus Fogh rhf22 at mole.bio.cam.ac.uk
Tue Dec 9 05:37:11 EST 2008


Steven DAprano wrote:
> On Mon, 08 Dec 2008 14:24:59 +0000, Rasmus Fogh wrote:

>> For my personal problem I could indeed wrap all objects in a wrapper
>> with whatever 'correct' behaviour I want (thanks, TJR). It does seem a
>> bit much, though, just to get code like this to work as intended:
>>   alist.append(x)
>>   print ('x is present: ', x in alist)
>>
>> So, I would much prefer a language change. I am not competent to even
>> propose one properly, but I'll try.

> You think changing the language is easier than applying a wrapper to
> your own data??? Oh my, that's too funny for words.

Any individual case of the problem can be hacked somehow - I have already
fixed this one.

My point is that python would be a better language if well-written classes
that followed normal python conventions could be relied on to work
correctly with list, and that it is worth trying to bring this about.
Lists are a central structure of the language after all. Of course you can
disagree, or think the work required would be disproportionate, but surely
there is nothing unreasonable about my point?

Rasmus

---------------------------------------------------------------------------
Dr. Rasmus H. Fogh                  Email: r.h.fogh at bioc.cam.ac.uk
Dept. of Biochemistry, University of Cambridge,
80 Tennis Court Road, Cambridge CB2 1GA, UK.     FAX (01223)766002



More information about the Python-list mailing list