Type hinting for Python
Type hinting for Python
Posted Dec 24, 2014 23:24 UTC (Wed) by juliank (guest, #45896)Parent article: Type hinting for Python
Posted Dec 25, 2014 0:41 UTC (Thu)
by josh (subscriber, #17465)
[Link] (4 responses)
a: Dict[str, str] = {}
To the best of my knowledge, that wouldn't conflict with anything.
Posted Dec 26, 2014 4:22 UTC (Fri)
by mathstuf (subscriber, #69389)
[Link] (3 responses)
Posted Dec 26, 2014 6:06 UTC (Fri)
by josh (subscriber, #17465)
[Link] (2 responses)
As in, code written to use types would not work with Python pre-3.5?
That really doesn't seem like a problem. Plenty of code currently requires 2.7 and won't work with 2.6, for instance.
Posted Dec 27, 2014 3:28 UTC (Sat)
by mathstuf (subscriber, #69389)
[Link] (1 responses)
Posted Dec 29, 2014 18:14 UTC (Mon)
by iabervon (subscriber, #722)
[Link]
In fact, they're technically breaking compatibility more with the comment mechanism, in that a file with comments that are close to being type declarations but aren't quite right for this system will presumably generate whatever effects type mismatches end up having (mitigated somewhat by the fact that doing anything with the annotations won't happen without a proactive step).
Posted Dec 25, 2014 0:46 UTC (Thu)
by proski (subscriber, #104)
[Link] (3 responses)
Posted Dec 25, 2014 1:07 UTC (Thu)
by marcH (subscriber, #57642)
[Link]
If only humans were the only potential problem. A lot of "meta" development tools (editors, IDEs, etc.) read comments too. Imagine their confusion now.
Code in comments, what an horror. Not familiar enough with Python for this question, but isn't there some concept of "annotations" as a much better solution here?
Posted Dec 25, 2014 8:47 UTC (Thu)
by epa (subscriber, #39769)
[Link] (1 responses)
Posted Jan 2, 2015 0:52 UTC (Fri)
by smitty_one_each (subscriber, #28989)
[Link]
Posted Dec 29, 2014 23:40 UTC (Mon)
by debacle (subscriber, #7114)
[Link]
Type hinting for Python
Type hinting for Python
Type hinting for Python
Type hinting for Python
Type hinting for Python
Type hinting for Python
Code in comments, really?
Type hinting for Python
Type hinting for Python
- stay totally dynamic, and not need any type hinting
- don't create incompatibilities
- allow types in for those keen on the feature
Python is a great tool, and the BDFL will settle on something.
Type hinting for Python