decorator-factory / typing-tips

collection of short articles about Python's gradual typing system

Home Page:https://decorator-factory.github.io/typing-tips/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Feedback

JelleZijlstra opened this issue · comments

This is really good! I read through it all and mostly have feedback around shiny new features you could be using, though obviously those depend on the Python version your audience is using.

  • TypeVar: Does it make sense to focus on using bound= instead? I feel like bounded typevars are generally easier to understand than TypeVars with multiple constraints.
  • Optional could also mention the | None syntax from 3.10, which is more explicit.
  • Instead of NoReturn, 3.11 will probably allow Never instead.
  • The TypedDict example could use typing_extensions.Required/NotRequired instead of the awkward MovieOptional base class.

Hi! Thanks for the feedback

TypeVar: Does it make sense to focus on using bound= instead? I feel like bounded typevars are generally easier to understand than TypeVars with multiple constraints.

I agree, I will change that

re: other points

I think I will stick to 3.9 features for now, to reduce the scope (I think most people aren't using 3.10 yet?)

I also don't want to explain what typing_extensions is in the middle of explaining some other concept. Maybe there will be a separate article for that.