469,360 Members | 1,799 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,360 developers. It's quick & easy.

Numeric array of objects

You create a 1-D Numeric array of n floats with

x = zeros(n,Float)

How do you create a Numeric array of n instances of class 'xy', where
for example xy is defined as follows:

class xy:
def __init__(self,x=0.0,y=0.0):
self.x = x
self.y = y

I want the elements of the array to be initialized to the default
value of xy, (0.0,0.0). I have read the Martelli's explanation on p309
of the book "Python in a Nutshell", but I still don't get it.
Jul 18 '05 #1
0 934

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by Phil | last post: by
1 post views Thread by Philippe Grosse | last post: by
reply views Thread by Travis Oliphant | last post: by
6 posts views Thread by Gaubitzer Erwin | last post: by
3 posts views Thread by success_ny | last post: by
7 posts views Thread by Sheldon | last post: by
2 posts views Thread by John Ladasky | last post: by
1 post views Thread by CARIGAR | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.