SWIG and function name question

steven_shaw at adc.com steven_shaw at adc.com
Thu Nov 4 01:57:22 EST 1999


You won't get them with your 'from module import *' because they
begin with underscore. Names beginning with underscore are "private"
by convention in Python. The 'from module import *' implements this
"convention". It is the only for of access restriction in Python.

Probably someone else can explain it better.

-SS

In article <7vmc7e$8h$1 at marcie.fissiontech.com>,
  kain at dynup.net wrote:
> Hey folks,
>
> I downloaded and started to learn SWIG today and I ran into a little
problem.
> In the C code there is a structure like this:
>
> struct __foo { ... };
>
> When I import my SWIG created module using 'import mymodule' I have
access
> to the struct's set/get operation via mymodule.__foo_set_member() but
if I
> import my module using 'from mymodule import *' I have access to all
of my
> modules functions accept the two get/set functions that begin with __
> (I'm using dir() to check this).  This isn't too much of a problem
for me
> but I'm just wondering what's going on.  Can anyone clear this up for
me?
>
> Thanks,
> Scott
>
>


Sent via Deja.com http://www.deja.com/
Before you buy.




More information about the Python-list mailing list