What is different with Python ?

Steven D'Aprano steve at REMOVETHIScyber.com.au
Mon Jun 13 02:43:55 EDT 2005


On Sun, 12 Jun 2005 20:22:28 -0400, Roy Smith wrote:

> At some point, you need to draw a line in the sand (so to speak) and say, 
> "I understand everything down to *here* and can do cool stuff with that 
> knowledge.  Below that, I'm willing to take on faith".  I suspect you would 
> agree that's true, even if we don't agree just where the line should be 
> drawn.  You seem to feel that the level of abstraction exposed by a 
> language like C is the right level.  I'm not convinced you need to go that 
> far down.  I'm certainly not convinced you need to start there.

The important question is, what are the consequences of that faith when it
is mistaken?

As a Python developer, I probably won't write better code if I understand
how NAND gates work or the quantum mechanics of electrons in solid
crystals. But I will write better code if I understand how Python
implements string concatenation, implicit conversion from ints to longs,
floating point issues, etc.

It seems that hardly a day goes by without some newbie writing to the
newsgroup complaining that "Python has a bug" because they have discovered
that the floating point representation of 0.1 in decimal is actually more
like 0.10000000000000001. And let's not forget the number of bugs out
there because developers thought that they didn't need to concern
themselves with the implementation details of memory management.

It makes a difference whether your algorithm runs in constant time,
linear, quadratic, logarithmic or exponential time -- or something even
slower. The implementation details of the language can hide quadratic or
exponential algorithms in something that looks like a linear or constant
algorithm. Premature optimization is a sin... but so is unusably slow
code.



-- 
Steven.





More information about the Python-list mailing list