Johnny Lee wrote:
> Class A:

s/C/c/

>    def __init__(self):
>       self.member = 1
> 
>    def getMember(self):
>       return self.member
> 
> a = A()
> 
> So, is there any difference between a.member and a.getMember? 

yes : a.member is an integer, a.getMember is a bound method. You could
have found this by yourself...

Note that the getter/setter plague is useless and unpythonic. Use
properties instead if you need to control attributes access. There are
decorator idioms to make clean and easy properties, look here:
http://wiki.python.org/moin/PythonDecoratorLibrary


-- 
bruno desthuilliers
python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for
p in '[EMAIL PROTECTED]'.split('@')])"
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to