#36978: Should django evaluate typing annotations at all?
-------------------------------------+-------------------------------------
Reporter: 93578237 | Owner: (none)
Type: Uncategorized | Status: closed
Component: Core (Other) | Version: 5.2
Severity: Normal | Resolution: invalid
Keywords: typing, inspect, | Triage Stage:
deferred annotations | Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Comment (by Jacob Walls):
Good question. Sorry, I wasn't trying to hide details, I just needed to
recall what I benched. I benched the case where the annotations are
available (e.g. not guarded under `TYPE_CHECKING`, which is IMO more
likely):
{{{#!py
In [13]: class Imported:
...: ...
...:
In [14]: def foo(a: Imported, b: Imported, c: Imported): ...
In [15]: %timeit signature(foo, annotation_format=Format.FORWARDREF)
4.52 μs ± 177 ns per loop (mean ± std. dev. of 7 runs, 100,000 loops each)
In [16]: %timeit signature(foo, annotation_format=Format.STRING)
7.59 μs ± 37.3 ns per loop (mean ± std. dev. of 7 runs, 100,000 loops
each)
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/36978#comment:3>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion visit
https://groups.google.com/d/msgid/django-updates/0107019cd322ef76-989aa5b0-6704-41ea-a07b-d61ec7a61ea7-000000%40eu-central-1.amazonses.com.