Discussion about this post

User's avatar
Wyrd Smythe's avatar

The dict (and set) classes are a favorite part of Python. I subclass dict a lot to create self-loading dictionaries and whatnot. Very useful class!

I suppose it isn't an obvious call to the dict constructor, but there is a dict comprehension:

hex_chars = {cx: chr(cx) for cx in range(65, 71)}

Comprehensions being one of the coolest things about Python!

Expand full comment
Slack System's avatar

When using `dict()` to copy a dictionary is it a shallow copy or a deep copy?

Expand full comment
2 more comments...

No posts