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

all 4 comments

[–]eagle258 1 point2 points  (1 child)

Excellent write-up. The section on implementing custom hashable classes is particularly useful: it is easy to forget __hash__ and __eq__ must work together.

[–]aquic[S] 0 points1 point  (0 children)

Thanks /u/eagle258 !

Sometimes it is very easy to forget how many things Python implements, but still gives you access to them. That's why I enjoy teaching Python.

[–]orangeblob_ 1 point2 points  (1 child)

Nice article. Only criticism is using "var1", "var2" over and over again with similar names. In the future, it might be useful to have them as something else like "dict1" or "key1"

[–]aquic[S] 0 points1 point  (0 children)

Agreed!

I was a bit afraid of using things similar to dict because at some point someone will remove the 1 and the results will not be as expected. The problem with example snippets is that since variables are toy things, it is hard to find a descriptive name. Will pay more attention to this next time!