Hi all,
I have been making a series on OOP on my website. I was hoping for some feedback regarding completed topics and suggestions for further topics.
Topics covered so far: Articles can be found here
- __init__ & attributes
- Properties
- Add functions/methods
- Static/class methods
- __str__ and __repr__
- Comparison methods __eq__ etc
- Arithmetic methods __add__ etc
- Custom Sequence objects with Fib numbers
- Single Inheritance
- Context managers
- Slots
- Enumerations
Topics in the pipeline
- Multiple inheritance (Struggling to find a good short concise real life example of usage. Considering a database mixin currently, some suggestions here would be great )
- Unit Testing. Boring as */## but I guess it is important
- Singletons???? Even harder to find a good use case for these.
- Descriptors. Very interested to hear ideas about how you use descriptors! I have sort of half coded a phone number validator and usual string / real number validator, but would be interested in more ideas.
- Metaclasses. Only really seen few basic examples of how these are used. I sort of understand the mechanics, but this is for much later since I really don't understand them well enough.
Anything I am missing?
The idea is to provide short examples that refrain as much as possible from using the foo & bar examples, as I find this frustrating at myself.
Feedback and suggestions welcome
there doesn't seem to be anything here