Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 833509
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T04:31:46+00:00 2026-05-15T04:31:46+00:00

I have a bunch of Objects from the same Class in Python. I’ve decided

  • 0

I have a bunch of Objects from the same Class in Python.
I’ve decided to put each object in a different file since it’s
easier to manage them (If I plan to add more objects or edit them individually)

However, I’m not sure how to run through all of them, they are in another Package
So if I look at Netbeans I have TopLevel… and there’s also a Package named Shapes
in Shapes I have Ball.py, Circle.py, Triangle.py (inside the files is a call for a constructor with the details of the specific shape) and they are all from class GraphicalShape
That is configured in GraphicalShape.py in the TopLevel Package.
Now, I have also on my Toplevel Package a file named newpythonproject.py, which would start the
process of calling each shape and doing things with it, how do I run through all of the shapes?
also: Is it a good way to do this?

p.s. never mind the uppercase lowercase stuff…

Just to clarify, I added a picture of the Project Tree
http://i47.tinypic.com/2i1nomw.png

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T04:31:47+00:00Added an answer on May 15, 2026 at 4:31 am

    It seems that you’re misunderstanding the Python jargon. The Python term “object” means an actual run-time instance of a class. As far as I can tell, you have “sub-classes” of the Shape class called ball, circle and triangle. Note that a sub-class is also a class. You are keeping the code for each such sub-class in a separate file, which is fine.

    I think you’re getting mixed up because you’re focusing on the file layout of your project far too early. With Python it is often easier to start with just one file, writing everything you need in that file (functions, classes, etc.). Just get things working first. Later, when you’ve got working code and you just want to split a part of it into another file for organizational reasons, it will be much more obvious (to you!) how this should be done.

    In Python, every class does not have to be defined in its own separate file. You can do this if you like, but it is not compulsory.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 408k
  • Answers 408k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer A field can't be instantiated. A field can only contain… May 15, 2026 at 6:56 am
  • Editorial Team
    Editorial Team added an answer It's not going to be so easy to capture the… May 15, 2026 at 6:56 am
  • Editorial Team
    Editorial Team added an answer No. Classes and entities are two completely different things. They… May 15, 2026 at 6:56 am

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.