Inherit from array
TG
girodt at gmail.com
Wed Apr 26 10:14:14 EDT 2006
Obviously, there is something I didn't catch in python's inheritance.
from array import array
class Vector(array):
def __init__(self,size):
print self.typecode
array.__init__(self,'f')
>>> v = Vector('c')
c
Here, it says the typecode is 'c' - I thought such an information was
initalized during the array.__init__(self,'f') but obviously I was
wrong.
Maybe the typecode is defined before, during the call to __new__ method
... But here i'm getting lost.
More information about the Python-list
mailing list