Re: Inheriting from object

2005-07-03 Thread Bengt Richter
On Sat, 02 Jul 2005 12:26:49 -0700, Scott David Daniels <[EMAIL PROTECTED]> wrote: >Bengt Richter wrote: >> On Thu, 30 Jun 2005 08:54:31 -0700, Scott David Daniels <[EMAIL PROTECTED]> >> wrote: >>>Or, perhaps: >>>class foo(object): >>>def __init__(self, *args, **kwargs): >>>

Re: Inheriting from object

2005-07-02 Thread Bengt Richter
On Sat, 02 Jul 2005 14:17:32 -0400, Peter Hansen <[EMAIL PROTECTED]> wrote: >Bengt Richter wrote: >> BTW, there's something about referring to type(self) by its not >> always dependably bound (though usually global) name that bothers me. >> >> I wonder if the above common use of super could be im

Re: Inheriting from object

2005-07-02 Thread John Roth
"Bengt Richter" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > I wonder if the above common use of super could be implemented as a > property of object, > so you'd normally inherit it and be able to write >self.super.__init__(*args, **kwargs) # (maybe spell it > self.__super

Re: Inheriting from object

2005-07-02 Thread Steven Bethard
Bengt Richter wrote: > I wonder if the above common use of super could be implemented as a property > of object, > so you'd normally inherit it and be able to write > self.super.__init__(*args, **kwargs) # (maybe spell it > self.__super__.__init__(...) I suppose) > > I.e., self.__super__ wo

Re: Inheriting from object

2005-07-02 Thread Scott David Daniels
Bengt Richter wrote: > On Thu, 30 Jun 2005 08:54:31 -0700, Scott David Daniels <[EMAIL PROTECTED]> > wrote: >>Or, perhaps: >>class foo(object): >>def __init__(self, *args, **kwargs): >>super(foo, self).__init__(self, *args, **kwargs) >>... >> > > Doesn't super(

Re: Inheriting from object

2005-07-02 Thread Peter Hansen
Bengt Richter wrote: > BTW, there's something about referring to type(self) by its not > always dependably bound (though usually global) name that bothers me. > > I wonder if the above common use of super could be implemented as a property > of object, > so you'd normally inherit it and be able t

Re: Inheriting from object

2005-07-02 Thread Bengt Richter
On Thu, 30 Jun 2005 08:54:31 -0700, Scott David Daniels <[EMAIL PROTECTED]> wrote: >Sion Arrowsmith wrote: >> ... And if you were to do so, surely: >> class foo(object): >> def __init__(self, *args, **kwargs): >> super(foo, self).__init__(self) >> >> would be the preferred way to go? >>

Re: Inheriting from object

2005-06-30 Thread Scott David Daniels
Sion Arrowsmith wrote: > ... And if you were to do so, surely: > class foo(object): > def __init__(self, *args, **kwargs): > super(foo, self).__init__(self) > > would be the preferred way to go? > Or, perhaps: class foo(object): def __init__(self, *args, **kwargs):

Re: Inheriting from object

2005-06-30 Thread Sion Arrowsmith
Bruno Desthuilliers <[EMAIL PROTECTED]> wrote: >Fuzzyman a écrit : >> *Should* I in fact write : >> >> class foo(object): >> def __init__(self, *args, **kwargs): >> object.__init__(self) >> >> ? >Nope. And if you were to do so, surely: class foo(object): def __init__(self, *arg

Re: Inheriting from object

2005-06-30 Thread Fuzzyman
The reason I ask is that I often (well... a couple of times anyway) see cryptic omments like : and if you inherit from object you get all the benefits of new style classes Now I know about the advantages of inheriting from the built in types (if that's what you want to do) -but am a bit fuzzi

Re: Inheriting from object

2005-06-29 Thread Dave Benjamin
Steven Bethard wrote: > Guido also suggests that the explicit: > > class C(object): > pass > > is "much preferred"[2] over: > > __metaclass__ = type > > class C: > pass Really? I have been toying with the idea of using the __metaclass__ trick, since it results in c

Re: Inheriting from object

2005-06-29 Thread Steven Bethard
Fuzzyman wrote: > Surely when they are removed : > > class foo: > pass > > won't become invalid syntax, it will just automatically inherit from > object ? Well, Guido views this particular syntax as an "oopsie"[1]. It should actually look like: class C(): pass Guido also su

Re: Inheriting from object

2005-06-29 Thread Fuzzyman
So theres no actual advantage that you know of ;-) Surely when they are removed : class foo: pass won't become invalid syntax, it will just automatically inherit from object ? That's what I assumed, anyway Regards, Fuzz http://www.voidspace.org.uk/python -- http://mail.python.org/ma

Re: Inheriting from object

2005-06-29 Thread Benji York
Fuzzyman wrote: > Also, can anyone explain any tangible benefit of inheriting from > object, when not explicitly using any features of new style classes ? One reason is that properties won't work correctly. -- Benji York -- http://mail.python.org/mailman/listinfo/python-list

Re: Inheriting from object

2005-06-29 Thread Bruno Desthuilliers
ct): > def __init__(self, *args, **kwargs): > object.__init__(self) > > ? Nope. > Also, can anyone explain any tangible benefit of inheriting from > object, when not explicitly using any features of new style classes ? old-style classes are deprecated. They are

Re: Inheriting from object

2005-06-29 Thread Robert Kern
ct): > def __init__(self, *args, **kwargs): > object.__init__(self) > > ? I don't believe so. > Also, can anyone explain any tangible benefit of inheriting from > object, when not explicitly using any features of new style classes ? This class might not, but yo

Inheriting from object

2005-06-29 Thread Fuzzyman
anyone explain any tangible benefit of inheriting from object, when not explicitly using any features of new style classes ? Thanks :-) Fuzzyman http://www.voidspace.org.uk/python -- http://mail.python.org/mailman/listinfo/python-list