Descriptor type hinting

J

Joseph L. Casale

How does one satisfy a lint/type checker with the return value of a class method decorated
with a descriptor? It returns a dict, and I want the type hinting to suggest this versus the
str|unknown its defaults to.

Thanks,
jlc
 
S

Steven D'Aprano

How does one satisfy a lint/type checker with the return value of a
class method decorated with a descriptor?

Surely the answer will depend on the linter you are using. Care to tell
us, or shall we guess?
 
J

Joseph L. Casale

Surely the answer will depend on the linter you are using. Care to tell
us, or shall we guess?

Hey Steven,
I am using PyCharm, I have to admit I feel silly on this one. I had a buried assignment
that overrode the inferred type. It wasn't until a fresh set of eyes confirmed something
was awry and we looked... Add one to the fail list for me.

Thanks for taking the time to respond,
jlc
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,904
Latest member
HealthyVisionsCBDPrice

Latest Threads

Top