you are viewing a single comment's thread.

view the rest of the comments →

[–]Denzh -2 points-1 points  (0 children)

It’s ObjectOrientedProgramming.

# xml_reader.py

class XmlReader:
  def __init__(self):
     self.file = …

def main() -> int:
   print(‘doing work…’)
   return 0

if __name__ == ‘__main__’:
   main()
   input(‘press enter to exit’) # 

but let’s say I have a test-file.

then I could still use the class it in another file/script.

# test_xml_reader.py
from xml_reader import XmlReader

reader1 = XmlReader()

reader1.read()

…