473,782 Members | 2,419 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 6963
The OO overheads for C++ are almost non-existent.
http://www.informit.com/articles/art...92024&ns=15058

On Mon, Jul 21, 2008 at 2:05 PM, Dan Upton <up***@virginia .eduwrote:
On Mon, Jul 21, 2008 at 1:21 PM, Marc 'BlackJack' Rintsch
<bj****@gmx.net 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?

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;re turn 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.
--
http://mail.python.org/mailman/listinfo/python-list


--

Warren Myers
http://warrenmyers.com
Jul 29 '08 #61
2008/7/21 Krishnakant Mane <ha*******@gmai l.com>:
First off all c# is absolute rubbish waist of time.
What a pity others are joining in this pointless language flame-war.

Look, I recently had to write a script for manipulating some data; I
struggled to organise it in Python and in C++, but when I tried C#
everything fell naturally into place and I had it done in next to no
time. Other times it has been Python or C++ that has been the most
natural way to express what I'm trying to do. Just because /you/
don't like C# doesn't mean it's rubbish or a waste of time; personally
I loathe Perl, but I respect the fact that a lot of programmers can
get good results very quickly in it.

I reckon that the programmer who only knows one language is like a
carpenter trying to make a cabinet with just a chisel. Ok for making
the joints (although a hammer would have been handy to hit it with),
not /really/ as good as a plane for getting large areas smooth, and
the blade keeps jumping out when you try to use it as a screwdriver...

The one-language programmer isn't really in a position to choose the
right tool for the job, because they only have one tool. Anybody who
says that a language in real use is a waste of time is denying the
reality of those who find it an effective tool. Similarly, anybody who
says that a language -- any language -- is right for all jobs plainly
doesn't understand that language design involves a lot of compromises,
and that the compromises that are appropriate choices for one task are
inappropriate for another. Python is a great tool. So is C#. You /can/
do the same job with either, but the smart move is to choose the one
that is best adapted to the task in hand.

--
Tim Rowe
Aug 1 '08 #62

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

Similar topics

2
1564
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
1652
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
1276
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
9480
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
10313
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...
1
10081
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
6735
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
5378
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...
0
5511
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4044
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3643
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2875
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.