Python Written in C?

B

Bruno Desthuilliers

(e-mail address removed) a écrit :
(snip clueless nonsense)

Surely a troll... No one on earth can be *that* clueless.
 
P

ptn

I'm just learning about Python now and it sounds interesting. But I
just read (on the Wiki page) that mainstream Python was written in C.
That's what I was searching for: Python was written in what other
language?

See, my concern was something like: OK, if Python is so hot, then,
hopefully someone is writing it in assembly language for each MPU chip
out there. Otherwise, if, say, they've written it in C#, then it looks
like the REAL, generally useful language to learn is C# and Python is
akin to Visual Basic or something: a specialty language....whereas
REAL WORLD programmers who want to be generally useful go and learn
C#.

So I was suspecting the Python compiler or interpreter is written in a
REAL language like C#. So, Wiki says it's written in C! It's almost as
if it were an intentional trick...write your own, new language in an
OLD, real world language that is passe. Compile it into executable
modules of course, so it is a real, working compiler, alright. But the
SOURCE is some old, high level language which no one wants to use
anymore! So now you've got a hot new language package and no one can
say "well, it is written in, the SOURCE code is written in, a REAL
language." No, it's not! The source is some outdated language and
compiler and no one is going to prefer learning THAT to learning your
hot new language!

I'm not dissing Python, here. Just noting that, if it is written in C,
that throws a curve at me in trying to balance the value of learning
Python vs. some other major language.


Sounds like you program only because someone's paying you. Any
programmer who says that C is outdated and not real *is* outdated and
not real.

Not used anymore? Mmmmm I wonder, have you heard of something called
"Linux"? The open source Unix-like system? Or perhaps you are familiar
with "Apache"? Does "GNOME" ring any bells to you? "Vim"? "Git"? You
got some serious research to do, STFW.
 
J

Johannes Bauer

Mensanator said:
You want cool?
THIS is cool:

j = ((invert(xyz[1]-xyz[0],xyz[1]**(k-1))*(xyz[1]**(k-1)-prev_gen[2]))
% xyz[1]**(k-1))/xyz[1]**(k-2)

You call it cool, I call it NameError: name 'invert' is not defined.

Regards,
Johannes
 
M

Martin P. Hellwig

Bruno said:
(e-mail address removed) a écrit :
(snip clueless nonsense)

Surely a troll... No one on earth can be *that* clueless.
I disagree he has upper management written all over him.
 
R

rynt

I'm just learning about Python now and it sounds interesting. But I
just read (on the Wiki page) that mainstream Python was written in C.
That's what I was searching for: Python was written in what other
language?

See, my concern was something like: OK, if Python is so hot, then,
hopefully someone is writing it in assembly language for each MPU chip
out there. Otherwise, if, say, they've written it in C#, then it looks
like the REAL, generally useful language to learn is C# and Python is
akin to Visual Basic or something: a specialty language....whereas
REAL WORLD programmers who want to be generally useful go and learn
C#.

So I was suspecting the Python compiler or interpreter is written in a
REAL language like C#. So, Wiki says it's written in C! It's almost as
if it were an intentional trick...write your own, new language in an
OLD, real world language that is passe. Compile it into executable
modules of course, so it is a real, working compiler, alright. But the
SOURCE is some old, high level language which no one wants to use
anymore! So now you've got a hot new language package and no one can
say "well, it is written in, the SOURCE code is written in, a REAL
language." No, it's not! The source is some outdated language and
compiler and no one is going to prefer learning THAT to learning your
hot new language!

I'm not dissing Python, here. Just noting that, if it is written in C,
that throws a curve at me in trying to balance the value of learning
Python vs. some other major language.

You're either ---
A. A Troll
B. A young, immature programmer trying to show off
or
C. A total idiot.

Who cares what language a language is written in as long as you can be
productive - which you certainly can be in Python.

RCB
 
M

Matthew Fitzgibbons

Martin said:
I disagree he has upper management written all over him.

In any case, the OP should remember that programming languages are all
theoretically the same: if you can do it in one language, then you can
theoretically do it any other. When choosing a language, you just need
to find one that (a) has the right tools to do the job (libraries,
methods of deployment, supported platforms, etc.) and (b) that you and
your team are comfortable using. Python has the tools to tackle a huge
range of problems (you can often use the standard library when you would
have to write C code from scratch), and many find it, dare I say, fun to
use (whereas I find C# roughly equivalent to being shot). Whether you
should use it depends on your domain and your team's preference.

-Matt
 
F

Fredrik Lundh

rynt said:
You're either ---
A. A Troll
B. A young, immature programmer trying to show off
or
C. A total idiot.

you forgot the "All of the above" choice.
 
M

mk

Who cares what language a language is written in as long as you can be
productive - which you certainly can be in Python.

Seriously, though, would there be any advantage in re-implementing
Python in e.g. C++?

Not that current implementation is bad, anything but, but if you're not
careful, the fact that lists are implemented as C arrays can bite your
rear from time to time (it recently bit mine while using lxml). Suppose
C++ re-implementation used some other data structure (like linked list,
possibly with twists like having an array containing pointers to 1st
linked list elements to speed lookups up), which would be a bit slower
on average perhaps, but it would behave better re deletion?
 
M

Marcus.CM

Hi everyone,

Yes, python is written in C. Maybe the original poster is looking for
"ultimate" language and thus finds it uncomfortable that python should
be written in C and not python itself.
Actually it doesnt matter if IronPython is written in C# and Python in
C. Each programming language is like a tool to the programmer and no, C
is not outdate, its just a language with a much higher learning curve
and its best left to do stuffs requiring drivers or optimized algorithms
and other embedded stuffs that is usable by other languages. What do you
think C# is written in? C# ?
You see how flawed this logic is.
Anyway, good luck on your search. But why look for "ultimate" language,
when the core difference is the "programmmer" him/herself. In the hands
of an skilled programmer, any language could accomplish much and then
there is an issue with "time". I would cringe to do in C what i do in
python nowadays, and i have like 14 years of C/C++ programming
background. Someone wrote bittorrent in python and today its Utorrent
written in C/C++ that is "cool", you see that doesnt mean that the next
guy wrote write it in python would not beat the cool factor, its a
matter of design, look, feel and ....its all about the programmer.

Like they say in racing, its the driver not the car.
 
M

Matthew Woodcraft

Roy Smith said:
C is the highest level assembler language I've ever used. And I've used a
few. It really is cool that you can add two 32-bit integers and not have
to worry about all those carry bits.

I was ever so pleased when I found out that the LLVM people have
learned this lesson from C.

I look forward to the day when we can have similar treatment for all
forms of error checking. Programming will be so much easier.

-M-
 
M

Marc 'BlackJack' Rintsch

Seriously, though, would there be any advantage in re-implementing
Python in e.g. C++?

Not that current implementation is bad, anything but, but if you're not
careful, the fact that lists are implemented as C arrays can bite your
rear from time to time (it recently bit mine while using lxml). Suppose
C++ re-implementation used some other data structure (like linked list,
possibly with twists like having an array containing pointers to 1st
linked list elements to speed lookups up), which would be a bit slower
on average perhaps, but it would behave better re deletion?

An operation that most people avoid because of the penalty of "shifting
down" all elements after the deleted one. Pythonistas tend to build new
lists without unwanted elements instead. I can't even remember when I
deleted something from a list in the past.

Ciao,
Marc 'BlackJack' Rintsch
 
D

Dan Upton

Aside (actual reply below): at least for a sorted LL, you're basically
describing Henriksen's algorithm. They can asymptotically be faster,
based on amortized analysis, but they're somewhat more complicated to
implement.
An operation that most people avoid because of the penalty of "shifting
down" all elements after the deleted one. Pythonistas tend to build new
lists without unwanted elements instead. I can't even remember when I
deleted something from a list in the past.

Ciao,
Marc 'BlackJack' Rintsch

The other side of the equation though is the OO-overhead for C++
programs as compared to C. (A couple years ago we used an
instrumentation tool to check the instruction count for a simple hello
world program written in C (ie, main(){printf("Hello world!"); return
0;}) and Python (main(){cout<<"hello world"<<endl;return 0;}), and the
instruction count was significantly higher for C++. I expect any sort
of C++ objects you used to implement Python structures will be slower
than the equivalent in C. So even if writing it in C++ would reduce
the overhead for deleting from a list, I expect you would lose a lot
more.
 
C

castironpi

Definitely one of the most non-sequitor statements I have ever heard.
Actually your entire post doesn't make much sense.  Maybe you are a
brother bot to castropini?  Perhaps a less-trained one, although none of
castropini's posts seem to make sense either.  The AI needs a bit of work.

Are you saying Python is not good for writing A.I., or the A.I. isn't
good at writing Python?
 
L

Luis M. González

Let's say you want to build a house...
You can use pre-built bricks and stack them together to build your
walls, or you can cook your own bricks out of clay because hey! clay
is the real thing.... not those ready-made bricks that anyone can use!
In the end, you'll have a truly original house but you would have
spent 5 years instead of 6 months.

The question is: Is it worth it?

Bceause you can use pre-built bricks instead and, after applying
stucco, nobody will notice you used bricks instead of your own in
house-original-cooked bricks.

Ok, making your own bricks give you more control over the final result
and the way you work with them, but after building two or three
houses, you realize it is very cumbersome and time consuming, and not
really practical for a "real world" builder...
Although making your own bricks could make sense if instead of being a
house builder, you are a bricks vendor.

It is the same with programming languages:
If you are planning to write the next operating system, or a database
management system to be used in mission critical applications by
millions of users, or perhaps a 3D graphics application, you'd better
use C.

Fort anything else, boy, don't lose your time. Use Python, get the job
done with the least delay and have fun.
My two cents...

Luis
 
M

Marc 'BlackJack' Rintsch

Are you saying Python is not good for writing A.I., or the A.I. isn't
good at writing Python?

Are you saying python is not as smart as you.

Ciao,
Marc 'BlackJack' Rintsch
 
T

Terry Reedy

mk said:
Seriously, though, would there be any advantage in re-implementing
Python in e.g. C++?

Considered and rejected by Guido and the CPython developer crew.
Anyone who wants C++Python is free to make one, just as people have done
JavePython (Jython), C#Python, (IonPython), PythonPython (PyPy), and
compiled-CPython (multiple).
Not that current implementation is bad, anything but, but if you're not
careful, the fact that lists are implemented as C arrays can bite your
rear from time to time (it recently bit mine while using lxml). Suppose
C++ re-implementation used some other data structure (like linked list,
possibly with twists like having an array containing pointers to 1st
linked list elements to speed lookups up), which would be a bit slower
on average perhaps, but it would behave better re deletion?

This is a data structure issue, not a language issue. The tradeoffs for
practical implementation include code-length, code-complexity,
code-fragility, and ease of cross-platform compilation as well as
classical time and space issues.

tjr
 
M

Mensanator

Mensanator said:
You want cool?
THIS is cool:
j = ((invert(xyz[1]-xyz[0],xyz[1]**(k-1))*(xyz[1]**(k-1)-prev_gen[2]))
% xyz[1]**(k-1))/xyz[1]**(k-2)

You call it cool, I call it NameError: name 'invert' is not defined.

It is when you do: from gmpy import *

That single line wasn't the whole program.

What's cool is that it IS a single line, that does answers
with >50000 decimal digits without breaking a sweat. Sure, you
can use GMP with C (and I've done it). But it's nothing like
doing it in Python.
 
B

bojannastic at googlemail

So I was suspecting the Python compiler or interpreter is written in a
REAL language like C#. So, Wiki says it's written in C! It's almost as
if it were an intentional trick...write your own, new language in an
OLD, real world language that is passe. Compile it into executable
modules of course, so it is a real, working compiler, alright. But the
SOURCE is some old, high level language which no one wants to use
anymore! So now you've got a hot new language package and no one can
say "well, it is written in, the SOURCE code is written in, a REAL
language." No, it's not! The source is some outdated language and
compiler and no one is going to prefer learning THAT to learning your
hot new language!

Young people these days...

I will just answer using one of old Microsoft's ads: "My compiler
compiled yours."
 
C

cokofreedom

I just learned something I did not know. I was under the impression that they
translated directly to machine code without ever actually generating Assembler
text files. Seems like a waste to generate the text and turn around run that
through the assembler, but what do I know. I guess that way the compiler can
have pluggable assembler back-ends.

-Larry

I also I have just learned something new! Troll threads are useful.
Yay.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,780
Messages
2,569,608
Members
45,249
Latest member
KattieCort

Latest Threads

Top