"newseater" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
>> > class Creator
>> > def createInstance(cls, *args, **kwargs):
>> > anewinstance = cls.__new__(cls, *args, **kwargs)
>> > anewinstance.__init__(*args, **kwargs)
>> >
>> > return anewinstance
>> > createInstance = staticmet
>
> A staticmethod does not take a cls argument. It is essentially just a
> function that is attached to a class.
yes i know of that difference... but one cannot easily override a class
method in a supclass.. as calling super then make the cls variable
point to the super class class rather than th
> > class Creator
> > def createInstance(cls, *args, **kwargs):
> > anewinstance = cls.__new__(cls, *args, **kwargs)
> > anewinstance.__init__(*args, **kwargs)
> >
> > return anewinstance
> > createInstance = staticmethod(createInstance)
> >
> >
> > can anyone help??
>
> __new__ is the proper way t
newseater wrote:
>
> Robert Kern wrote:
>
>>newseater wrote:
>>
>>>Hello. I need to be able to control how objects are created. Sometimes
>>>when creating an object, i want to reuse another object instead. I've
>>>searched for factory method implementations and singleton
>>>implementations. They
"newseater" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Hello. I need to be able to control how objects are created. Sometimes
> when creating an object, i want to reuse another object instead. I've
> searched for factory method implementations and singleton
> implementations. Th
Robert Kern wrote:
> newseater wrote:
> > Hello. I need to be able to control how objects are created. Sometimes
> > when creating an object, i want to reuse another object instead. I've
> > searched for factory method implementations and singleton
> > implementations. They were too much of a hac
newseater wrote:
> Hello. I need to be able to control how objects are created. Sometimes
> when creating an object, i want to reuse another object instead. I've
> searched for factory method implementations and singleton
> implementations. They were too much of a hack!
>
> My first attempt of doi
Hello. I need to be able to control how objects are created. Sometimes
when creating an object, i want to reuse another object instead. I've
searched for factory method implementations and singleton
implementations. They were too much of a hack!
My first attempt of doing this was to play around wi