Re: Spreading a class over multiple files

2016-06-05 Thread Terry Reedy
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-w

Re: Spreading a class over multiple files

2016-06-05 Thread Steven D'Aprano
On Sun, 5 Jun 2016 06:14 pm, Mark Summerfield wrote: > You're quite right! For some reason I have a blind-spot about mixins, but > they are the perfect solution. Thanks:-) They really aren't :-) Just yesterday on an unrelated thread I linked to a long discussion about multiple inheritance, mixin

Re: Spreading a class over multiple files

2016-06-05 Thread Mark Summerfield
You're quite right! For some reason I have a blind-spot about mixins, but they are the perfect solution. Thanks:-) -- https://mail.python.org/mailman/listinfo/python-list

Re: Spreading a class over multiple files

2016-06-05 Thread Peter Otten
Mark Summerfield wrote: > Sometimes I want to spread a class over multiple files. > > 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 r

Re: Spreading a class over multiple files

2016-06-05 Thread Gary Herron
On 06/04/2016 11:55 PM, Mark Summerfield wrote: Sometimes I want to spread a class over multiple files. There’s and easy way to do this in Python using what's called a Mixin class and (multiple) inheritance: (See https://en.wikipedia.org/wiki/Mixin for more information.) In one file, say e

Spreading a class over multiple files

2016-06-05 Thread Mark Summerfield
Sometimes I want to spread a class over multiple files. 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