[Tutor] Very wierd namespace problem
Amit Sethi
amit.pureenergy at gmail.com
Fri Jul 17 18:04:26 CEST 2009
I am not able to understand this , perhaps it is an aspect of python I
do not understand ....
Now usually I would think that for a class
class a:
... def __init__(self):
... pass
... def __something__(self):
... pass
>>> b=a()
>>> dir(b)
['__doc__', '__init__', '__module__', '__something__']
This should be correct .... so now i can refer one of these functions
from the object of the same class as obj.__something__()
now I have created a class with some functions defined in it but the
thing is that they are named in a completely different manner?????(or
so I think)
<__main__.SmPriceWindow instance at 0x9dd448c>
['_SmPriceWindow__add_columns', '_SmPriceWindow__create_model',
'_SmPriceWindow__review_button_click', '_SmPriceWindow__show_all',
'_SmPriceWindow__url_button_click', '__doc__', '__init__',
'__module__', 'model', 'tree', 'window']
Traceback (most recent call last):
File "smnotebook3.py", line 135, in price_button_pressed
sw.__show_all()
AttributeError: SmPriceWindow instance has no attribute '__show_all'
I have refered to these functions(__add_columns ,__create_model etc
... as self.__add_columns as would be expected in the class itself )
This functionality is unexpected according to me ....
Since I cannot take much of the space here explaining the code I have
pasted here:
http://pastebin.com/mddf7a43
--
A-M-I-T S|S
More information about the Tutor
mailing list