4 ms·
I love curiosity sparking posts like this. >>key in dct is much better than key in dct.keys() Of course, that got me curios to find out if there is a magic
by pcote 14y ago
I love curiosity sparking posts like this.
>>key in dct
is much better than
key in dct.keys()
Of course, that got me curios to find out if there is a magic method out there that takes advantage of keyword "in". Turns out __contains__ does that.
Always exciting to stumble upon new stuff in my favorite language.