What is Nostr?
Ned Batchelder /
npub1sam…4607
2024-06-06 13:36:11

Ned Batchelder on Nostr: Mostly you shouldn't subclass #Python built-in types. But if you do, dict subclasses ...

Mostly you shouldn't subclass #Python built-in types. But if you do, dict subclasses can define __missing__: it's called when a key is missing. Instead of hiding a dict in a function as a cache, how about hiding a function in a dict!? A Fibonacci dictionary:

Author Public Key
npub1samn5gnz0wzry3kw5l485rwutuk0pqm34lz375j7nh94sdfc0nsspn4607