On 4/03/24 06:30, kirby urner wrote:
On Sat, Mar 2, 2024 at 3:37 PM Wes Turner <wes.tur...@gmail.com <mailto:wes.tur...@gmail.com>> wrote:

    They're dunder methods; double-underscore


Certainly they are and my intro definitely includes this information.

Check out the following Dog class, endowed with two of Python’s “magic methods” also known as: “dunder methods” (with “dunder” being short for “double underline”) or “special methods”.


Please read "Why naming things is hard" (https://hilton.org.uk/blog/why-naming-things-is-hard) - and yes there is any number of similar articles.

The pertinent quotation is "There are only two hard things in Computer Science: cache invalidation and naming things." (Phil Karlton).

When training, the difficulty of choosing names is magnified by the difficulty of choosing examples. Short, understandable, apparent, illustrative, etc...

So, here's a (Socratic) question: have you ever met a computer scientist or programming professional who has had to write code about a dog's stomach, or even the other popular one: a bowl of fruit?

Next Socratic question: could we, or should we, choose more realistic examples (and names)? Yes, high schoolers have little experience of the world and of commerce. So, talking of products and minimum order quantities might be a stretch. However, there are plenty of examples where we can talk about class Person, and either a wallet which we'd like filled, or a list of skills being learned, for example.

The industry has a phrase, to do with using our own software creations: "eating our own dog-food". Ghastly! Maybe? That's about the closest most of us will ever come to programming dogs!

--
Regards =dn
_______________________________________________
Edu-sig mailing list -- edu-sig@python.org
To unsubscribe send an email to edu-sig-le...@python.org
https://mail.python.org/mailman3/lists/edu-sig.python.org/
Member address: arch...@mail-archive.com

Reply via email to