By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
464,832 Members | 1,202 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 464,832 IT Pros & Developers. It's quick & easy.

Python Written in C?

P: n/a
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.
Jul 20 '08 #1
Share this Question
Share on Google+
61 Replies

P: n/a
gi**************@gmail.com wrote:
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#.
Psst. What language do you think the primary implementations of C# is
written in?

--
Erik Max Francis && ma*@alcyone.com && http://www.alcyone.com/max/
San Jose, CA, USA && 37 18 N 121 57 W && AIM, Y!M erikmaxfrancis
The actor is not quite a human being -- but then, who is?
-- George Sanders
Jul 20 '08 #2

P: n/a
On Jul 20, 5:50�pm, giveitawhril2...@gmail.com wrote:
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#.
Python is for people who want to program, not REAL WORLD
programmers.
>
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
C isn't a high level language, that's part of its problem.
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.
Yes, you are.
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.
Then go learn C, nobody's stopping you.

Jul 21 '08 #3

P: n/a
In article
<a9**********************************@59g2000hsb.g ooglegroups.com>,
Mensanator <me********@aol.comwrote:
C isn't a high level language, that's part of its problem.
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.
Jul 21 '08 #4

P: n/a
On Jul 21, 8:50 am, giveitawhril2...@gmail.com wrote:
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.
Why do that, when gcc has a code generator for just about every 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#
A bit of a non sequitur .... and C# is available on how many different
MPU chips?
and Python is
akin to Visual Basic
<chuckle/>
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!
Nobody wants to use C any more?
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.
It should be sublimely irrelevant to most people learning LanguageX
what language LanguageX is written in.

Some other implementations of Python: PyPy (written in Python), Jython
(written in Java) and IronPython (written in C#).
Jul 21 '08 #5

P: n/a
On Jul 20, 6:50*pm, giveitawhril2...@gmail.com wrote:
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.
I somehow doubt the Python community will feel much of a loss if you
decide to learn some other language.
Carl Banks
Jul 21 '08 #6

P: n/a
gi**************@gmail.com writes:
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?
Well, yes, the interpreter and a handful of the core modules are written in C.
However, most of Python -- especially the cool bits -- aren't written in
C. They're written in ... Python!

-- Teiresias
Jul 21 '08 #7

P: n/a
In article <fa**********************************@y38g2000hsy. googlegroups.com>, gi**************@gmail.com wrote:
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?
C is the universal assembler.

Mike
Jul 21 '08 #8

P: n/a
On Jul 20, 7:37�pm, Roy Smith <r...@panix.comwrote:
In article
<a9620c65-49c6-4fe7-9cbe-de3779ec3...@59g2000hsb.googlegroups.com>,

�Mensanator <mensana...@aol.comwrote:
C isn't a high level language, that's part of its problem.

C is the highest level assembler language
Isn't that like bragging about being the smartest
kid on the short bus?
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.
Carry bits? Who worries about carry bits when you have
unlimited precision arithmetic? 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)

Jul 21 '08 #9

P: n/a
Carry bits? Who worries about carry bits when you have
unlimited precision arithmetic? 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 that "cool." I call it "unreadable."

-Steve Johnson
Jul 21 '08 #10

P: n/a
On Jul 20, 10:05�pm, Stephen Johnson <dior...@gmail.comwrote:
Carry bits? Who worries about carry bits when you have
unlimited precision arithmetic? 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 that "cool." I call it "unreadable."
Ok, but not in the sense that something like
Scheme is unreadable as this is nothing but
algebra (albeit complicaed).
>
-Steve Johnson
Jul 21 '08 #11

P: n/a
On Sun, Jul 20, 2008 at 11:51 PM, Mensanator <me********@aol.comwrote:
On Jul 20, 10:05�pm, Stephen Johnson <dior...@gmail.comwrote:
Carry bits? Who worries about carry bits when you have
unlimited precision arithmetic? 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 that "cool." I call it "unreadable."

Ok, but not in the sense that something like
Scheme is unreadable as this is nothing but
algebra (albeit complicaed).
Scheme doesn't *have* to be unreadable... any more unreadable than any
other language when poorly documented/formatted, anyway.
Jul 21 '08 #12

P: n/a
Mensanator wrote:
On Jul 20, 7:37�pm, Roy Smith <r...@panix.comwrote:
>In article
<a9620c65-49c6-4fe7-9cbe-de3779ec3...@59g2000hsb.googlegroups.com>,

�Mensanator <mensana...@aol.comwrote:
>>C isn't a high level language, that's part of its problem.
C is the highest level assembler language

Isn't that like bragging about being the smartest
kid on the short bus?
>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.

Carry bits? Who worries about carry bits when you have
unlimited precision arithmetic? You want cool?
Perhaps you missed the wonderful humor in Roy's post. It was rather
brilliant. Sorry you missed it.
Jul 21 '08 #13

P: n/a
gi**************@gmail.com wrote:
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.
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.

I am very confused over your incoherent ramblings about C# being some
how more real than C, or Python, or Visual Basic, or any other language.
I fail to grasp what connection the syntax of a language has to do with
anything being real or not. You first say you hope someone was writing
optimized assembly for python on the different platforms (I'm not
familiar with the acronym "MPU.") and then go on to say it should have
been written with C#. I'm confused as to what C# has to do with
optimized, platform-specific assembly.
Jul 21 '08 #14

P: n/a
On Jul 20, 11:08*pm, "Dan Upton" <up...@virginia.eduwrote:
On Sun, Jul 20, 2008 at 11:51 PM, Mensanator <mensana...@aol.comwrote:
On Jul 20, 10:05�pm, Stephen Johnson <dior...@gmail.comwrote:
Carry bits? Who worries about carry bits when you have
unlimited precision arithmetic? 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 that "cool." I call it "unreadable."
Ok, but not in the sense that something like
Scheme is unreadable as this is nothing but
algebra (albeit complicaed).

Scheme doesn't *have* to be unreadable... any more unreadable than any
other language when poorly documented/formatted, anyway.
When I needed to whip up a variation on Ulam's
Spiral recently, I went and got the Scheme version
I wrote 4 years ago when I briefly toyed with Scheme
and thought I'd just translate the plotting part to
Python. Couldn't make any sense of it and ended up
doing the Python version with Turtle Graphics.

Jul 21 '08 #15

P: n/a
gi**************@gmail.com wrote:
>
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. ...
No one writes compilers in assembly language. Most people don't even write
assemblers in assembly language.
>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.
You seem to believe that, because YOU are just learning about Python, that
necessarily means that Python itself is new. That is incorrect. Python
was originally conceived and developed in 1990. Anders Hejlsberg, who
designed C#, was still at Borland at that time, and had not even created
Delphi yet. C++ was still many years away from becoming an ISO standard.
>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.
I would say you have a very strange criteria for deciding whether a
language is worth learning.
--
Tim Roberts, ti**@probo.com
Providenza & Boekelheide, Inc.
Jul 21 '08 #16

P: n/a
On 21/07/2008, gi**************@gmail.com <gi**************@gmail.comwrote:
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?
Are you a PH.d researcher
In the first place why do you want to make an issue of "what an x
language is compiled in "
and if that' is what you are researching in, then sorry to say you
don't seam to have a mindset needed for researcher.
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#.
First off all c# is absolute rubbish waist of time. if I need to
learn it then I better lern java or pythonfor that matter. and by the
way what is a "real programmer?"
I never knew that there are robots who program vertually and a "real
programmer ".
What do you think I am a spam bot who is writing a "vertual program "
every day? first give me your defination for real programmer.
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!
what! no one is using c? I want to know what people use to write
device drivers? I am such a fool I really never new that people use
c# to create device drivers for hardware and for creating firmware. I
admit my stupidity that I never knew that c# is "real programming
language ".
and what is "your programming language?"python is a free and open
source programming language and does not belong to one person.
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.
My request and strong recommendation to you is "don't learn python,
because you don't deserve to. " I am not saying for dissing you, i
know you are "real programmer ". but you seam to have a typical
mindset which the rubbish microsoft has inculcated in many
programmers, aa sorry "real programmers " line you.
I don't think there is any point saying "vvb kind of " some thing is
great and python is rubbish. every language has its value and vb is
not a language in the first place. python is made with a view that it
is usefull for all purposes and it has been so far successful and I
don't really care why it is done in c as long as it does the work.
happy hacking.
Krishnakant.
--
http://mail.python.org/mailman/listinfo/python-list
Jul 21 '08 #17

P: n/a
Michael Torrie wrote:
gi**************@gmail.com wrote:
>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.

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?
or that perl troll making another attempt to add noise to this
newsgroup? I'm a bit surprised that he managed to generate this
many replies, really.

</F>

Jul 21 '08 #18

P: n/a
On Jul 21, 6:58*am, "Krishnakant Mane" <hackin...@gmail.comwrote:
>
First off all c# is absolute rubbish waist of time. *if I need to
learn it then I better lern java or pythonfor that matter. *and by the
way what is a "real programmer?"
The story of a Real Programmer:

http://www.pbm.com/~lindahl/mel.html

Iain
Jul 21 '08 #19

P: n/a
ptn
On Jul 20, 5:50*pm, giveitawhril2...@gmail.com wrote:
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.
Jul 21 '08 #20

P: n/a
Bruno Desthuilliers wrote:
gi**************@gmail.com 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.

--
mph
Jul 21 '08 #21

P: n/a
On Jul 20, 3:50*pm, giveitawhril2...@gmail.com wrote:
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
Jul 21 '08 #22

P: n/a
rynt wrote:
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.

Jul 21 '08 #23

P: n/a
Martin P. Hellwig wrote:
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
Jul 21 '08 #24

P: n/a
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.

Jul 21 '08 #25

P: n/a
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?
Jul 21 '08 #26

P: n/a
Roy Smith <ro*@panix.comwrote:
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-

Jul 21 '08 #27

P: n/a
In article <cq******************************@speakeasy.net> ,
Erik Max Francis <ma*@alcyone.comwrote:
gi**************@gmail.com wrote:
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#.

Psst. What language do you think the primary implementations of C# is
written in?
I know, I know, call on me!

Object Pascal, obviously.

--
David C. Ullrich
Jul 21 '08 #28

P: n/a
On Mon, 21 Jul 2008 18:12:54 +0200, mk wrote:
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
Jul 21 '08 #29

P: n/a
On Mon, Jul 21, 2008 at 1:21 PM, Marc 'BlackJack' Rintsch
<bj****@gmx.netwrote:
On Mon, 21 Jul 2008 18:12:54 +0200, mk wrote:
>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?
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.
Jul 21 '08 #30

P: n/a
On Jul 20, 11:59*pm, Michael Torrie <torr...@gmail.comwrote:
giveitawhril2...@gmail.com wrote:
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.

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?
Jul 21 '08 #31

P: n/a
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


On 20 jul, 19:50, giveitawhril2...@gmail.com wrote:
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
Jul 21 '08 #32

P: n/a
Mensanator schrieb:
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

--
"Wer etwas kritisiert muss es noch lange nicht selber besser können. Es
reicht zu wissen, daß andere es besser können und andere es auch
besser machen um einen Vergleich zu bringen." - Wolfgang Gerber
in de.sci.electronics <47***********************@news.freenet.de>
Jul 21 '08 #33

P: n/a
On Mon, 21 Jul 2008 11:26:27 -0700, castironpi wrote:
On Jul 20, 11:59*pm, Michael Torrie <torr...@gmail.comwrote:
>giveitawhril2...@gmail.com wrote:
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.

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?
Are you saying python is not as smart as you.

Ciao,
Marc 'BlackJack' Rintsch
Jul 21 '08 #34

P: n/a


Fredrik Lundh wrote:
rynt wrote:
>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.
Or Aspiring Comic. This is certain one of the more entertaining troll
posts we have had ;-).

Jul 21 '08 #35

P: n/a


mk wrote:
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

Jul 21 '08 #36

P: n/a
On Jul 21, 8:26*am, Johannes Bauer <dfnsonfsdu...@gmx.dewrote:
Mensanator schrieb:
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.
>
Regards,
Johannes

--
"Wer etwas kritisiert muss es noch lange nicht selber besser knnen. Es
reicht zu wissen, da andere es besser knnen und andere es auch
besser machen um einen Vergleich zu bringen." * * - * * Wolfgang Gerber
* * * *in de.sci.electronics <47fa8447$0$11545$9b622...@news.freenet.de>
Jul 21 '08 #37

P: n/a
gi**************@gmail.com writes:
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?
Well, yes, the interpreter and a handful of the core modules are written in C.
However, most of Python -- especially the cool bits -- aren't written in
C. They're written in ... Python!

-- Teiresias
Jul 21 '08 #38

P: n/a
On Jul 20, 6:50 pm, giveitawhril2...@gmail.com wrote:
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."
Jul 22 '08 #39

P: n/a
gi**************@gmail.com wrote:
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.
SPSS (was and may still be) written in Fortran and the Fortran compiler was
written in C. But NOBODY would suggest that you try to solve the problems that
SPSS is used for in C.

You talk about "writing it in assembly language for each MPU chip". Actually it
is even better than that. We now have these modern inventions, called compilers
that do that type of work for us. They translate high level instructions, not
into assembler but into machine language.

-Larry
Jul 22 '08 #40

P: n/a
On 2008-07-22, Larry Bates <la*********@websafe.com`wrote:
You talk about "writing it in assembly language for each MPU
chip". Actually it is even better than that. We now have
these modern inventions, called compilers that do that type of
work for us. They translate high level instructions, not
into assembler but into machine language.
Actually, all of the compilers I'm familiar with (gcc and a
handful of cross compilers for various microprocessors)
translate from high-level languages (e.g. C, C++) into
assembly, which is then assembled into relocatable object
files, which are then linked/loaded to produce machine
language.

--
Grant Edwards grante Yow! "DARK SHADOWS"
at is on!! Hey, I think
visi.com the VAMPIRE forgot his
UMBRELLA!!
Jul 22 '08 #41

P: n/a
Grant Edwards wrote:
On 2008-07-22, Larry Bates <la*********@websafe.com`wrote:
>You talk about "writing it in assembly language for each MPU
chip". Actually it is even better than that. We now have
these modern inventions, called compilers that do that type of
work for us. They translate high level instructions, not
into assembler but into machine language.

Actually, all of the compilers I'm familiar with (gcc and a
handful of cross compilers for various microprocessors)
translate from high-level languages (e.g. C, C++) into
assembly, which is then assembled into relocatable object
files, which are then linked/loaded to produce machine
language.
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
Jul 22 '08 #42

P: n/a
On Jul 22, 5:59 am, Larry Bates <larry.ba...@websafe.com`wrote:
Grant Edwards wrote:
On 2008-07-22, Larry Bates <larry.ba...@websafe.com`wrote:
You talk about "writing it in assembly language for each MPU
chip". Actually it is even better than that. We now have
these modern inventions, called compilers that do that type of
work for us. They translate high level instructions, not
into assembler but into machine language.
Actually, all of the compilers I'm familiar with (gcc and a
handful of cross compilers for various microprocessors)
translate from high-level languages (e.g. C, C++) into
assembly, which is then assembled into relocatable object
files, which are then linked/loaded to produce machine
language.

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.
Jul 22 '08 #43

P: n/a
On 2008-07-22, Larry Bates <la*********@websafe.com`wrote:
Grant Edwards wrote:
>On 2008-07-22, Larry Bates <la*********@websafe.com`wrote:
>>You talk about "writing it in assembly language for each MPU
chip". Actually it is even better than that. We now have
these modern inventions, called compilers that do that type of
work for us. They translate high level instructions, not
into assembler but into machine language.

Actually, all of the compilers I'm familiar with (gcc and a
handful of cross compilers for various microprocessors)
translate from high-level languages (e.g. C, C++) into
assembly, which is then assembled into relocatable object
files, which are then linked/loaded to produce machine
language.
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.
There may indeed be compilers that work that way. On Unix
systems (which is what I work with) compilers have
traditionally generated assembly language 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.
Since you probably need an assembler anyway, generating
assembly-language in the compiler prevents you from having to
duplicate a bunch of object-code-generation code in two places.

--
Grant Edwards grante Yow! Okay ... I'm going
at home to write the "I HATE
visi.com RUBIK's CUBE HANDBOOK FOR
DEAD CAT LOVERS" ...
Jul 22 '08 #44

P: n/a
Iain King wrote:
On Jul 21, 6:58 am, "Krishnakant Mane" <hackin...@gmail.comwrote:
>First off all c# is absolute rubbish waist of time. if I need to
learn it then I better lern java or pythonfor that matter. and by the
way what is a "real programmer?"

The story of a Real Programmer:

http://www.pbm.com/~lindahl/mel.html

Iain
Wow. Awesome story.
~Ethan

Jul 22 '08 #45

P: n/a
Ethan Furman wrote:
Iain King wrote:
>On Jul 21, 6:58 am, "Krishnakant Mane" <hackin...@gmail.comwrote:
>>First off all c# is absolute rubbish waist of time. if I need to
learn it then I better lern java or pythonfor that matter. and by the
way what is a "real programmer?"

The story of a Real Programmer:

http://www.pbm.com/~lindahl/mel.html

Iain

Wow. Awesome story.
If my google-fu is up to snuff, these are "screenshots" (scans of
printouts) of the actual blackjack game in operation:

http://wps.com/projects/LGP-21/Softw...Blackjack1.jpg
http://wps.com/projects/LGP-21/Softw...Blackjack2.jpg

and here's a scan of a printout of some "source code" (machine language):

http://wps.com/projects/LGP-21/Software/CrapGame.tiff

--
Erik Max Francis && ma*@alcyone.com && http://www.alcyone.com/max/
San Jose, CA, USA && 37 18 N 121 57 W && AIM, Y!M erikmaxfrancis
In time of war the devil makes more room in hell.
-- (a German proverb)
Jul 22 '08 #46

P: n/a
Erik Max Francis wrote:
Ethan Furman wrote:
>Iain King wrote:
>>The story of a Real Programmer:
http://www.pbm.com/~lindahl/mel.html
Iain

Wow. Awesome story.

If my google-fu is up to snuff, these are "screenshots" (scans of
printouts) of the actual blackjack game in operation:

http://wps.com/projects/LGP-21/Softw...Blackjack1.jpg
http://wps.com/projects/LGP-21/Softw...Blackjack2.jpg

and here's a scan of a printout of some "source code" (machine language):

http://wps.com/projects/LGP-21/Software/CrapGame.tiff
The high school I went to had an LGP-30, and I learned to program on it.
Rumor had it that a student from two years before me used to work late
in the lab, and allow the janitors to play blackjack, and it is further
rumored that he made a bit of money leaning on the transfer control
button.

--Scott David Daniels
Sc***********@Acm.Org
Jul 23 '08 #47

P: n/a
Grant Edwards wrote:
On 2008-07-22, Larry Bates <la*********@websafe.com`wrote:
>Grant Edwards wrote:
>>On 2008-07-22, Larry Bates <la*********@websafe.com`wrote:

You talk about "writing it in assembly language for each MPU
chip". Actually it is even better than that. We now have
these modern inventions, called compilers that do that type of
work for us. They translate high level instructions, not
into assembler but into machine language.
Actually, all of the compilers I'm familiar with (gcc and a
handful of cross compilers for various microprocessors)
translate from high-level languages (e.g. C, C++) into
assembly, which is then assembled into relocatable object
files, which are then linked/loaded to produce machine
language.
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.

There may indeed be compilers that work that way. On Unix
systems (which is what I work with) compilers have
traditionally generated assembly language 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.

Since you probably need an assembler anyway, generating
assembly-language in the compiler prevents you from having to
duplicate a bunch of object-code-generation code in two places.
I'm not sure I understand what you mean here. The code generation phase of the
top level compiler would have to generate assembler mnemonics instead of just
generating machine coded directly. At that point it should be just as easy to
generate machine code, unless you take advantage of macros, or other helpers
provided in the assembly phase.

My "compiler" work was way back on mainframes and the ones I worked with
definitely didn't produce assembler then needed to be run through the assembler.
They created likable objects directly. But that was over 30 years ago!

All this may be a moot point, because assembler is just a mnemonic
representations of machine language anyway.

-Larry
Jul 23 '08 #48

P: n/a
Marc 'BlackJack' Rintsch wrote:
On Mon, 21 Jul 2008 18:12:54 +0200, mk wrote:
>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
When I use os.walk and need to remove directories or files. Seems to be the
only way to do the in-place delete that is required. But you are right, it is
very seldom.

-Larry
Jul 23 '08 #49

P: n/a
On 2008-07-23, Larry Bates <la*********@websafe.com`wrote:
>Since you probably need an assembler anyway, generating
assembly-language in the compiler prevents you from having to
duplicate a bunch of object-code-generation code in two places.

I'm not sure I understand what you mean here. The code
generation phase of the top level compiler would have to
generate assembler mnemonics instead of just generating
machine coded directly. At that point it should be just as
easy to generate machine code, unless you take advantage of
macros, or other helpers provided in the assembly phase.
Generating assembly language can be a lot easier than
generating machine code. One of the big advantage if you're
generating assembly language is you don't have to handle
relocation and address fix-up issues -- you can let the
assembler and linker take care of it. Letting the linker do
the final machine-code generation step also allows certain
optimizations that can't really be done by the compiler.
My "compiler" work was way back on mainframes and the ones I
worked with definitely didn't produce assembler then needed to
be run through the assembler. They created likable objects
directly.
There probably are plenty of compilers that do that. My
background is Unix and microprocessor stuff, and it could be
that for various reasons the "emit assembly" approach was more
common in that genre.
But that was over 30 years ago!

All this may be a moot point, because assembler is just a
mnemonic representations of machine language anyway.
On many architectures, a particular mnemonic can end up being
translated into one of several slightly different machine
instructions -- for example a simple "jump" mnemonic might
generate any one of several instructions depending on how far
away the destination is located. If you've already got an
assembler and linker than know how to deal with that stuff,
then rather than duplicate the same functionality in the
compiler, one might just decided to emit a "jump mnemonic" and
a label.

--
Grant Edwards grante Yow! Wow! Look!! A stray
at meatball!! Let's interview
visi.com it!
Jul 23 '08 #50

61 Replies

This discussion thread is closed

Replies have been disabled for this discussion.