Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #109522
| From | Terry Reedy <tjreedy@udel.edu> |
|---|---|
| Newsgroups | comp.lang.python |
| Subject | Re: Spreading a class over multiple files |
| Date | 2016-06-05 13:59 -0400 |
| Message-ID | <mailman.14.1465149579.2306.python-list@python.org> (permalink) |
| References | <f8f1cc30-3274-4274-9e28-815b32b4e27c@googlegroups.com> <nj1pa0$acu$1@ger.gmane.org> |
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
Back to comp.lang.python | Previous | Next — Previous in thread | Find similar | Unroll thread
Spreading a class over multiple files Mark Summerfield <list@qtrac.plus.com> - 2016-06-04 23:55 -0700
Re: Spreading a class over multiple files Gary Herron <gherron@digipen.edu> - 2016-06-05 00:18 -0700
Re: Spreading a class over multiple files Mark Summerfield <list@qtrac.plus.com> - 2016-06-05 01:14 -0700
Re: Spreading a class over multiple files Steven D'Aprano <steve@pearwood.info> - 2016-06-05 20:57 +1000
Re: Spreading a class over multiple files Peter Otten <__peter__@web.de> - 2016-06-05 09:40 +0200
Re: Spreading a class over multiple files Terry Reedy <tjreedy@udel.edu> - 2016-06-05 13:59 -0400
csiph-web