total idiot question: +=, .=, etc...

Neel Krishnaswami neelk at brick.cswv.com
Thu Jul 1 23:06:15 EDT 1999


In article <000d01bec11f$8f966e20$e19e2299 at tim>,
Tim Peters <tim_one at email.msn.com> wrote:
>[Neel Krishnaswami]
>
>> With the clear way of writing it, the NewArticle class would
>> mysteriously fail to do the right thing, because the __cmp__ method
>> would look in the Article class dictionary without bothering to check
>> NewArticle's.
>
>The trap is hard to avoid, though:  if a direct instance of Article is
>"self", and a direct instance of NewArticle is "other", even keying off
>self.__class__.etc is a surprise (well, at least to "other"!).  In part
>you're taking a single-dispatch approach to a problem with multiple-dispatch
>headaches.  

<light dawns> 

Of course! I had noticed I wasn't having this problem in Dylan, and 
it somehow failed to occur to me that the only significant difference
between Dylan and Python (Dylan's multiple-dispatch object model)
might have something to do with it. :)


Neel




More information about the Python-list mailing list