[Python-ideas] [Wild Idea] Static Ducks

Greg Ewing greg.ewing at canterbury.ac.nz
Sun Sep 20 09:34:29 CEST 2009


Dj Gilcrease wrote:

> I think of what I am trying to
> accomplish as an easier way of having syntax for type checking that
> does not involve having to do isinstance or hasattr checks in every
> place you want to validate the type.

A potential problem with this is that if you make it *too*
easy to write type checks, you're likely to end up with
inefficiencies due to types being checked a lot more
often than they really need to be.

There's a school of thought that expensive operations
shouldn't be hidden behind syntax that makes them appear
deceptively cheap. On that basis, since there is some
cost to doing a type check, it could be argued that
you should have to do a bit of work in order to write
one.

-- 
Greg



More information about the Python-ideas mailing list