Python is DOOMED! Again!

Mario Figueiredo marfig at gmail.com
Thu Jan 22 06:06:33 EST 2015


 Chris,

> I'd rather see a real-world example that can't be solved with either
> better design or some simple aliases. (And yes, the type hinting does
> allow for aliases.)

Python is a duck-typing language, Chris. It is in its nature -- and we have 
been taught -- to ignore types and care only about operators. This means 
one of the most common design decisions in Python is exactly to code functions 
that are type ignorant. That is exactly why we need Type Hinting, because 
duck-typing complicates static analysis. And that is exactly why the Unions 
factory are a necessary part of the type hinting mechanism in PEP 484.

You will be seeing lots and lots of Unions in type annotated code once it 
gets implemented. And it's not because of the complexity of Unions syntax 
that I should now care about refactoring my code. That is a no-no.

If you don't know of any real-life example of python functions that will 
eventually force you into annotate them with unions syntax, look no further 
than your standard library. And also start questioning if you aren't complicating 
your own code with unnecessary function overloads.





More information about the Python-list mailing list