4 ms·
A feature without a use case still unfortunately. There are some in the PEP, but given how little code is Py3-only, no one has written anything notable that I'v
by JulianWasTaken 12y ago
A feature without a use case still unfortunately. There are some in the PEP, but given how little code is Py3-only, no one has written anything notable that I've seen that makes use of these.
- shoo 12y agoi agree with your sentiment but not how you have literally worded it - there are plenty of serious use cases listed in the PEP, eg typechecking by itself is rather useful in other languages, but it is perhaps hard to imagine how useful this feature will be if no existing libraries support it, and there is no common standard defining what any of the annotations could mean. on the other hand, this could be quite useful for large (proprietary?) python codebases where common standards can be defined and rolled out and enforced.
- lukasm 12y agoOne use case: improved JITer performance.
- philliproso 12y agoIt is nicely integrated with type checking in the pycharm IDE. This feature is one of the reasons I would personally like to write pure py3 code.
- michaelmior 12y agoThis would be great to have some subset of Cython[1] become valid Python code so it could be executed as normal Python code. The syntax is different, but function annotations could provide the necessary info. [1] http://cython.org/ http://cython.org/
- kunstmord 12y agoAs mentioned, PyCharm supports this – I found it very useful when writing large amounts of code, saves time when trying to remember what type which variable should be (sometimes it's not evident from the input variable names). And this looks a tad easier to find and understand than the standard docstring variable types description.