On Fri, 04 Nov 2005 07:31:46 +0000, Antoon Pardon wrote: >> The model makes sense in my opinion. If you don't like it then there are >> plenty of other languages to choose from that have decided to implement >> things differently. > > And again this argument. Like it or leave it, as if one can't in general > like the language, without being blind for a number of shortcomings. > > It is this kind of recations that make me think a number of people is > blindly devoted to the language to the point that any criticism of > the language becomes intollerable.
There are good usage cases for the current inheritance behaviour. I asked before what usage case or cases you have for your desired behaviour, and you haven't answered. Perhaps you missed the question? Perhaps you haven't had a chance to reply yet? Or perhaps you have no usage case for the behaviour you want. Some things are a matter of taste: should CPython prefer <> or != for not equal? Some things are a matter of objective fact: should CPython use a byte-code compiler and virtual machine, or a 1970s style interpreter that interprets the source code directly? The behaviour you are calling "insane" is partly a matter of taste, but it is mostly a matter of objective fact. I believe that the standard model for inheritance that you call insane is rational because it is useful in far more potential and actual pieces of code than the behaviour you prefer -- and the designers of (almost?) all OO languages seem to agree with me. The standard behaviour makes it easy for code to do the right thing in more cases, without the developer taking any special steps, and in the few cases where it doesn't do the right thing (e.g. when the behaviour you want is for all instances to share state) it is easy to work around. By contrast, the behaviour you want seems to be of very limited usefulness, and it makes it difficult to do the expected thing in almost all cases, and work-arounds are complex and easy to get wrong. The standard behaviour makes it easy for objects to inherit state, and easy for them to over-ride defaults. The behaviour(s) you and Graham want have awkward side-effects: your proposed behaviour would mean that class attributes would mask instance attributes, or vice versa, meaning that the programmer would have to jump through hoops to get common types of behaviour like inheriting state. The behaviour you want would make it too easy to inadvertently have instances share state. Normally we want instances to share behaviour but have unique states -- you would change that. Why? If it is just a matter of taste, you are welcome to your opinion. But you don't say that the standard behaviour is "ugly", you say it is "insane", that is, irrational, and that the behaviour you want is rational. That's an objective claim: please explain what makes your behaviour more rational than the standard behaviour. Is your behaviour more useful? Does it make code easier to write? Does it result in more compact code? What usage cases? Or is it just a subjective judgement on your part that it would be neater? -- Steven. -- http://mail.python.org/mailman/listinfo/python-list