Skip to main content

All Questions

0 votes
1 answer
852 views

Abstract base classes and mix-ins in python

In the python docs, I read this about the ABC (abstract base class) meta class: Use this metaclass to create an ABC. An ABC can be subclassed directly, and then acts as a mix-in class. I don't come ...
henryn's user avatar
  • 119
0 votes
2 answers
1k views

Should parent classes define methods using attributes of child classes?

I need to extend the parent classes of two child classes by adding shared methods to them. Starting with the initial definitions of the child classes: class ChildA(ParentA): pass class ChildB(...
pstatix's user avatar
  • 1,047
0 votes
1 answer
84 views

Classes for integrating both BitBucket and GitHub into our site (an inheritance and composition question)

I am writing a system of callbacks for BitBucket and GitHub which should modify our site on certain events in BitBucket or GitHub. It is reasonable to make a base class like GitIntegration to handle ...
porton's user avatar
  • 791
54 votes
5 answers
40k views

Are Python mixins an anti-pattern?

I'm fully aware that pylint and other static analysis tools are not all-knowing, and sometimes their advice must be disobeyed. (This applies for various classes of messages, not just conventions.) If ...
cat's user avatar
  • 734