Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #67173 > unrolled thread

Descriptor type hinting

Started by"Joseph L. Casale" <jcasale@activenetwerx.com>
First post2014-02-27 22:21 +0000
Last post2014-02-28 02:16 +0000
Articles 3 — 2 participants

Back to article view | Back to comp.lang.python


Contents

  Descriptor type hinting "Joseph L. Casale" <jcasale@activenetwerx.com> - 2014-02-27 22:21 +0000
    Re: Descriptor type hinting Steven D'Aprano <steve@pearwood.info> - 2014-02-28 02:05 +0000
      RE: Descriptor type hinting "Joseph L. Casale" <jcasale@activenetwerx.com> - 2014-02-28 02:16 +0000

#67173 — Descriptor type hinting

From"Joseph L. Casale" <jcasale@activenetwerx.com>
Date2014-02-27 22:21 +0000
SubjectDescriptor type hinting
Message-ID<mailman.7447.1393539762.18130.python-list@python.org>
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

[toc] | [next] | [standalone]


#67183

FromSteven D'Aprano <steve@pearwood.info>
Date2014-02-28 02:05 +0000
Message-ID<530feef0$0$11113$c3e8da3@news.astraweb.com>
In reply to#67173
On Thu, 27 Feb 2014 22:21:31 +0000, Joseph L. Casale wrote:

> 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?



-- 
Steven

[toc] | [prev] | [next] | [standalone]


#67187

From"Joseph L. Casale" <jcasale@activenetwerx.com>
Date2014-02-28 02:16 +0000
Message-ID<mailman.7449.1393553884.18130.python-list@python.org>
In reply to#67183
> 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

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web