[Patches] Patch 100730 -- Change creation of new instances in UserString/UserList

Thomas Wouters thomas@xs4all.net
Wed, 5 Jul 2000 10:12:16 +0200


On Wed, Jul 05, 2000 at 09:53:18AM +0200, Fredrik Lundh wrote:
> moshe wrote:
> > It's basically a refactoring of the 
> > 
> > return self.__class__(...)
> > 
> > ugliness into a single (overridable) method.
> > 
> > I'm +0 on that.

> -0: what's the point?  why would anyone create userlist sub-
> classes where slicing etc returns objects of *another* class?

The point was that someone (named Normal Shelley) complained on the
python-list that UserList used this 'trick' to create a new instance of the
subclass, but his subclass had extra, required arguments. He suggested using
copy.copy() to create a new instance, which I think is silly ;-P but he does
have a point that the 'self.__class__' thing is spread out all over
UserList, and is not easily overridable.

The python-list archive is still down, so I can't point there, but you can
probably find the thread on deja. It was a short 2-man discussion on c.l.py,
between Norman Shelley <Norman_Shelley-RRDN60@email.sps.mot.com> and myself,
subject 'UserDict and UserList issue (bug?_'. I'm not particularly + on this
patch myself, but I promised to try and send it in ;) (in private email, I
believe)

By the way, did Moshe's original reply to this go to
twouters@users.sourceforge.net too ? I dont seem to have gotten it. Please
leave me in the CC, though, the patches archive is down too ;-P

-- 
Thomas Wouters <thomas@xs4all.net>

Hi! I'm a .signature virus! copy me into your .signature file to help me spread!