Object System

John Mendelewski john.mendelewski at gmail.com
Thu Mar 19 19:37:42 EDT 2009


On Mar 19, 6:19 pm, Benjamin Peterson <benja... at python.org> wrote:
> John Mendelewski <john.mendelewski <at> gmail.com> writes:
>
>
>
> > I was wondering if anyone had documents or articles what gave an in-
> > depth view of the object system in Python. Ones concerning dispatch,
> > how self really works, and maybe some meta-programming that comes
> > along with the new style classes.
>
> What do you mean "how self really works"?
>
> It's just an instance of the class.

I meant:

>>> class A(object):
...   def do(self):
...     print self.__class__, self.__class__.__bases__
...
>>> a = A()
>>> a.do()
<class '__main__.A'> (<type 'object'>,)

What goes on behind the scenes to make a.do() evaluate the do
method with a bound to self in that method? Is this implemented
in C, Python? I think I have a grasp of how to use objects, but
I was wondering about the implementation I suppose.



More information about the Python-list mailing list