Hacker News new | past | comments | ask | show | jobs | submit login
[flagged]
aalireza on Nov 13, 2016 | hide | past | favorite



Like many similar articles, it seems to be missing the very important `next`. I understand it didn't actually gain underscores until Python 3, but it's still been part of one of the most important protocols in Python for many years (the iterator protocol).

Discussion of similar article: https://news.ycombinator.com/item?id=6886411

Direct link to the article from that discussion (original no longer available): https://github.com/RafeKettler/magicmethods/blob/master/magi...


Keep in mind this was written 8 years ago and last updated 4 years ago.


The Python documentation is generally quite nice, but the article claims this information is missing or hard to find.

What would it take to get this information into the official python documentation and organized in an appropriate manner there?

There are so many tutorials and reference guides out there for any given language and they suffer from many deficiencies. They are often out of date, incorrect, unclear, or just plain wrong. But an article from 8 years ago has a good chance of being a top Google result. The minsinformation spreads. If the work was instead built into the official project documentation, it can be easily tracked and updated as the language/project evolves.


> What would it take to get this information into the official python documentation and organized in an appropriate manner there?

It's already there:

https://docs.python.org/3/reference/datamodel.html#special-m...


> Updated over 4 years ago (07 Apr 2012 at 04:55 AM)

Sigh. I got bit by the same thing I was lamenting in my earlier post.


Ja I was coming here to say this: the Python docs are really good on this, and why anyone would read or write something else is beyond me.


The only problem I've had with the official Python documentation is that it tends to segregate dunder methods by purpose: "how to impersonate a collection" documentation over here, "how to control instance creation" over there, "how to control method and attribute resolution" somewhere else. For intermediate-to-advanced Pythonistas it's good to have a rough idea of all the extension points Python offers, but the official docs already have a "_" page in the index, which lets you browse the list and click on interesting-looking names:

https://docs.python.org/3/genindex-_.html


If you see the comments at the bottom, they highlight that the article is wrong on some of the instantiation-related magic methods.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: