On 2017-09-10 23:38, Michel Desmoulin wrote: >> I'm going to put some words in explaining why I don't want to use base >> classes (I don't think it buys you anything). Do you have a reason for >> preferring base classes? > > Not preferring, but having it as an alternative. Mainly for 2 reasons: > > 1 - data classes allow one to type in classes very quickly, let's > harvest the benefit from that. > > Typing a decorator in a shell is much less comfortable than using > inheritance. Same thing about IDE: all current ones have snippet with > auto-switch to the class parents on tab. > > All in all, if you are doing exploratory programming, and thus > disposable code, which data classes are fantastic for, inheritance will > keep you in the flow. > > 2 - it will help sell the data classes > > I train a lot of people to Python each year. I never have to explain > classes to people with any kind of programming background. I _always_ > have to explain decorators. > > People are not used to it, and even kind fear it for quite some time. > > Inheritance however, is familiar, and will not only push people to use > data classes more, but also will let them do less mistakes: they know > the danger of parent ordering, but not the ones of decorators ordering. I also feel inheritance is more intuitive (and easily entered), but missed the reason it wasn't chosen. ;) -Mike
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4