I want to make an array (using the built-in array module), to create an array made up of classes. All the objects in the array will be the same class, but I want to be able to append new classes on the end and read the values.
Thanks in advance.
SgtMe
46
Veteran Poster
Featured Poster
Recommended Answers
Jump to PostYou are better off using a list of class instances.
Python arrays, like C arrays are meant to hold only very limited basic types.
Jump to PostPython lists are much simpler to use than arrays. Here is a small example of a list of instances ...
# explore Python class instances # create a list of class instances and process them class Person(object): def __init__(self, name=None, job=None): self.name = name self.job = job …
All 6 Replies
vegaseat
1,735
DaniWeb's Hypocrite
Team Colleague
SgtMe
46
Veteran Poster
Featured Poster
vegaseat
1,735
DaniWeb's Hypocrite
Team Colleague
SgtMe
46
Veteran Poster
Featured Poster
vegaseat
1,735
DaniWeb's Hypocrite
Team Colleague
SgtMe
46
Veteran Poster
Featured Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.