Re: Inheritance in Python

2017-04-24 Thread Steve D'Aprano
On Mon, 24 Apr 2017 10:10 pm, id23...@gmail.com wrote: > I do not quite understand how inheritance works in Python. [...] > class mainCL(): > def __init__(self): > self.path1 = "/a" > self.path2 = "/b" > > class secondCL(mainCL): > def __init__(newID): > self

Inheritance in Python

2017-04-24 Thread id23...@gmail.com
I do not quite understand how inheritance works in Python. I use python 3.6.1. Let say I have a directory structure /a, /b. These two paths described in main class. The second class describes additional structure in one of the main structures, say on /b and it should look like this: /b/id1 /b/i

Re: Remove multiple inheritance in Python 3000

2008-04-28 Thread Dieter Maurer
Nick Stinemates <[EMAIL PROTECTED]> writes on Thu, 24 Apr 2008 08:26:57 -0700: > On Tue, Apr 22, 2008 at 04:07:01AM -0700, GD wrote: > > Please remove ability to multiple inheritance in Python 3000. I hope your request will not be followed. > > Multiple inheritance is bad fo

Re: Remove multiple inheritance in Python 3000

2008-04-25 Thread sturlamolden
On Apr 25, 2:03 pm, Bjoern Schliessmann wrote: > > That's how the Java designers were thinking as well: If MI is > > allowed, programmers will suddenly get an irresistible urge to use > > MI to write unmaintainable spaghetti code. So let's disallow MI > > for the sake of common good. > > Argument

Re: Remove multiple inheritance in Python 3000

2008-04-25 Thread Bjoern Schliessmann
sturlamolden wrote: > On Apr 22, 1:07 pm, GD <[EMAIL PROTECTED]> wrote: >> Multiple inheritance is bad for design, rarely used and contains >> many problems for usual users. >> >> Every program can be designed only with single inheritance. > > That's how the Java designers were thinking as well:

Re: Remove multiple inheritance in Python 3000

2008-04-24 Thread Steve Holden
sturlamolden wrote: On Apr 22, 1:07 pm, GD <[EMAIL PROTECTED]> wrote: Please remove ability to multiple inheritance in Python 3000. Too late for that, PEPs are closed. Multiple inheritance is bad for design, rarely used and contains many problems for usual users. Every program

Re: Remove multiple inheritance in Python 3000

2008-04-24 Thread sturlamolden
On Apr 22, 1:07 pm, GD <[EMAIL PROTECTED]> wrote: > Please remove ability to multiple inheritance in Python 3000. Too late for that, PEPs are closed. > Multiple inheritance is bad for design, rarely used and contains many > problems for usual users. > > Every program can

Re: Remove multiple inheritance in Python 3000

2008-04-24 Thread Nick Stinemates
On Tue, Apr 22, 2008 at 04:07:01AM -0700, GD wrote: > Please remove ability to multiple inheritance in Python 3000. > > Multiple inheritance is bad for design, rarely used and contains many > problems for usual users. > > Every program can be designed only with single inheri

Re: Remove multiple inheritance in Python 3000

2008-04-22 Thread Diez B. Roggisch
Carl Banks schrieb: On Apr 22, 11:10 am, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: 2. Java interfaces solve a different problem than MI (used properly) does: interfaces are there to make types polymorphic, whereas inheritance's main use is to share behavior. But the *goal* of the polymorphy

Re: Remove multiple inheritance in Python 3000

2008-04-22 Thread Carl Banks
On Apr 22, 11:10 am, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: > > 2. Java interfaces solve a different problem than MI (used properly) > > does: interfaces are there to make types polymorphic, whereas > > inheritance's main use is to share behavior. > > But the *goal* of the polymorphy is main

Re: Remove multiple inheritance in Python 3000

2008-04-22 Thread Bruno Desthuilliers
Carl Banks a écrit : On Apr 22, 10:36 am, George Sakkis <[EMAIL PROTECTED]> wrote: On Apr 22, 10:22 am, Carl Banks <[EMAIL PROTECTED]> wrote: Java (for example) allows a class to share behavior with only one other class, and that *severely* limits the opportunities to minimize redundancy. Not

Re: Remove multiple inheritance in Python 3000

2008-04-22 Thread Diez B. Roggisch
I have a couple issues with this, though I wholeheartedly agree with the sentiment: 1. Java didn't grow interfaces, they were there from the start. I might have expressed myself wrong here - I should have written "needed to introduce interfaces (right from the start)" 2. Java interfaces sol

Re: Remove multiple inheritance in Python 3000

2008-04-22 Thread Carl Banks
On Apr 22, 10:36 am, George Sakkis <[EMAIL PROTECTED]> wrote: > On Apr 22, 10:22 am, Carl Banks <[EMAIL PROTECTED]> wrote: > > > Java (for example) allows a class to share behavior with only one > > other class, and that *severely* limits the opportunities to minimize > > redundancy. > > Not really

Re: Remove multiple inheritance in Python 3000

2008-04-22 Thread George Sakkis
On Apr 22, 10:22 am, Carl Banks <[EMAIL PROTECTED]> wrote: > Java (for example) allows a class to share behavior with only one > other class, and that *severely* limits the opportunities to minimize > redundancy. Not really; composition is usually a better way to share functionality and reduce re

Re: Remove multiple inheritance in Python 3000

2008-04-22 Thread Carl Banks
On Apr 22, 7:30 am, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: > GD schrieb: > > > Please remove ability to multiple inheritance in Python 3000. > > > Multiple inheritance is bad for design, rarely used and contains many > > problems for usual user

Re: Remove multiple inheritance in Python 3000

2008-04-22 Thread Bruno Desthuilliers
GD a écrit : Please remove ability to multiple inheritance in Python 3000. Please dont. Multiple inheritance is bad for design, rarely used and contains many problems for usual users. Don't blame the tool for your unability to use it properly. Every program can be designed only

Re: Remove multiple inheritance in Python 3000

2008-04-22 Thread Cezary Krzyżanowski
Dnia Tue, 22 Apr 2008 04:07:01 -0700, GD napisał(a): > Please remove ability to multiple inheritance in Python 3000. > Please send me 1 mln $. I've always wanted to be rich and furthermore, I've got a lot of plans and ideas how to spend that cash. > I also published t

Re: Remove multiple inheritance in Python 3000

2008-04-22 Thread Stefan Behnel
GD wrote: > Please remove ability to multiple inheritance in Python 3000. > > Multiple inheritance is bad for design, rarely used and contains many > problems for usual users. Ah, one more: "doctor, when I do this, it hurts!" - "then don't do that!&qu

Re: Remove multiple inheritance in Python 3000

2008-04-22 Thread Diez B. Roggisch
GD schrieb: Please remove ability to multiple inheritance in Python 3000. Multiple inheritance is bad for design, rarely used and contains many problems for usual users. Every program can be designed only with single inheritance. Yes, sure. And that's why Java grew interfaces & i

Re: Remove multiple inheritance in Python 3000

2008-04-22 Thread Stefan Behnel
GD wrote: > Please remove ability to multiple inheritance in Python 3000. I'm so happy *that's* a dead parrot, all right. Stefan -- http://mail.python.org/mailman/listinfo/python-list

Remove multiple inheritance in Python 3000

2008-04-22 Thread GD
Please remove ability to multiple inheritance in Python 3000. Multiple inheritance is bad for design, rarely used and contains many problems for usual users. Every program can be designed only with single inheritance. I also published this request at http://bugs.python.org/issue2667 -- http

Re: Problem with operator overloading and inheritance in Python

2006-09-18 Thread Calvin Spealman
do I define new-style classes? > > - Edward > > > Original Message Follows > From: "Calvin Spealman" <[EMAIL PROTECTED]> > Reply-To: [EMAIL PROTECTED] > To: "Edward Waugh" <[EMAIL PROTECTED]> > Subject: Re: Problem with operator over

Re: Problem with operator overloading and inheritance in Python

2006-09-17 Thread Calvin Spealman
On 9/17/06, Edward A. Waugh <[EMAIL PROTECTED]> wrote: > > > > > Consider the following code: > > import sys > > class FirstClass: > def __init__(self, value): > self.data = value > def __add__(self, value): > return FirstClass(self.data + value) > def display(self): >

Problem with operator overloading and inheritance in Python

2006-09-17 Thread Edward A. Waugh
Consider the following code:   import sys   class FirstClass:    def __init__(self, value):    self.data = "">    def __add__(self, value):    return FirstClass(self.data + value)    def display(self):    print self.data   class SecondClass(FirstClass):    def __add__(self,