[Tutor] Python vs. C
Gerrit Holl
gerrit at nl.linux.org
Wed Jan 7 14:32:40 EST 2004
Michael Janssen wrote:
> Another advantage of C is, that it gives you fine grained control about
> memory consumption and datastructures: C hasn't got such strong buildin
> "list" or "dict" but lets you define anything as strong and both best
> suited for your needs. The flipside is, that you should implement it
> good to gain increased performance. I can imaging that you would have a
> very hard time competing with python list's sort method. list.sort is
> (like many performance relevant parts) coded in C and for all I have
> heard it's some of the best C code you can think of.
But there are a lot of C libraries. Aren't there so many C libraries
that one can essentially program higher-level by using a lot of
libraries? Or am I overlooking something?
Me, I know only Python as well, and the only language on my
'want-to-learn'-list is Ruby, so that's not a giant leap at all
(university will teach me Java next year).
> The good thing is, that python lets you embed C for only the
> perfomance related parts.
The bad thing is, that learning C only to be able te embed C in a Python
program seems a bit odd. There isn't a C-for-Python-programmers
tutorial, or is there?
> [root at linus root]# time hello
> Hello, world!
>
> real 0m0.004s
> user 0m0.000s
> sys 0m0.000s
$ time echo hello
hello
real 0m0.000s
user 0m0.000s
sys 0m0.000s
$ timeit.py 'print "hello"'
(skip output)
1000 loops, best of 3: 196 usec per loop
heh heh :)
yours,
Gerrit.
--
135. If a man be taken prisoner in war and there be no sustenance in
his house and his wife go to another house and bear children; and if later
her husband return and come to his home: then this wife shall return to
her husband, but the children follow their father.
-- 1780 BC, Hammurabi, Code of Law
--
PrePEP: Builtin path type
http://people.nl.linux.org/~gerrit/creaties/path/pep-xxxx.html
Asperger's Syndrome - a personal approach:
http://people.nl.linux.org/~gerrit/english/
More information about the Tutor
mailing list