Re: Python teacher notes, preparing for class...

kirby urner <[email protected]>
Newsgroups gmane.comp.python.education
Message-ID <CAPJgG3Rw7iH1dxQXZuk2TBJUL3x0ND90GFWb4jL8=LFE28NBXw@mail.gmail.com>
> 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

_______________________________________________
Edu-sig mailing list
[email protected]
https://mail.python.org/mailman/listinfo/edu-sig
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.