Re: Why is it impossible to create a compiler than can compile Python to machinecode like C?

2013-03-04 Thread Grant Edwards
On 2013-02-28, kramer65 kram...@gmail.com wrote: I'm using Python for a while now and I love it. There is just one thing I cannot understand. There are compilers for languages like C and C++. why is it impossible to create a compiler that can compile Python code to machinecode? The main

Re: Why is it impossible to create a compiler than can compile Python to machinecode like C?

2013-03-04 Thread CM
The main issue is that python has dynamic typing.  The type of object that is referenced by a particular name can vary, and there's no way (in general) to know at compile time what the type of object foo is. That makes generating object code to manipulate foo very difficult. Could you help

Re: Why is it impossible to create a compiler than can compile Python to machinecode like C?

2013-03-04 Thread 88888 Dihedral
On Tuesday, March 5, 2013 6:55:06 AM UTC+8, CM wrote: The main issue is that python has dynamic typing.  The type of object that is referenced by a particular name can vary, and there's no way (in general) to know at compile time what the type of object foo is. That makes

Re: Why is it impossible to create a compiler than can compile Python to machinecode like C?

2013-03-04 Thread Terry Reedy
On 3/4/2013 5:55 PM, CM wrote: Could you help me understand this better? For example, if you have this line in the Python program: foo = 'some text' bar = {'apple':'fruit'} If the interpreter can determine at runtime that foo is a string and bar is a dict, why can't the compiler figure that

Re: Why is it impossible to create a compiler than can compile Python to machinecode like C?

2013-03-04 Thread Chris Angelico
On Tue, Mar 5, 2013 at 9:55 AM, CM cmpyt...@gmail.com wrote: The main issue is that python has dynamic typing. The type of object that is referenced by a particular name can vary, and there's no way (in general) to know at compile time what the type of object foo is. That makes generating

Re: Why is it impossible to create a compiler than can compile Python to machinecode like C?

2013-03-04 Thread Benjamin Kaplan
On Mar 4, 2013 3:02 PM, CM cmpyt...@gmail.com wrote: The main issue is that python has dynamic typing. The type of object that is referenced by a particular name can vary, and there's no way (in general) to know at compile time what the type of object foo is. That makes generating

Re: Why is it impossible to create a compiler than can compile Python to machinecode like C?

2013-03-04 Thread Steven D'Aprano
On Mon, 04 Mar 2013 16:36:36 +, Grant Edwards wrote: On 2013-02-28, kramer65 kram...@gmail.com wrote: I'm using Python for a while now and I love it. There is just one thing I cannot understand. There are compilers for languages like C and C++. why is it impossible to create a compiler

Re: Why is it impossible to create a compiler than can compile Python to machinecode like C?

2013-03-01 Thread Steven D'Aprano
On Fri, 01 Mar 2013 08:48:34 +0100, Stefan Behnel wrote: Steven D'Aprano, 01.03.2013 04:47: On Thu, 28 Feb 2013 22:03:09 +0100, Stefan Behnel wrote: The most widely used static Python compiler is Cython Cython is not a Python compiler. Cython code will not run in a vanilla Python

Why is it impossible to create a compiler than can compile Python to machinecode like C?

2013-02-28 Thread kramer65
Hello, I'm using Python for a while now and I love it. There is just one thing I cannot understand. There are compilers for languages like C and C++. why is it impossible to create a compiler that can compile Python code to machinecode? My reasoning is as follows: When GCC compiles a program

Re: Why is it impossible to create a compiler than can compile Python to machinecode like C?

2013-02-28 Thread Matty Sarro
Python is an interpreted language, not a compiled language. This is actually a good thing! What it means is that there is a scripting engine (we just call it the interpreter) that actually executes everything for you. That means that any operating system that has an interpreter written for it is

Re: Why is it impossible to create a compiler than can compile Python to machinecode like C?

2013-02-28 Thread Stefan Behnel
kramer65, 28.02.2013 21:25: I'm using Python for a while now and I love it. There is just one thing I cannot understand. There are compilers for languages like C and C++. why is it impossible to create a compiler that can compile Python code to machinecode? All projects that implement such

Re: Why is it impossible to create a compiler than can compile Python to machinecode like C?

2013-02-28 Thread Chris Angelico
On Fri, Mar 1, 2013 at 7:50 AM, Matty Sarro msa...@gmail.com wrote: C (your example) was intended for very low level programming, things like operating systems, device drivers, networking stacks, where the speed of a compiled executable and direct access to hardware was a necessity. That's

Re: Why is it impossible to create a compiler than can compile Python to machinecode like C?

2013-02-28 Thread Stefan Behnel
Stefan Behnel, 28.02.2013 22:03: there are also a couple of projects that do dynamic runtime compilation, most notably PyPy and Numba. Oh, and HotPy, I keep forgetting about that. You may want to take a look at the Python implementations page, specifically the list of Python compilers:

Re: Why is it impossible to create a compiler than can compile Python to machinecode like C?

2013-02-28 Thread Dave Angel
On 02/28/2013 03:25 PM, kramer65 wrote: Hello, I'm using Python for a while now and I love it. There is just one thing I cannot understand. There are compilers for languages like C and C++. why is it impossible to create a compiler that can compile Python code to machinecode? My reasoning is

Re: Why is it impossible to create a compiler than can compile Python to machinecode like C?

2013-02-28 Thread Modulok
I'm using Python for a while now and I love it. There is just one thing I cannot understand. There are compilers for languages like C and C++. why is it impossible to create a compiler that can compile Python code to machinecode? Not exactly what you describe, but have you checked out PyPy?

Re: Why is it impossible to create a compiler than can compile Python to machinecode like C?

2013-02-28 Thread Jonas Geiregat
On do, feb 28, 2013 at 12:25:07pm -0800, kramer65 wrote: Hello, I'm using Python for a while now and I love it. There is just one thing I cannot understand. There are compilers for languages like C and C++. why is it impossible to create a compiler that can compile Python code to

Re: Why is it impossible to create a compiler than can compile Python to machinecode like C?

2013-02-28 Thread Terry Reedy
The subject line is wrong. There are multiple compilers. Someone just listed some of them today in another post. On 2/28/2013 3:50 PM, Matty Sarro wrote: Python is an interpreted language, not a compiled language. A language is just a language. Implementations are implementations*. That

Re: Why is it impossible to create a compiler than can compile Python to machinecode like C?

2013-02-28 Thread Nobody
On Thu, 28 Feb 2013 12:25:07 -0800, kramer65 wrote: I'm using Python for a while now and I love it. There is just one thing I cannot understand. There are compilers for languages like C and C++. why is it impossible to create a compiler that can compile Python code to machinecode? It's not

Re: Why is it impossible to create a compiler than can compile Python to machinecode like C?

2013-02-28 Thread Steven D'Aprano
On Thu, 28 Feb 2013 15:50:00 -0500, Matty Sarro wrote: Python is an interpreted language, not a compiled language. Actually, *languages* are neither interpreted nor compiled. A language is an abstract description of behaviour and syntax. Whether something is interpreted or compiled or a

Re: Why is it impossible to create a compiler than can compile Python to machinecode like C?

2013-02-28 Thread Steven D'Aprano
On Thu, 28 Feb 2013 22:03:09 +0100, Stefan Behnel wrote: The most widely used static Python compiler is Cython Cython is not a Python compiler. Cython code will not run in a vanilla Python implementation. It has different keywords and syntax, e.g.: cdef inline int func(double num): ...

Re: Why is it impossible to create a compiler than can compile Python to machinecode like C?

2013-02-28 Thread Steven D'Aprano
On Thu, 28 Feb 2013 12:25:07 -0800, kramer65 wrote: Hello, I'm using Python for a while now and I love it. There is just one thing I cannot understand. There are compilers for languages like C and C++. why is it impossible to create a compiler that can compile Python code to machinecode?

Re: Why is it impossible to create a compiler than can compile Python to machinecode like C?

2013-02-28 Thread alex23
On Mar 1, 1:47 pm, Steven D'Aprano steve +comp.lang.pyt...@pearwood.info wrote: Cython is not a Python compiler. Cython code will not run in a vanilla Python implementation. It has different keywords and syntax, e.g.: cdef inline int func(double num):     ... which gives SyntaxError in a

Re: Why is it impossible to create a compiler than can compile Python to machinecode like C?

2013-02-28 Thread alex23
On Mar 1, 6:25 am, kramer65 kram...@gmail.com wrote: There are compilers for languages like C and C++. why is it impossible to create a compiler that can compile Python code to machinecode? This is a nice site list a lot of current approaches to that subject: http://compilers.pydata.org/ --

Re: Why is it impossible to create a compiler than can compile Python to machinecode like C?

2013-02-28 Thread 88888 Dihedral
kramer65於 2013年3月1日星期五UTC+8上午4時25分07秒寫道: Hello, I'm using Python for a while now and I love it. There is just one thing I cannot understand. There are compilers for languages like C and C++. why is it impossible to create a compiler that can compile Python code to machinecode?

Re: Why is it impossible to create a compiler than can compile Python to machinecode like C?

2013-02-28 Thread Stefan Behnel
Steven D'Aprano, 01.03.2013 04:47: On Thu, 28 Feb 2013 22:03:09 +0100, Stefan Behnel wrote: The most widely used static Python compiler is Cython Cython is not a Python compiler. Cython code will not run in a vanilla Python implementation. It has different keywords and syntax, e.g.: