Seeking advice from seasoned Python programmer
|
10-19-2017, 06:53 PM
(This post was last modified: 10-19-2017 08:01 PM by Namir.)
Post: #1
|
|||
|
|||
Seeking advice from seasoned Python programmer
Hi,
I am learning to program in Python (and also in numpy, scipy, etc.). I would like to learn how to work with arrays of structures in Python. The structure I have in mind has the following fields: 1) An array of float numbers 2) A scalar float value. 3) A scalar float value. I have tried to use a Python class to define the above structure, and then build an array of class instances (call the array swam). However when I use something like swarm[i].position[k] (where position is the first field which is an array) Python complains of to many indices. I have taken care of creating the first field as a numpy array before I attempt to access it. I have searched the Internet and found examples of creating arrays of classes (used to define structures) that contain data members (i.e. fields of structures) that are scalar only!! Any help is appreciated. I can even send you the listing. Thanks! Namir |
|||
« Next Oldest | Next Newest »
|
Messages In This Thread |
Seeking advice from seasoned Python programmer - Namir - 10-19-2017 06:53 PM
RE: Seeking advice from seasoned Python programmer - emece67 - 10-19-2017, 10:29 PM
RE: Seeking advice from seasoned Python programmer - Namir - 10-20-2017, 02:29 AM
RE: Seeking advice from seasoned Python programmer - emece67 - 10-20-2017, 07:56 AM
RE: Seeking advice from seasoned Python programmer - Namir - 10-20-2017, 10:35 AM
RE: Seeking advice from seasoned Python programmer - pier4r - 10-20-2017, 08:08 AM
RE: Seeking advice from seasoned Python programmer - emece67 - 10-20-2017, 05:29 PM
|
User(s) browsing this thread: 1 Guest(s)