Does Python really follow its philosophy of "Readability counts"?

Bruno Desthuilliers bruno.42.desthuilliers at websiteburo.invalid
Wed Jan 21 13:19:46 CET 2009


Paul Rubin a écrit :
> Bruno Desthuilliers <bruno.42.desthuilliers at websiteburo.invalid> writes:
>>> Zope is about 375 KLOC[1],
>> How many LOCS would it require if it was written in ADA ?
> 
> No idea.  Ada is a lot more verbose than Python, but I'm baffled at
> what the heck Zope is actually doing with all that code.
> 
>>> Zope also has 275 open bugs, 6 of which are critical.
>> None of which are going to *kill* anyone FWIW. Now how many of these
>> bugs would have language-enforced access restriction prevented ?
> 
> I'm not about to audit 375 KLOC of code to find out.  Regardless of
> whether access restriction actually prevents bugs though, it certainly
> makes auditing easier.

pylint is your friend.

>  And auditing does find bugs.
> 
>>> [2] The Space Shuttle avionics (written in the 1980's!) are 2 MLOC
>> of a hi-level dynamic language ? Hm, I guess not.
> 
> I think written in some forerunner of Ada.

Yeps, probably something like this. Not specially hi level nor dynamic, 
is it ?

>> Given the difference in LOCS count between a low-level static language
>> and a hi-level dynamic language for the implementation of a same given
>> features set, you cannot just define "large" by the # of LOCS. Not
>> that I'm going to compare Zope with Space shuttle's stuff.
> 
> I don't think static vs dynamic makes much difference in the amount of
> LOCS to accomplish some function.

My own experience is that it does make a huge difference - talking about 
imperative languages, of course.

>  In my limited experience with
> Haskell (statically typed but very high level),

"dynamic" and "static" were not meant to concern typing here (or at 
least not only typing).

Haskell and MLs are indeed statically typed, but with a powerfull type 
inference system, which gives great support for genericity <ot>(hmmm... 
is that the appropriate word ?)</ot>

Now these are functional languages, so the notion of "access 
restriction" is just moot in this context !-)

> it takes around the
> same amount of Haskell code as Python code (sometimes more, sometimes
> less) to do a given task.

Not exactly my own experience, but I confess I'm much more fluent with 
Python than with Haskell !-)

>  More important for concise code is features
> like higher-level functions and types (e.g. it's easy in Python or
> Haskell, but a huge pain in Java or C, to write down a value that is a
> list of dictionaries whose keys are tuples and whose values are more
> lists of dictionaries, to code something list a listcomp, etc).

Yes, indeed. So you agree that Haskell is not exactly a "low level" 
language, do you ?-)

Ok, I should probably have made clear I was thinking of a hi-level 
dynamic _imperative_ language vs a low-level static _imperative_ 
language. FP is quite another world.



More information about the Python-list mailing list