Re:A primer on Python decorators
by SpiderX on Friday April 20, 2012 @03:35PM
(#3869431)
"if in" is not the preferred way to check for the presence of a key in a dict. You should use setdefault. The thing is, you aren't searching for a key in a dict only. You're memoizing. And try/except is the most efficient way to do that. This article isn't teaching you how to program, it's teaching decorators.
[ Parent
| on HN ]
There are no comments on this comment yet.