[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.python

Why not a Python compiler?

Santiago Romero

2/5/2008 8:20:00 AM


( Surely if this question has been asked for a zillion of times... )
( and sorry for my english! )

I'm impressed with python. I'm very happy with the language and I
find Python+Pygame a very powerful and productive way of writing 2D
games. I'm not, at this moment, worried about execution speed of the
small game I'm working on (it runs at full 60 fps even in an old AMD-
K6 450 Laptop computer), but I continue asking me the same question:

Why not a Python COMPILER?

It would be very nice to be able to output Linux, MAC or Windows
binaries of compiled (not bytecompiled) code. It would run faster, it
will be smaller in size (I think) and it will be easy to distribute to
people not having python installed. Yes, I know about py2exe, but I'm
not sure if that's the right aproach.

So, what's wrong with compiling python?

Maybe is not possible due to nature of the language? Is just a
decision?

What do you think about this?
163 Answers

cokofreedom

2/5/2008 8:30:00 AM

0

On Feb 5, 9:19 am, Santiago Romero <srom...@gmail.com> wrote:
> ( Surely if this question has been asked for a zillion of times... )
> ( and sorry for my english! )
>
> I'm impressed with python. I'm very happy with the language and I
> find Python+Pygame a very powerful and productive way of writing 2D
> games. I'm not, at this moment, worried about execution speed of the
> small game I'm working on (it runs at full 60 fps even in an old AMD-
> K6 450 Laptop computer), but I continue asking me the same question:
>
> Why not a Python COMPILER?
>
> It would be very nice to be able to output Linux, MAC or Windows
> binaries of compiled (not bytecompiled) code. It would run faster, it
> will be smaller in size (I think) and it will be easy to distribute to
> people not having python installed. Yes, I know about py2exe, but I'm
> not sure if that's the right aproach.
>
> So, what's wrong with compiling python?
>
> Maybe is not possible due to nature of the language? Is just a
> decision?
>
> What do you think about this?

I don't know the exact details but I think the issue is the dynamic
nature of Python makes it impossible to correctly store the various
types and changes into compiled code. Someone else will probably be
able to provide a good reason as to why it isn't very feasible, nor a
good idea. If you want to speed up your python look at Psyco.
http://psyco.source...

Jeroen Ruigrok van der Werven

2/5/2008 8:34:00 AM

0

-On [20080205 09:22], Santiago Romero (sromero@gmail.com) wrote:
> Why not a Python COMPILER?

A lot of things within Python are very run-time dependent so creating a
compiler is not trivial work.

There are, however, endeavours underway like shed skin:

http://code.google.com/p...

This provides a Python to C++ compiler, but it enforces some restrictions on
Python's code.

--
Jeroen Ruigrok van der Werven <asmodai(-at-)in-nomine.org> / asmodai
ã?¤ã?§ã?«ã?¼ã?³ ã?©ã?¦ã??ã?­ã??ã?¯ ã?´ã?¡ã?³ ã??ã?« ã?¦ã?§ã?«ã?´ã?§ã?³
http://www.in-n... | http://www.ra...
We have met the enemy and they are ours...

Kay Schluehr

2/5/2008 8:37:00 AM

0

On Feb 5, 9:19 am, Santiago Romero <srom...@gmail.com> wrote:
> ( Surely if this question has been asked for a zillion of times... )

Sure. You can access comp.lang.python via google.google.com. It has a
search function.



Dustan

2/5/2008 12:07:00 PM

0

On Feb 5, 2:37 am, Kay Schluehr <kay.schlu...@gmx.net> wrote:
> On Feb 5, 9:19 am, Santiago Romero <srom...@gmail.com> wrote:
>
> > ( Surely if this question has been asked for a zillion of times... )
>
> Sure. You can access comp.lang.python via

groups

> .google.com.
> It has a
> search function.

Bruno Desthuilliers

2/5/2008 12:14:00 PM

0

Santiago Romero a écrit :
> ( Surely if this question has been asked for a zillion of times... )

Why not checking this by yourself ? google is down ?-)

> I'm impressed with python. I'm very happy with the language and I
> find Python+Pygame a very powerful and productive way of writing 2D
> games. I'm not, at this moment, worried about execution speed of the
> small game I'm working on (it runs at full 60 fps even in an old AMD-
> K6 450 Laptop computer), but I continue asking me the same question:
>
> Why not a Python COMPILER?

http://docs.python.org/lib/module-com...

> It would be very nice to be able to output Linux, MAC or Windows
> binaries of compiled (not bytecompiled) code.

Ah, sorry.

> It would run faster, it
> will be smaller in size (I think)

These two points are very questionnable given Python's dynamicity. IIRC,
some guru already made the point, a couple or more years ago, that it
would be a lot of effort and buy *very* few wrt/ execution speed since
everything still have to happens at runtime. IOW, a JIT compiler seems a
far better solution, but this (so far) still impose some (serious)
limitations to be of any help.



Ripter001@gmail.com

2/5/2008 3:53:00 PM

0


> Why not a Python COMPILER?

What about a Python JIT hardware chip, so the CPU doesn't have to
translate. Although it seems to me that with today's dual and quad
core processors that this might be a mute point because you could just
use one of the cores.

Steve Holden

2/5/2008 4:45:00 PM

0

Ripter001@gmail.com wrote:
>> Why not a Python COMPILER?
>
> What about a Python JIT hardware chip, so the CPU doesn't have to
> translate. Although it seems to me that with today's dual and quad
> core processors that this might be a mute point because you could just
> use one of the cores.
>
What about a chip that reads your mind and does what you want it to?

I am sure that would be popular with all the frustrated computer users
there are in the world.

regards
Steve
--
Steve Holden +1 571 484 6266 +1 800 494 3119
Holden Web LLC http://www.hold...

Jeff Schwab

2/5/2008 4:55:00 PM

0

Steve Holden wrote:
> Ripter001@gmail.com wrote:
>>> Why not a Python COMPILER?
>>
>> What about a Python JIT hardware chip, so the CPU doesn't have to
>> translate. Although it seems to me that with today's dual and quad
>> core processors that this might be a mute point because you could just
>> use one of the cores.
>>
> What about a chip that reads your mind and does what you want it to?

+1!

> I am sure that would be popular with all the frustrated computer users
> there are in the world.

I'll take two. (Chips, not frustrated users).

--
"I sold the cow for these magic ICs," said Jack.

Jeff Schwab

2/5/2008 4:55:00 PM

0

Steve Holden wrote:
> Ripter001@gmail.com wrote:
>>> Why not a Python COMPILER?
>>
>> What about a Python JIT hardware chip, so the CPU doesn't have to
>> translate. Although it seems to me that with today's dual and quad
>> core processors that this might be a mute point because you could just
>> use one of the cores.
>>
> What about a chip that reads your mind and does what you want it to?

+1!

> I am sure that would be popular with all the frustrated computer users
> there are in the world.

I'll take two. (Chips, not frustrated users).

--
"I sold the cow for these magic ICs," said Jack.

Jeff

2/5/2008 6:20:00 PM

0

I'm surprised no one has mentioned Pyrex. It can be used to write
stand-alone C programs using near-Python syntax:

Pyrex: http://www.cosc.canterbury.ac.nz/greg.ewing/pyt...
Stand-alone how-to: http://www.freenet.org.nz/python/embed...
Pyrex how-to: http://ldots.org/py...,
http://www.artfulcode.net/articles/extending-pyt... (shameless
plug, I know)