File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1518,18 +1518,18 @@ provide the ``self`` argument.
15181518How can I organize my code to make it easier to change the base class?
15191519----------------------------------------------------------------------
15201520
1521- You could define an alias for the base class, assign the real base class to it
1522- before your class definition, and use the alias throughout your class. Then all
1521+ You could assign the base class to an alias and derive from the alias. Then all
15231522you have to change is the value assigned to the alias. Incidentally, this trick
15241523is also handy if you want to decide dynamically (e.g. depending on availability
15251524of resources) which base class to use. Example::
15261525
1527- BaseAlias = <real base class>
1526+ class Base:
1527+ ...
1528+
1529+ BaseAlias = Base
15281530
15291531 class Derived(BaseAlias):
1530- def meth(self):
1531- BaseAlias.meth(self)
1532- ...
1532+ ...
15331533
15341534
15351535How do I create static class data and static class methods?
You can’t perform that action at this time.
0 commit comments