News for hackers. Stuff that matters.
Re:Why Today's Python Developers Are Embracing Type Hints by dandiep on Saturday September 27, 2025 @08:36PM (#45400689)
Isn’t this solved in 3.14/PEP-649?
Re:Why Today's Python Developers Are Embracing Type Hints by aw1621107 on Saturday September 27, 2025 @08:58PM (#45400822)
I want to say it (or something similar at least) was originally addressed by from __future__ import annotations back in Python 3.7/3.8 or thereabouts? I definitely remember having to use stringified types a while back but I haven't needed to for quite a while now.
Re:Why Today's Python Developers Are Embracing Type Hints by sgarland on Saturday September 27, 2025 @10:18PM (#45401201)
Yes, annotations allows you to use the declared types as they are, no strings.
Re:Why Today's Python Developers Are Embracing Type Hints by FreakLegion on Saturday September 27, 2025 @11:23PM (#45401495)
It turns them into thunks (formerly strings) automatically, an important detail if you're inspecting annotations at run time because the performance hit of resolving the actual type can be significant.
Re:Why Today's Python Developers Are Embracing Type Hints by sgarland on Sunday September 28, 2025 @10:29AM (#45404583)
TIL, thanks! It looks like 3.14 is also changing it so that all evaluations are lazy.
Re:Why Today's Python Developers Are Embracing Type Hints by analog31 on Saturday September 27, 2025 @08:45PM (#45400741)
At last, Pi-thon.