OLD Class Inheritance Concept Docs
See original GitHub issueThis issue describes how to implement the class-inheritance
concept docs.
Getting started
Please please please read the docs before starting. Posting PRs without reading these docs will be a lot more frustrating for you during the review cycle, and exhaust Exercism’s maintainers’ time. So, before diving into the implementation, please read up on the following documents:
- Contributing to Exercism | Exercism and GitHub | - Contributor Pull Request Guide
- What are those Weird Task Tags about?
- Building Language Tracks: An Overview
- What are Concepts?
- Concept Specifications
- Exercism Formatting and Style Guide
- Exercism Markdown Specification
- Reputation
Goal
This concept is meant to teach an understanding/use of class-inheritance
in Python.
Learning objectives
- more fully understand the uses (and possible abuses) of
classes
in Python - understanding and use of
single inheritance
in Python - understanding and use of
multiple inheritance
in Python- the diamond inheritance problem
- Pythons MRO (method resolution order)
- pros and cos of
mixins
() to isolatemultiple inheritance
issues
- when and when not to use
__super__()
to call a parentclass
constructor
Out of scope
class-composition
as an explicit topic (it is ok to use limited composition as needed in example code)dataclasses
decorators
outside of@property
,@staticmethod
, and@classmethod
(the student should already be exposed to these in the prerequisite exercise)generators
coroutines
descriptors
(these will get their own exercise)- using a
class
as a decorator - performance considerations
Concepts
classes
inheritance
inOOP
single inheritance
multiple inheritance
minxins
__super__()
Prerequisites
These are the concepts/concept exercises the student needs to complete/understand before solving the concept exercise that these concept documents support.
basics
booleans
classes
class-customization
comparisons
decorators
dicts
functions
higher-order-functions
iteration
lists
numbers
sequences
sets
strings
tuples
Resources to refer to
- classes (Python tutorial)
- Real Python: Object-Oriented Programming in Python 3
- Real Python: Inheritance and Composition: A Python OOP Guide
- Towards DataScience: Understand Inheritance in Python – (this is not a good resource for hints or links, since it requires an account signup)
- Multiple Inheritance in Python
- Multiple Inheritance is Hard (Ned Batchelder)
- Python.org: MRO in Python 2.3+
- Dig into Python super() and MRO
- Multiple inheritance and mixin classes in Python
- Making Python classes more modular using mixins
- Write composable, reusable Python classes using Mixinsl)
- Mixins in Python and Ruby Compared
- Python Data Model - Python Docs
-
links.json
For more information, see concept links file
- The same resources listed in this issue can be used as a starting point for the
concepts/links.json
file, if it doesn’t already exist. - If there are particularly good/interesting information sources for this concept that extend or supplement the concept exercise material & the resources already listed – please add them to the
links.json
document.
- The same resources listed in this issue can be used as a starting point for the
Concept Description
Please see the following for more details on these files: concepts
-
Concept
about.md
For more information, see Concept
about.md
- This file provides information about this concept for a student who has completed the corresponding concept exercise. It is intended as a reference for continued learning.
-
Concept
introduction.md
For more information, see Concept
introduction.md
- This can also be a summary/paraphrase of the document listed above, and will provide a brief introduction of the concept for a student who has not yet completed the concept exercise. It should contain a good summation of the concept, but not go into lots of detail.
Implementation Notes
- Example code should only use syntax & concepts introduced within these docs or one of the prerequisite concept exercises or documents. Please do not use comprehensions, generator expressions, or other syntax not previously covered. Please also follow PEP8 guidelines.
- Our markdown and JSON files are checked against prettier . We recommend setting prettier up locally and running it prior to submitting your PR to avoid any CI errors.
Help
If you have any questions while implementing the exercise, please post the questions as comments in this issue, or contact one of the maintainers on our Slack channel.
Issue Analytics
- State:
- Created 2 years ago
- Comments:7 (7 by maintainers)
Top GitHub Comments
Once you commented, I could assign. So now you are assigned. 😉
Closing, as the PR for this has been optimistically merged. Further changes and improvements will be tracked under an improvement issue. Many thanks for your work on this, @girijakar!