REPOST: need help with class of arrays which have attibutes

Rob roblytle at ieee.org
Fri Dec 28 18:47:42 EST 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

========= WAS CANCELLED BY =======:
Path: news.sol.net!spool0-nwblwi.newsops.execpc.com!newsfeeds.sol.net!news-out.visi.com!hermes.visi.com!out.nntp.be!propagator-SanJose!in.nntp.be!news-in-sanjose!news-xfer.nuri.net!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r
From: "Rob" <roblytle at ieee.org>
Newsgroups: comp.lang.python
Subject: cmsg cancel <pan.2001.12.28.15.45.35.83.2001 at ieee.org>
Control: cancel <pan.2001.12.28.15.45.35.83.2001 at ieee.org>
Date: Mon, 31 Dec 2001 03:36:03 GMT
Organization: A poorly-installed InterNetNews site
Lines: 2
Message-ID: <cancel.pan.2001.12.28.15.45.35.83.2001 at ieee.org>
NNTP-Posting-Host: 211.57.49.2
X-Trace: news2.kornet.net 1009774977 27193 211.57.49.2 (31 Dec 2001 05:02:57 GMT)
X-Complaints-To: usenet at news2.kornet.net
NNTP-Posting-Date: Mon, 31 Dec 2001 05:02:57 +0000 (UTC)
X-No-Archive: yes
X-Unac4ncel: yes
X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999)

This message was cancelled from within Mozilla.



More information about the Python-list mailing list