[Tutor] intefaces in python

Alan Gauld alan.gauld at btinternet.com
Mon Jun 29 18:21:26 CEST 2009


"Amit Sethi" <amit.pureenergy at gmail.com> wrote 

> I think ideally i want a compile Error just like java .. 

I think you are trying to make Python act like Java which 
is always a really bad mistake when using a programming 
language. As Bjarne Stroustrup used to say (repeatedly) 
"C++ is not Smalltalk". And Python is not Java.

If you stop trying to design like Java and start using 
the extra power of Python you will find your solutions 
are both more flexible and more simple.

Python does not compile so trying to build in "compile time" 
checking makes no sense. You could do some checks 
immediately after class definition or more likely class 
assignment but how would it really benefit you?

Get used to how interpreted dynamic languages work 
and use their features to your benefit instead of trying 
to force them to act like statically typed compiled 
languages. It will give you a great sense of freedom!


-- 
Alan Gauld
Author of the Learn to Program web site
http://www.alan-g.me.uk/




More information about the Tutor mailing list