On Aug 18, 8:27 pm, [EMAIL PROTECTED] (Lawrence Oluyede) wrote: > beginner <[EMAIL PROTECTED]> wrote: > > Is there any equivalent version of C's static function in Python. I > > know I can make a class function private by starting a function name > > with two underscores, but it does not work with module functions. > > The trick for the name mangling does not work at module level. Anyway, > if you read the PEP 8 [1] you can correctly write your code following a > well known coding standard. A function like this: > > def _f(): > pass > > is meant to be private, you can also state it in the function's > docstring to be more clear, if you want, but it's not necessary > > > For exmaple, __func1 is still visible outside the module. > > Yes, and _f() will also be. There's no such thing as enforcing > encapsulation in Python, even the "__method()" trick can be easily > bypassed if you have to. > > 1 - <http://www.python.org/dev/peps/pep-0008/> > > HTH > > -- > Lawrence, oluyede.org - neropercaso.it > "It is difficult to get a man to understand > something when his salary depends on not > understanding it" - Upton Sinclair
Thanks a lot. I was using two underscores, __module_method() as my static method convention, and then I had some problems calling them from inside class methods. -- http://mail.python.org/mailman/listinfo/python-list