[Edu-sig] Python teacher notes, preparing for class...

kirby urner kirby.urner at gmail.com
Wed Aug 29 19:05:29 EDT 2018


> This is the most unified reference on __dunder_methods__ ('magic methods')
> I've ever seen:
> "A Guide to Python's Magic Methods"
> https://rszalski.github.io/magicmethods/
>
>

I'd not seen that Guide to magic methods before.  Thanks!

>From perusing it, I was reminded of a topic Trey Hunner discussed in one of
his recorded live chats:

When defining how your class implements ordering, e.g. using __lt__,
__gt__, __eg__ and so on, it's sufficient to define just two of these, then
decorate with @total_ordering to have Python fill in the blanks.

I tested that out in my OrderingPolys.ipynb (Jupyter Notebook).  Great!
I'm keeping the demo.

http://localhost:8889/notebooks/Documents/SAISOFT/SAISOFT/OrderingPolys.ipynb

This Notebook now includes a link back to Rafe's docs.  I'll be sure my
California students know about this update.  We meet again tonight.

I use geometry, polyhedrons in particular, as an excuse to introduce OOP
from yet another angle (I take a multi-faceted approach).

Kirby
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/edu-sig/attachments/20180829/542b8553/attachment.html>


More information about the Edu-sig mailing list