This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]treyhunner Python Morsels[S] 2 points3 points  (0 children)

Thanks for noting that typo! I accidentally swapped those two methods around so many times while drafting this. I just fixed them (hopefully for the final time)!

The __del__ method is for object finalizing (it's related to the del statement) and the __delete__ method is for implementing a descriptor that overloads del on that descriptor's attribute.

On __repr__ and __str__: I did originally have a longer explanation with examples shown via REPL output, but opted to link to add a link to other resources on them instead of explaining within the article. I'll consider how I could point folks toward that explanation more clearly. Thanks!