[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:
http://www.developer.com/java/ent/article.php/615891/Applying-Hungarian-Notation-to-Java-programs-Part-1.htm
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.
--
Steve
More information about the Python-ideas
mailing list