Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #57268
| From | Neil Cerutti <neilc@norwich.edu> |
|---|---|
| Newsgroups | comp.lang.python |
| Subject | Re: Class construction |
| Date | 2013-10-22 15:48 +0000 |
| Organization | Norwich University |
| Message-ID | <bcnl2uFj3ptU1@mid.individual.net> (permalink) |
| References | <CAE+T62bxxkVbfd9Kc4BQ7NEYOJYQB2v0MYO0njXBojEfv4w_SQ@mail.gmail.com> <mailman.1328.1382396266.18130.python-list@python.org> |
On 2013-10-21, Marcin Szamotulski <mszamot@gmail.com> wrote: > So the process (with some simplifications) goes like this: > > 1. get metaclass: meta > 2. call meta.__prepare__ to get namespace (class __dict__) > 3. evaluate the class body in the namespace > 4. call meta with arguemnts: name, bases, namespace > (when you instantiate any class in Python, metaclass is just > a class, first its __new__ method is called, and then its __init__) > > All this is in builtin__build_class__. In addition, the Python manual describes the process in detail. See The Python Language Reference 8.7 Class definitions. Here's a link to the 3.3 version of those docs: http://docs.python.org/3.3/reference/compound_stmts.html#class-definitions -- Neil Cerutti
Back to comp.lang.python | Previous | Next — Previous in thread | Find similar | Unroll thread
Re: Class construction Marcin Szamotulski <mszamot@gmail.com> - 2013-10-21 23:57 +0100 Re: Class construction Neil Cerutti <neilc@norwich.edu> - 2013-10-22 15:48 +0000
csiph-web