473,793 Members | 2,948 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Python Written in C?

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....whe reas
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
61 6972
On 2008-07-22, Larry Bates <la*********@we bsafe.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
Grant Edwards wrote:
On 2008-07-22, Larry Bates <la*********@we bsafe.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
On Jul 22, 5:59 am, Larry Bates <larry.ba...@we bsafe.com`wrote :
Grant Edwards wrote:
On 2008-07-22, Larry Bates <larry.ba...@we bsafe.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
On 2008-07-22, Larry Bates <la*********@we bsafe.com`wrote :
Grant Edwards wrote:
>On 2008-07-22, Larry Bates <la*********@we bsafe.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
Iain King wrote:
On Jul 21, 6:58 am, "Krishnakan t Mane" <hackin...@gmai l.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
Ethan Furman wrote:
Iain King wrote:
>On Jul 21, 6:58 am, "Krishnakan t Mane" <hackin...@gmai l.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 "screenshot s" (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
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 "screenshot s" (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***********@A cm.Org
Jul 23 '08 #47
Grant Edwards wrote:
On 2008-07-22, Larry Bates <la*********@we bsafe.com`wrote :
>Grant Edwards wrote:
>>On 2008-07-22, Larry Bates <la*********@we bsafe.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
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
On 2008-07-23, Larry Bates <la*********@we bsafe.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

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
1565
by: David Stockwell | last post by:
Hi, Today I was in a meeting and someone mentioned they were looking for some software whereby they could run their own fax server (ie a computer with a modem, someone sends a fax, and the software convertes it to an image and drops it in an email box). I'm posting this here incase someone happens to know of a python implementation or other language implementation that is either free or for sale? If so, I'd like to know where to get...
0
1653
by: thomasasta | last post by:
Hey there is a new python written open source bit-torrent client out. Don´t mit it up with brams c++ bittorrent, in python it is bit-torrent.sf.net Don´t forget the minus - http://bit-torrent.sourceforge.net/ It´s out till 10 days and the code is open source, so you can add it to any other application in python like CyberSpace or any other app !
4
1791
by: Michiel Overtoom | last post by:
Giveitawhril wrote... No: Real programmers first eat a quiche and then return to their Pascal programming. C is alive and kicking. Every language has its place. Plus, there exists implementations of Python written in Python itself;
0
1277
by: Phil Runciman | last post by:
On 20 jul, 19:50, giveitawhril2...@gmail.com wrote: ".. if Python is so hot.." Python represents progress not the ultimate goal. Thank goodness we are continuing to learn from past mistakes. All compilers and interpreters started out being written in another language. You do not help us by stating the obvious. This is even true of the interpreter in your own brain that processes English. IMHO The latter still has some bugs in it....
0
9518
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10430
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10211
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10159
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10000
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9033
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7538
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6776
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5436
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.