What is more Pythonic: subclass or adding functionality to base class?

D'Arcy Cain darcy at VybeNetworks.com
Sun Feb 11 07:55:04 EST 2018


On 02/11/18 06:30, Victor Porton wrote:
> What is more pythonic?
> 
> 1. Create its subclass PredicateParserWithError and add the additional field 
> on_error to this class.
> 
> 2. Add on_error field to the base class, setting it to None by default, if 
> the class's user does not need this field.

Personally I would go with #1.  It just seems cleaner.  Not sure what
the Python gods would do.

-- 
D'Arcy J.M. Cain
Vybe Networks Inc.
http://www.VybeNetworks.com/
IM:darcy at Vex.Net VoIP: sip:darcy at VybeNetworks.com



More information about the Python-list mailing list