Re: Calling super() in __init__ of a metaclass

2011-08-06 Thread Eli Bendersky
On Sat, Aug 6, 2011 at 11:04, Chris Rebert wrote: > On Sat, Aug 6, 2011 at 12:34 AM, Eli Bendersky wrote: >> Consider this standard metaclass definition: >> >> class MyMetaclass(type): >>    def __init__(cls, name, bases, dct): >>        super(MyMetaclass, cls).__init__(name, bases, dct) >>      

Re: Calling super() in __init__ of a metaclass

2011-08-06 Thread Peter Otten
Eli Bendersky wrote: > Consider this standard metaclass definition: > > class MyMetaclass(type): > def __init__(cls, name, bases, dct): > super(MyMetaclass, cls).__init__(name, bases, dct) > # do meta-stuff > > class Foo(object): > __metaclass__ = MyMetaclass > > The cal

Re: Calling super() in __init__ of a metaclass

2011-08-06 Thread Chris Rebert
On Sat, Aug 6, 2011 at 12:34 AM, Eli Bendersky wrote: > Consider this standard metaclass definition: > > class MyMetaclass(type): >    def __init__(cls, name, bases, dct): >        super(MyMetaclass, cls).__init__(name, bases, dct) >        # do meta-stuff > > class Foo(object): >    __metaclass__

Calling super() in __init__ of a metaclass

2011-08-06 Thread Eli Bendersky
Consider this standard metaclass definition: class MyMetaclass(type): def __init__(cls, name, bases, dct): super(MyMetaclass, cls).__init__(name, bases, dct) # do meta-stuff class Foo(object): __metaclass__ = MyMetaclass The call "super(MyMetaclass, cls)" should returns t

Re: calling super()

2007-04-11 Thread Laszlo Nagy
John Clark wrote: > Please be aware that super() has it's own set of gotchas - it's not as clean > as you would hope. For more info: http://fuhm.org/super-harmful/ > > (I'm not the author, I was referred to this article while struggling with > wxPython and super()) > This was interesting! I'm u

Re: calling super()

2007-04-04 Thread Bruno Desthuilliers
John Clark a écrit : > Yeah!!! One I can actually answer!!! > +1 QOTW -- http://mail.python.org/mailman/listinfo/python-list

Re: calling super()

2007-04-04 Thread Bruno Desthuilliers
Jarek Zgoda a écrit : > [EMAIL PROTECTED] napisał(a): > > (snip) >>class NewPage(HTMLMain): >>def __init__(self): >>print 'derive2 init' >>super(NewPage, self).__init__(); > > > This should read: super(HTMLMain, self).__init__() Nope. It's just how it should be. -- http:

Re: calling super()

2007-04-04 Thread Jarek Zgoda
Laszlo Nagy napisał(a): > Definitely, this is not true. Well, it depends what the OP wanted to do > here, but in 99.9% of the cases, you want to use Hah! I cancelled this message but seconds too late... -- Jarek Zgoda http://jpa.berlios.de/ -- http://mail.python.org/mailman/listinfo/python-lis

RE: calling super()

2007-04-04 Thread John Clark
-- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Laszlo Nagy Sent: Wednesday, April 04, 2007 4:09 PM To: Jarek Zgoda; python-list@python.org; [EMAIL PROTECTED] Subject: Re: calling super() Jarek Zgoda wrote: >> Hello, I have been trying to call the super constructor from my >

Re: calling super()

2007-04-04 Thread Laszlo Nagy
Jarek Zgoda wrote: >> Hello, I have been trying to call the super constructor from my >> derived class but its not working as expected. See the code: >> >> class HTMLMain: >> def __init__(self): >> self.text = ""; >> print(self.text); >> def __del__(self): >> self.te

Re: calling super()

2007-04-04 Thread Steve Holden
John Clark wrote: > Yeah!!! One I can actually answer!!! > Nice to see such enthusiasm. Well done! regards Steve -- Steve Holden +44 150 684 7255 +1 800 494 3119 Holden Web LLC/Ltd http://www.holdenweb.com Skype: holdenweb http://del.icio.us/steve.holden Recent Ramblings

Re: calling super()

2007-04-04 Thread attn . steven . kuo
On Apr 4, 12:22 pm, [EMAIL PROTECTED] wrote: > Hello, I have been trying to call the super constructor from my > derived class but its not working as expected. See the code: > > class HTMLMain: > def __init__(self): > self.text = ""; > print(self.text); > def __del__(self):

Re: calling super()

2007-04-04 Thread Jarek Zgoda
[EMAIL PROTECTED] napisał(a): > Hello, I have been trying to call the super constructor from my > derived class but its not working as expected. See the code: > > class HTMLMain: > def __init__(self): > self.text = ""; > print(self.text); > def __del__(self): > sel

RE: calling super()

2007-04-04 Thread John Clark
--Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of [EMAIL PROTECTED] Sent: Wednesday, April 04, 2007 3:23 PM To: python-list@python.org Subject: calling super() Hello, I have been trying to call the super constructor from my derived class but its not working as exp

Re: calling super()

2007-04-04 Thread Laszlo Nagy
> And here's the error message I get: > > Traceback (most recent call last): > File "e:/PyEN/inherit.py", line 16, in > N = NewPage(); > File "e:/PyEN/inherit.py", line 12, in __init__ > super(NewPage, self).__init__(); > TypeError: super() argument 1 must be type, not classobj > S

calling super()

2007-04-04 Thread Finger . Octopus
Hello, I have been trying to call the super constructor from my derived class but its not working as expected. See the code: class HTMLMain: def __init__(self): self.text = ""; print(self.text); def __del__(self): self.text = ""; print(self.text); class New