need help with class of arrays which have attibutes

Rob roblytle at ieee.org
Sat Dec 29 00:47:42 CET 2001


Hi,

I'm trying to contruct a class of arrays which have attributes.  This one
respresents a wire[] array which can have x,y,z etc coordinates.  I just
can't figure out how to do it.  Here is what I have so far:  (it uses
Numpy)

from Numeric import *


class arr:
    a=zeros((20))

class b:
        
    x1=0
    y1=0
    z1=0
    x2=0
    y2=0
    lz2=0
    DelX=0.0
    DelY=0.0
    DelZ=0.0

class Cond(arr,b):
    c=arr.b
    def wire(self):
        return c


I have also tried using mapping, but all the array members end up having
the same attributes.  Here was the try at that one:

wire=map(lambda dummy: Cond(), zeros((20)))    In this case, Cond was
originally the "b" array above, by itself.

Thanks for any help you can give!    Rob



More information about the Python-list mailing list