Bools and explicitness [was Re: PyWart: The problem with "print"]

Steven D'Aprano steve+comp.lang.python at pearwood.info
Wed Jun 5 21:56:23 EDT 2013


On Wed, 05 Jun 2013 14:59:31 -0700, Russ P. wrote:


> I'm not an Ada guy, but Ada advocates claim that it reduces development
> time by half in the long run compared to C and C++ due to reduced
> debugging time and simpler maintenance. 

They may be right. Far too many people think that C and C++ are "best of 
breed" in static languages. They aren't.


> Then again, I think Java people make a similar claim.

Java people would take credit for the sun coming up if they could :-)


> As for Python, my experience with it is that, as
> your application grows, you start getting confused about what the
> argument types are or are supposed to be. 

Whereas people never get confused about the arguments in static typed 
languages?

The only difference is whether the compiler tells you that you've passed 
the wrong type, or your unit test tells you that you've passed the wrong 
type. What, you don't have unit tests? Then how do you know that the code 
does the right thing when passed data of the right type? Adding an extra 
couple of unit tests is not that big a burden.

Of course, if there was a way to automate that, why wouldn't you take 
advantage of it? Python currently has no standard way of doing such 
automated type tests, and probably won't ever get one. A static typed 
language gives you those tests for free, but in many languages at the 
cost that you probably end up spending more time fighting to satisfy the 
compiler than you save by not writing unit tests.



-- 
Steven



More information about the Python-list mailing list