Ah interesting that you mentioned django-stubs. I had good to mediocre
success applying it to my own django apps. It gets the job mostly done
for high level interfaces, but shows rough stub edges as soon as you
have to touch lower interfaces (can only speak for the ORM section in
this regard, which is highly mutating itself).
Type annotations in Python are heavily inspired by Typescript, where
you'd strive for building up you interface types granularily and the
compiler does the rest pulling things together.
I am not sure if Python's type annotations are yet or will ever be
capable to achieve that good enough for most common python paradigm,
seems Python is way too flexible for static type analysis. Typescript
partially solves this by banning/hiding some of JS' flexibility. (Ever
tried to fully type a mutating decorator in Python? Hours of fun ahead,
and you will still end up declaring many Anys effectively disabling
proper type pulling.)
Now back to Django - it makes heavy usage of dynamic python features,
which is poison for any static type deduction. This is also the reason
why IDEs typically fail for more dynamic python code like django, unless
they do a partial runtime inspection (I think IntelliJ tries to do that
to some degree).
So while better typing support is really nice where possible, I'd
suggest to not open this can of worms (yet), but mainly to stick to the
better inline docs idea.
Cheers,
Jörg
--
You received this message because you are subscribed to the Google Groups "Django
developers (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to django-developers+unsubscr...@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-developers/b5d627ce-6460-476b-b90c-a9dec0350669%40netzkolchose.de.