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

2018-02-11 Thread Paul Moore
On 11 February 2018 at 12:55, D'Arcy Cain wrote: > 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,

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

2018-02-11 Thread D'Arcy Cain
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

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

2018-02-11 Thread Victor Porton
The following is a real code fragment: ## class PredicateParser(object, metaclass=ABCMeta): """ Parses a given predicate (which may participate in several relationships) of a given RDF node. """ def __init__(self,