2 ms·
I've been checking types in Python dynamically for years now. My library, Obiwan https://pypi.python.org/pypi/obiwan/1.0.2 https://pypi.python.org/pypi/obiwan/
by willvarfar 12y ago
I've been checking types in Python dynamically for years now. My library, Obiwan https://pypi.python.org/pypi/obiwan/1.0.2 https://pypi.python.org/pypi/obiwan/1.0.2 uses type annotations, which I think nicer than decorators.
- andybak 12y agoAs the article mentions - the big advantage of decorators is Python 2.x compatibility. (not that I want to start another discussion of THAT topic) EDIT - looks like obiwan will allow decorators as well as annotations. I do prefer the syntax of typedecorator though. It seems less cluttered.
- andreasvc 12y agoIt's a matter of taste. I think the decorator approach looks more bolted-on and ad hoc. I prefer C style declarations over annotations, though, because they have the least amount of noise.
- jbeja 12y agoThis actually looks pretty good.