[Python-ideas] Structural type checking for PEP 484

Steven D'Aprano steve at pearwood.info
Fri Sep 18 04:13:39 CEST 2015

On Thu, Sep 17, 2015 at 04:56:33PM -0500, Ryan Gonzalez wrote:

> Embedding type names in arguments and method names.

supposedly being "Java's fatal mistake".

I'm not sure that Java developers commonly make a practice of doing 
that. It would be strange, since Java requires type declarations. I'm 
not really a Java guy, but I think this would be more like what you 
would expect:

public class Example{
   public void processCoords(Point t1, Point t2, boolean fast){

where Point is equivalent to a (int, int) tuple.

You seem to be describing a verbose version of "Apps Hungarian 
Notation". I don't think Hungarian Notation was ever standard practice 
in the Java world, although I did find at least one tutorial (from 1999) 
recommending it:


In any case, I *think* that your intended lesson is that type 
annotations can increase the quality of code even without a type 
checker, as they act as type documentation to the reader.

I agree with that.


More information about the Python-ideas mailing list