Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #21860
| References | <20411334.2044.1331962234309.JavaMail.geo-discussion-forums@yncd8> <mailman.754.1331976324.3037.python-list@python.org> <mailman.755.1331978701.3037.python-list@python.org> <mailman.756.1331986866.3037.python-list@python.org> <14929632.47.1332063740635.JavaMail.geo-discussion-forums@ynbq18> |
|---|---|
| From | Ian Kelly <ian.g.kelly@gmail.com> |
| Date | 2012-03-18 10:14 -0600 |
| Subject | Re: How to get a reference of the 'owner' class to which a method belongs in Python 3.X? |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.784.1332087285.3037.python-list@python.org> (permalink) |
On Sun, Mar 18, 2012 at 3:42 AM, Cosmia Luna <cosmius@gmail.com> wrote: > But it seems that the last line(#ref2) in the Py2Type.__init__ does not work at > all. I'm not sure what you're expecting it to do, but type.__init__ does not actually do anything > It seems really weird, 'type' is an instance of 'type' itself, I'm not sure > if I'm calling the unbound method __init__ or bound method __init__. type.__init__ is never bound. > It seems type.__new__ calls type.__init__ before it calls Py2Type.__init__, > because dict_ is already copied to cls.__dict__ at line(#ref3). No, type.__new__ does not call type.__init__ at all. Rather, it is type.__new__ that is responsible for copying the dict, not type.__init__. For this reason you should override type.__new__ in your metaclass, not type.__init__. Cheers, Ian
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
How to get a reference of the 'owner' class to which a method belongs in Python 3.X? Cosmia Luna <cosmius@gmail.com> - 2012-03-16 22:30 -0700
Re: How to get a reference of the 'owner' class to which a method belongs in Python 3.X? Chris Rebert <clp2@rebertia.com> - 2012-03-16 22:51 -0700
Re: How to get a reference of the 'owner' class to which a method belongs in Python 3.X? Richard Thomas <chardster@gmail.com> - 2012-03-17 00:34 -0700
Re: How to get a reference of the 'owner' class to which a method belongs in Python 3.X? Cosmia Luna <cosmius@gmail.com> - 2012-03-17 01:11 -0700
Re: How to get a reference of the 'owner' class to which a method belongs in Python 3.X? Peter Otten <__peter__@web.de> - 2012-03-17 10:25 +0100
Re: How to get a reference of the 'owner' class to which a method belongs in Python 3.X? Cosmia Luna <cosmius@gmail.com> - 2012-03-17 03:04 -0700
Re: How to get a reference of the 'owner' class to which a method belongs in Python 3.X? Cosmia Luna <cosmius@gmail.com> - 2012-03-17 05:21 -0700
Re: How to get a reference of the 'owner' class to which a method belongs in Python 3.X? Cosmia Luna <cosmius@gmail.com> - 2012-03-18 02:42 -0700
Re: How to get a reference of the 'owner' class to which a method belongs in Python 3.X? Cosmia Luna <cosmius@gmail.com> - 2012-03-18 02:42 -0700
Re: How to get a reference of the 'owner' class to which a method belongs in Python 3.X? Ian Kelly <ian.g.kelly@gmail.com> - 2012-03-18 10:14 -0600
Re: How to get a reference of the 'owner' class to which a method belongs in Python 3.X? Cosmia Luna <cosmius@gmail.com> - 2012-03-17 05:21 -0700
Re: How to get a reference of the 'owner' class to which a method belongs in Python 3.X? Cosmia Luna <cosmius@gmail.com> - 2012-03-17 03:04 -0700
Re: How to get a reference of the 'owner' class to which a method belongs in Python 3.X? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-03-17 10:01 +0000
csiph-web