Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #109912
| From | Gregory Ewing <greg.ewing@canterbury.ac.nz> |
|---|---|
| Newsgroups | comp.lang.python |
| Subject | Re: Overriding methods inherited from a superclass with methods from a mixin |
| Date | 2016-06-14 10:28 +1200 |
| Message-ID | <ds8qd5F9fpuU1@mid.individual.net> (permalink) |
| References | <2a1088f1-3bdb-4b21-80b5-8cc640d3bceb@googlegroups.com> <0aabc4bb-8939-45b8-9a70-7023cf434a05@googlegroups.com> |
alanqueiros@gmail.com wrote: > I see that in most cases the order doesn't matter, but still I would > think that since the correct order is from right to left, that should be the > common practice. This order is only "correct" if overriding is what you want. That's not always going to be the case. The mixin might be intended to supply default functionality that can be overridden by the classes it's being mixed into. You can't say that one order is more correct than the other in general. > Basically, I > think of the mixins like plugins of kinds, I'm "adding" functionality to that > "base" class I'm inheriting from. Having them to the left sounds like a > sandwich recipe that tells you to "slice the ham, put mayonnaise on it, and > put it on the bread". To me it's more like adding seasoning to a dish. Normally you put the main ingredient in first, then add the salt and pepper. This is probably the way most people are thinking when they write the mixins after the main base class. -- Greg
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Overriding methods inherited from a superclass with methods from a mixin alanqueiros@gmail.com - 2016-06-12 20:55 -0700
Re: Overriding methods inherited from a superclass with methods from a mixin dieter <dieter@handshake.de> - 2016-06-13 09:13 +0200
Re: Overriding methods inherited from a superclass with methods from a mixin Peter Otten <__peter__@web.de> - 2016-06-13 09:59 +0200
Re: Overriding methods inherited from a superclass with methods from a mixin Ian Kelly <ian.g.kelly@gmail.com> - 2016-06-13 07:17 -0600
Re: Overriding methods inherited from a superclass with methods from a mixin Michael Selik <michael.selik@gmail.com> - 2016-06-13 17:32 +0000
Re: Overriding methods inherited from a superclass with methods from a mixin alanqueiros@gmail.com - 2016-06-13 11:42 -0700
Re: Overriding methods inherited from a superclass with methods from a mixin Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2016-06-14 10:28 +1200
Re: Overriding methods inherited from a superclass with methods from a mixin Michael Selik <michael.selik@gmail.com> - 2016-06-13 22:50 +0000
Re: Overriding methods inherited from a superclass with methods from a mixin alanqueiros@gmail.com - 2016-06-13 16:44 -0700
Re: Overriding methods inherited from a superclass with methods from a mixin Michael Selik <michael.selik@gmail.com> - 2016-06-14 00:13 +0000
csiph-web