What is different with Python ?

Andreas Kostyrka andreas at kostyrka.org
Mon Jun 13 03:22:55 EDT 2005


On Mon, Jun 13, 2005 at 06:13:13AM +0000, Andrea Griffini wrote:
> >Andrea Griffini <agriff at tin.it> writes:
> >So you're arguing that a CS major should start by learning electronics
> >fundamentals, how gates work, and how to design hardware(*)? Because
> >that's what the concrete level *really* is. Start anywhere above that,
> >and you wind up needing to look both ways.
Yep. Probably. Without a basic understanding of hardware design, one cannot
many of todays artifacts: Like longer pipelines and what does this
mean to the relative performance of different solutions.

Or how does one explain that a "stupid and slow" algorithm can be in
effect faster than a "clever and fast" algorithm, without explaining
how a cache works. And what kinds of caches there are. (I've seen
documented cases where a stupid search was faster because all hot data
fit into the L1 cache of the CPU, while more clever algorithms where
slower).

So yes, one needs a basic understanding of hardware, so that one can
understand the design of "assembly". And without knowledge of these
you get C programmers that do not really understand what their
programs do. (Be it related to calling sequences, portability of their
code, etc.) Again you can sometimes see developers that pose questions
that suggest that they do not know about the lowlevel. (Example from a
current project: Storing booleans in a struct-bit-field so that it's
faster. Obviously such a person never seen the code needed to
manipulate bit fields on most architectures.)

A good C programmer needs to know about assembly, libc (stuff like
malloc and friends and the kernel API). 

Now a good python programmer needs to know at least a bit about the
implementation of python. (Be it CPython or Jython).

So yes, one needs to know the underlying layers, if not by heart, than
at least on a "I-know-which-book-to-consult" level.

Or you get perfect abstract designs, that are horrible when
implemented.

> Not really. Long ago I've drawn a line that starts at
> software. I think you can be a reasonable programmer
> even without the knowledge about how to design hardware.
Well, IMHO one needs to know at least a bit. But one doesn't need to
know it well enough to be able to design hardware by himself. ;)

> I do not think you can be a reasonable programmer if
> you never saw assembler.
> 
> >Admittedly, at some level the details simply stop mattering. But where
> >that level is depends on what level you're working on. Writing Python,
> >I really don't need to understand the behavior of hardware

Yes. But for example to understand the memory behaviour of Python
understanding C + malloc + OS APIs involved is helpful.

> >gates. Writing horizontal microcode, I'm totally f*cked if I don't
> >understand the behavior of hardware gates.
> 
> But you better understand how, more or less, your
> computer or language works, otherwise your code will
> be needless thousand times slower and will require
> thousand times more memory than is necessary.
> Look a recent thread where someone was asking why
> python was so slow (and the code contained stuff
> like "if x in range(low, high):" in an inner loop
> that was itself pointless).

Andreas



More information about the Python-list mailing list