83
votes
8answers
18k views

How to avoid .pyc files?

Can I run the python interpreter without generating the compiled .pyc files?
73
votes
6answers
8k views

How to translate between programming languages

I am setting out to do a side project that has the goal of translating code from one programming language to another. The languages I am starting with are PHP and Python (Python to PHP should be ...
40
votes
4answers
10k views

Python - Parse a .py file, read the AST, modify it, then write back the modified source code

I want to programmatically edit python source code. Basically I want to read a .py file, generate the AST, and then write back the modified python source code (i.e. another .py file). There are ways ...
27
votes
11answers
28k views

Online compilers/runtime for Java, C++, Python and ObjC?

Does anyone know of a good online compiler/runtime (for C++, Java, Python, ObjC etc.) that I can access on the web? What I'm looking for is something that would allow me to type in a program in a ...
27
votes
7answers
10k views

Compiled vs. Interpreted Languages

I'm trying to get a better understanding of the difference. I've found a lot of explanations online, but they tend towards the abstract differences rather than the practical implications. Most of my ...
25
votes
11answers
4k views

Is there a need for a “use strict” Python compiler?

There exist static analysis tools for Python, but compile time checks tend to be diametrically opposed to the run-time binding philosophy that Python embraces. It's possible to wrap the standard ...
18
votes
1answer
3k views

Can PyPy/RPython be used to produce a small standalone executable?

(Or, "Can PyPy/RPython be used to compile/translate Python to C/C++ without requiring the Python runtime?") I have tried to comprehend PyPy with its RPython and its Python, its running and its ...
16
votes
12answers
1k views

Why is (python|ruby) interpreted?

What are the technical reasons why languages like Python and Ruby are interpreted (out of the box) instead of compiled? It seems to me like it should not be too hard for people knowledgeable in this ...
15
votes
7answers
9k views

Compiling Python

How can I compile and run a python file (*.py extension)?
15
votes
1answer
3k views

Why is the compiler package discontinued in Python 3?

I was just pleasantly surprised to came across the documentation of Python's compiler package, but noticed that it's gone in Python 3.0, without any clear replacement or explanation. I can't seem to ...
14
votes
1answer
2k views

Python Compilation/Interpretation Process

Hey all, I'm trying to understand the python compiler/interpreter process more clearly. Unfortunately, I have not taken a class in interpreters nor have I read much about them. Basically, what I ...
13
votes
13answers
2k views

What's a good resource for starting to write a programming language, that's not context free?

I'm looking to write a programming language for fun, however most of the resource I have seen are for writing a context free language, however I wish to write a language that, like python, uses ...
12
votes
2answers
4k views

How to write the Visitor Pattern for Abstract Syntax Tree in Python?

My collegue suggested me to write a visitor pattern to navigate the AST. Can anyone tell me more how would I start writing it? As far as I understand, each Node in AST would have visit() method (?) ...
11
votes
3answers
1k views

CoffeeScript-like language written in Python

Are there any languages targeting JavaScript (like CoffeeScript) and written in Python? I found Pyjamas, but it’s GWT of Python as I see. I want a language that doesn’t need heavy runtime library ...
10
votes
5answers
3k views

If-Else-Return or just if-Return?

Suppose I have an if statement with a return. From the efficiency perspective, should I use if(A > B): return A+1 return A-1 or if(A > B): return A+1 else: return A-1 Can ...

1 2 3 4 5 9
15 30 50 per page