S
Stefan Sonnenberg-Carstens
Hi there,
I'm facing some strange things - but maybe only me is strange - anyway...
i wrote the following code:
+++
class T(object):
def __init__(self,name='',port=80):
self.name=name
self.port=port
+++
looks fine - to me.
Now I can do:
['__class__', '__delattr__', '__dict__', '__doc__', '__getattribute__',
'__hash__', '__init__', '__module__', '__new__', '__reduce__',
'__reduce_ex__', '__repr__', '__setattr__', '__str__', '__weakref__',
'name', 'port']
Everything ok.
Now, I do this:
class T(object):
def __init__(self,name='',port=80):
self.name=name
self.port=port
def __getattribute__(self,key):
if key=='somekey':
return None
where
['__class__', '__delattr__', '__dict__', '__doc__', '__getattribute__',
'__hash__', '__init__', '__module__', '__new__', '__reduce__',
'__reduce_ex__', '__repr__', '__setattr__', '__str__', '__weakref__']
is ok, also.
But, then surprise:[]
What the hell is going wrong here ?
I'm running Python 2.4.2 from python.org on Windows XP SP2, all patches
applied.
Thx in advance.
I'm facing some strange things - but maybe only me is strange - anyway...
i wrote the following code:
+++
class T(object):
def __init__(self,name='',port=80):
self.name=name
self.port=port
+++
looks fine - to me.
Now I can do:
['__class__', '__delattr__', '__dict__', '__doc__', '__getattribute__',
'__hash__', '__init__', '__module__', '__new__', '__reduce__',
'__reduce_ex__', '__repr__', '__setattr__', '__str__', '__weakref__',
'name', 'port']
Everything ok.
Now, I do this:
class T(object):
def __init__(self,name='',port=80):
self.name=name
self.port=port
def __getattribute__(self,key):
if key=='somekey':
return None
where
['__class__', '__delattr__', '__dict__', '__doc__', '__getattribute__',
'__hash__', '__init__', '__module__', '__new__', '__reduce__',
'__reduce_ex__', '__repr__', '__setattr__', '__str__', '__weakref__']
is ok, also.
But, then surprise:[]
What the hell is going wrong here ?
I'm running Python 2.4.2 from python.org on Windows XP SP2, all patches
applied.
Thx in advance.