standard funcs in ext. module..

Gorny gorny at hobbiton.org
Thu Aug 30 07:24:24 EDT 2001


> These become methods of an Xxo object. If you look at Modules/xxmodule.c
> you'll see the same things (I'm assuming you were looking previously at
> Objects/xxobject.c). You'll see that Xxo_getattr is called out in the
> Xxo_Type struct, as the "getattr" method. So the time these would get
> invoked would be when you did this:
>
> import xx
> myXXobject = xx.new()
> myXXobject.foo = 3      # this will call Xxo_setattr
> print myXXobject.foo    # this will call Xxo_getattr

mmm allright I think I'll get it.

> If you built and linked xxobject.c, it probably wouldn't make
> sense to say "import Xxo", any more than you say "import intobject"
> before using integers. So there'd be no "Xxo" in the namespace, and
> you'd expect a NameError (as I got above) when you tried
> getattr(Xxo, "demo").

aah, sounds logical to me. ;-)

Thanks,
Gorny


--
"When I was a little kid, I had this dream where a snake would rule and
dominate
the entire world (actually, I guess that a penguin was also part of the
dream...
but never mind)" -- Python Develper's Handbook, Andre Lessa
http://gorny.cjb.net





More information about the Python-list mailing list