I create these classes:
class T(object):
def __new__(self):
self.a = 1
class X(T):
def __init__(self):
self.a = 4
class Y:
def __init__(self):
self.a = 4
class Z(object):
def __init__(self):
self.a = 4
.... and these instances:
t = T()
x = X()
y = Y()
z = Z()
and I want to examine the 'a' attributes.
1>>print T.a
4>>print y.a
4>>print z.a
So far, it's as I expect, but:
Traceback (most recent call last):>>print x.a
File "<stdin>", line 1, in <module>
AttributeError: 'NoneType' object has no attribute 'a'
Traceback (most recent call last):>>print t.a
File "<stdin>", line 1, in <module>
AttributeError: 'NoneType' object has no attribute 'a'
So what the heck is 'T'? It seems that I can't instantiate it or
derive from it, so I guess it isn't a proper class. But it's
something; it has an attribute. What is it? How would it be used
(or, I guess, how should the __new__() method be used)? Any hints?
--
rzed