SWIG and function name question
Scott Barron
kain at twilight.
Wed Nov 3 20:47:27 EST 1999
Hi,
How about this:
Given these two files,
## foo.py
def __foo():
print "Foo"
def bar():
print "Bar"
## bar.py
import foo
class Foo:
self.f = foo.__foo # Create an alias for foo.__foo
self.b = foo.bar # Create an alias for foo.bar
>>> 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?
Thanks,
Scott
In article <m3ln8f9y9u.fsf at atrus.jesus.cam.ac.uk>, Michael Hudson wrote:
>kain at twilight. (Scott Barron) writes:
>
>
>It's nothing to do with SWIG; try this for size:
>
>put this in a file called foo.py on your PYTHONPATH:
>
<snip>
>
>HTH,
>Michael
>
>O, look: http://www.python.org/doc/current/ref/import.html has all the
>gory details...
More information about the Python-list
mailing list