Skip to content

do typing tools give the Python @property decorator a magic pass on no-redef? #1102

Answered by Akuli
zzzeek asked this question in Q&A
Discussion options

You must be logged in to vote
  1. Currently @property is hard-coded in the tools. It's unfortunate and creates several different kinds of issues for custom property classes and property-like classes. There have been attempts to reduce the special-casing, such as python/typeshed#5987.
  2. It's perfectly fine to define your own property! It's well documented in Python docs and type checkers support it too. Apart from redefinition, only the built-in @property is problematic, and making your own to replace it is fine.
  3. The no-redef warnings could be improved IMO. I think a better behavior would be to not complain when the second definition of a method bar is decorated with @bar.something, without checking whether the first defini…

Replies: 2 comments 10 replies

Comment options

You must be logged in to vote
1 reply
@zzzeek
Comment options

Answer selected by zzzeek
Comment options

You must be logged in to vote
9 replies
@zzzeek
Comment options

@AlexWaygood
Comment options

@zzzeek
Comment options

@jace
Comment options

@jace
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
6 participants