SWIG and function name question

Fredrik Lundh fredrik at pythonware.com
Wed Nov 10 08:04:02 EST 1999


Scott Barron <kain at twilight.> wrote:
> >>> import bar
> Traceback (innermost last):
>   File "<stdin>", line 1, in ?
>   File "bar.py", line 3, in ?
>     class Foo:
>   File "bar.py", line 4, in Foo
>     self.f = foo.__foo
> AttributeError: _Foo__foo
> 
> If I comment out self.f = foo.__foo all works fine.  What am I doing wrong
> here?

names that start with "__" are private to the class
they're defined in.  foo.__foo is interpreted as a
private member of the Foo class, not the global
variable.

</F>

<!-- (the eff-bot guide to) the standard python library:
http://www.pythonware.com/people/fredrik/librarybook.htm
-->






More information about the Python-list mailing list