Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #21471
| From | "Colin J. Williams" <cjw@ncf.ca> |
|---|---|
| Newsgroups | comp.lang.python |
| Subject | Re: newb __init__ inheritance |
| Date | 2012-03-10 17:47 -0500 |
| Organization | National Capital Freenet, Ottawa, Ontario, Canada |
| Message-ID | <jjglmi$dao$1@theodyn.ncf.ca> (permalink) |
| References | <1c6db866-6fa3-4de5-96de-51d6720a1300@x17g2000yqj.googlegroups.com> <jjg4p3$lst$1@theodyn.ncf.ca> |
On 10/03/2012 12:58 PM, Colin J. Williams wrote:
> On 08/03/2012 10:25 AM, hyperboogie wrote:
>> Hello everyone.
>>
[snip]
> main()
> I'm not sure that the class initialization is required.
>
> Good luck,
>
> Colin W.
When I wrote earlier, I wondered about the need for initialization.
With Version 2, both __new__ and __init__ were required, not in the
example below, using version 3.2:
#!/usr/bin/env python
class A():
def ringA(self):
print ('aaa')
def ringB(self):
print('bbb')
class B(A):
def __init__(self:)
def ringB(self):
print('BBB')
a= A()
b= B()
b.ringB()
b.ringA()
b.__class__.mro()[0].ringB(22) # 22 is used for the ringB attribute
# Trial and error shows that any
# non-Null,including None for the
# argument gives the same result
z= 1
def main():
pass
if __name__ == '__main__':
main()
Colin W.
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
newb __init__ inheritance hyperboogie <hyperboogie@gmail.com> - 2012-03-08 07:25 -0800
Re: newb __init__ inheritance Maarten <maarten.sneep@knmi.nl> - 2012-03-08 08:30 -0800
Re: newb __init__ inheritance Peter Otten <__peter__@web.de> - 2012-03-08 18:03 +0100
Re: newb __init__ inheritance Ethan Furman <ethan@stoneleaf.us> - 2012-03-08 09:34 -0800
Re: newb __init__ inheritance "Colin J. Williams" <cjw@ncf.ca> - 2012-03-10 12:58 -0500
Re: newb __init__ inheritance "Colin J. Williams" <cjw@ncf.ca> - 2012-03-10 17:47 -0500
Re: newb __init__ inheritance hyperboogie <hyperboogie@gmail.com> - 2012-03-11 03:18 -0700
Re: newb __init__ inheritance Chris Rebert <clp2@rebertia.com> - 2012-03-11 03:38 -0700
Re: newb __init__ inheritance hyperboogie <hyperboogie@gmail.com> - 2012-03-11 03:56 -0700
Re: newb __init__ inheritance Chris Rebert <clp2@rebertia.com> - 2012-03-11 04:37 -0700
Re: newb __init__ inheritance Ian Kelly <ian.g.kelly@gmail.com> - 2012-03-11 05:40 -0600
Re: newb __init__ inheritance Ian Kelly <ian.g.kelly@gmail.com> - 2012-03-11 05:52 -0600
Re: newb __init__ inheritance Peter Otten <__peter__@web.de> - 2012-03-11 13:12 +0100
Re: newb __init__ inheritance hyperboogie <hyperboogie@gmail.com> - 2012-03-11 03:56 -0700
Re: newb __init__ inheritance hyperboogie <hyperboogie@gmail.com> - 2012-03-12 02:09 -0700
csiph-web