Adding support for PEP526: variable annotations
Hi, it'd be great if we could get variable annotations in PyPy even before PyPy 3.6 comes out. There's predecent with f-strings. I'm asking because it's a major chore to strip out variable annotations while trying out PyPy, (mostly) everything else can be worked around with imports etc. Thanks for your efforts on PyPy ;) Tin
Hi Tin, On 7 June 2018 at 18:38, Tin Tvrtković <tinchester@gmail.com> wrote:
it'd be great if we could get variable annotations in PyPy even before PyPy 3.6 comes out. There's predecent with f-strings. I'm asking because it's a major chore to strip out variable annotations while trying out PyPy, (mostly) everything else can be worked around with imports etc.
Look at tools that do the stripping automatically. Maybe https://pypi.org/project/strip-hints/ with the option --only-assigns-and-defs ? A bientôt, Armin.
Hi Armin, thanks for the tip. I actually need the annotations in runtime to do serialization / deserialization (using two my libraries, cattrs and another one for which I haven't written the docs yet). I use annotated attrs classes. Usually I just move the type annotations from the annotation syntax to "attr.ib(type=...)" using sed so it's not that big of a deal, but it's still a chore. Cheers :) On Fri, Jun 8, 2018 at 12:23 AM Armin Rigo <armin.rigo@gmail.com> wrote:
Hi Tin,
On 7 June 2018 at 18:38, Tin Tvrtković <tinchester@gmail.com> wrote:
it'd be great if we could get variable annotations in PyPy even before PyPy 3.6 comes out. There's predecent with f-strings. I'm asking because it's a major chore to strip out variable annotations while trying out PyPy, (mostly) everything else can be worked around with imports etc.
Look at tools that do the stripping automatically. Maybe https://pypi.org/project/strip-hints/ with the option --only-assigns-and-defs ?
A bientôt,
Armin.
participants (2)
-
Armin Rigo -
Tin Tvrtković