function call problem in class?

Davy zhushenli at gmail.com
Wed Nov 14 02:51:57 EST 2007


Hi all,

I have write a simple class, I want the function two() to call private
function __one(), but there is an error :
NameError: global name '_simple__one' is not defined, how to work
around it

class simple:
    def __one(self):
        print "Hello"
    def two(self):
        __one()
        print "world"

if __name__ == '__main__':
    s = simple()
    s.two()

Any suggestion is welcome!
Best regards,
Davy




More information about the Python-list mailing list