On 6/5/2016 2:55 AM, Mark Summerfield wrote:
Sometimes I want to spread a class over multiple files.
My experience with trying to work with two do-all classes in idlelib has engendered a dislike for such. It is hard to find things in a kitchen-sink class. To switch IDLE from being a multi-window application to having multiple panes in a single window, both must be refactored.
My primary use case is when I create a "Model" class to reflect an entire SQL database. I want a model instance to provide a single point of access to the database, but the database has many tables each requiring its own methods since they differ in their structure, purpose, validation needs, etc.
I would consider a master database ('Model') class, a base table class, and a subclass class for each table or group of similar tables.
A secondary use case is when I create "MainWindow" classes in GUI programming and have lots of methods to reflect all the actions (e.g., menu options and toolbar actions, plus interaction with the main widget(s)).
With tk and tkinter, at least, implementation functions do not have to be in the same file as the menu or toolbar definitions.
-- Terry Jan Reedy -- https://mail.python.org/mailman/listinfo/python-list