Re: Flagging classes as not intended for direct initialization

2015-02-16 Thread Chris Angelico
On Tue, Feb 17, 2015 at 2:00 AM, Mario Figueiredo wrote: > On Tue, 17 Feb 2015 01:11:01 +1100, Chris Angelico > wrote: > >>So what you have here is not "super() is weird", but "multiple >>inheritance is messy, and this is how Python handles it". >> > > I'd say the diamond pattern is messy. MI is

Re: Flagging classes as not intended for direct initialization

2015-02-16 Thread Mario Figueiredo
On Tue, 17 Feb 2015 01:11:01 +1100, Chris Angelico wrote: >So what you have here is not "super() is weird", but "multiple >inheritance is messy, and this is how Python handles it". > I'd say the diamond pattern is messy. MI is otherwise a pretty peaceful kid without it. I don't find the C3 line

Re: Flagging classes as not intended for direct initialization

2015-02-16 Thread Chris Angelico
On Tue, Feb 17, 2015 at 12:47 AM, Mario Figueiredo wrote: > The following is quoted from Learning Python, 5th Edition: > >>Java programmers may especially be interested to know that Python also has a >>super >>built-in function that allows calling back to a superclass’s methods more >>genericall

Re: Flagging classes as not intended for direct initialization

2015-02-16 Thread Mario Figueiredo
On Mon, 16 Feb 2015 08:14:00 -0500, Roy Smith wrote: >In article , > Mario Figueiredo wrote: > >> It's not been an easy ride trying to decide whether or not to use super. >> I started learning python from a Mark Lutz book that advised me against >> it. > >I'm curious, what were the arguments

Re: Flagging classes as not intended for direct initialization

2015-02-16 Thread Roy Smith
In article , Mario Figueiredo wrote: > It's not been an easy ride trying to decide whether or not to use super. > I started learning python from a Mark Lutz book that advised me against > it. I'm curious, what were the arguments against it? -- https://mail.python.org/mailman/listinfo/python

Re: Flagging classes as not intended for direct initialization

2015-02-16 Thread Ian Kelly
On Mon, Feb 16, 2015 at 3:55 AM, Mario Figueiredo wrote: > In article <54e14cfe$0$12997$c3e8da3$54964...@news.astraweb.com>, > steve+comp.lang.pyt...@pearwood.info says... >> Unless you have good reason not to, you should use super rather than >> directly call the superclass. >> >> https://rhettin

Re: Flagging classes as not intended for direct initialization

2015-02-16 Thread Mario Figueiredo
In article <54e14cfe$0$12997$c3e8da3$54964...@news.astraweb.com>, steve+comp.lang.pyt...@pearwood.info says... > > If this is a type error, why aren't you using TypeError? Or at least > inheriting from TypeError? > Yeah. It's not that I'm gaining much from that abstraction. It's not even an ab

Re: Flagging classes as not intended for direct initialization

2015-02-15 Thread Peter Otten
Mario Figueiredo wrote: > Hello everyone, > > [Python 3.X] > > I have the following factory model for the initialization of a class > tree (code abbreviated for simplicity). > > # item.py > class BadItemType(Exception): > pass > > class Item: > def __init__(self, _data): > > class Con

Re: Flagging classes as not intended for direct initialization

2015-02-15 Thread Steven D'Aprano
Mario Figueiredo wrote: > Hello everyone, > > [Python 3.X] > > I have the following factory model for the initialization of a class > tree (code abbreviated for simplicity). > > # item.py > class BadItemType(Exception): > pass If this is a type error, why aren't you using TypeError? Or at

Flagging classes as not intended for direct initialization

2015-02-15 Thread Mario Figueiredo
Hello everyone, [Python 3.X] I have the following factory model for the initialization of a class tree (code abbreviated for simplicity). # item.py class BadItemType(Exception): pass class Item: def __init__(self, _data): class Container(Item): def __init__(self, _data): I