[Python-Dev] Is static typing still optional?

Eric V. Smith eric at trueblade.com
Wed Dec 20 20:13:55 EST 2017


On 12/20/2017 6:57 PM, Mike Miller wrote:
> On 2017-12-19 02:53, Paul Moore wrote:
>> Also, the fact that no-one raised this issue during the whole time the
>> PEP was being discussed (at least as far as I recollect) and that
>> Guido (who of all of us should be most aware of what is and isn't
>> acceptable use of annotations in the stdlib) approved the PEP,
>> suggests to me that this isn't that big a deal.
> 
> 
> Hi, I asked about this in the first posting of the PEP and agree with 
> Chris.
> 
>      
> https://mail.python.org/pipermail/python-dev/2017-September/149406.html
> 
> 
> There is definitely a passive bias towards using types with dataclasses 
> in that the Eric (the author) doesn't appear to want an example without 
> them in the pep/docs.

I'm not sure what such an example would look like. Do you mean without 
annotations? Or do you mean without specifying the "correct" type, like:

@dataclass
class C:
    x: int = 'hello world'

?

Or something else?

Can you provide an example of what you'd like to see?

> It seems that typing proponents are sufficiently enamored with them that 
> they can't imagine anyone else feeling differently, haha.

I've never used typing or mypy, so you're not talking about me. I do 
like the conciseness that annotations bring to dataclasses, though. If 
you buy that (and you might not), then I don't see the point of not 
using a correct type annotation.

Eric.



More information about the Python-Dev mailing list