6

I'm working on framework for testing some command line utilities. I want to create some classes to hold the different types of information more easily.

Python is fairly new to me so I'm not sure how you would handle this. Do you keep all your classes in one file with your main script or can you separate them into their own files and use them in your main script.

What is the paradigm for how you create multiple classes and use them in a single script?

Duplicate of How many python classes should I put in one file

Community
  • 1
  • 1
crackity_jones
  • 1,077
  • 2
  • 13
  • 16
  • Duplicate. http://stackoverflow.com/questions/106896/how-many-python-classes-should-i-put-in-one-file – S.Lott Nov 19 '08 at 17:40
  • I'm closing this as a duplicate. I realize it's not exactly a dup, but you should find your answer in that one. – Paul Tomblin Nov 19 '08 at 17:56

3 Answers3

3

An answer from the duplicate question in the comments seems to answer my question. My understanding now is that you can add multiple classes to a separate file which would then be referred to as a module. Then you can import that module to use your classes.

Community
  • 1
  • 1
crackity_jones
  • 1,077
  • 2
  • 13
  • 16
2

"What is the paradigm for how you create multiple classes and use them in a single script?"

Are you asking about the import statement?

S.Lott
  • 384,516
  • 81
  • 508
  • 779
0

I spread functionality out into separate files as it makes sense, using a modular approach.

Joe Skora
  • 14,735
  • 5
  • 36
  • 39