Does Python 2.4 compile?
If I write a program in Python, can it compile?
|
you just run your script using the Python interpreter
Code:
/usr/bin/python yourscript.py |
I believe you can compile a python script. Don't really know the particulars, though.
|
Basically, no.
|
Quote:
|
|
Define "Compile"
Technically, every time you run a Python program, it's compiled into bytecodes which are then interpreted by the virtual machine. When modules are called from scripts, they are oftentimes compiled and then their bytecodes are written to .pyc files for fast loading later on. Googling turns up a page about this straight away. The idea is similar to byte-compiling Lisp code. Perl works this way as well, it's just that Perl doesn't write its bytecodes to files (by default).
But you're probably thinking more along the lines of native binary compilation? |
OK-but I want to write programs that I can open later. I have had some (as in very little) experience with C++ and know HTML pretty well. (I know HTML isn't really a programming language but I thought I'd throw it in...)
|
Oh, you mean as opposed to typing them into the REPL? (In other words, the interactive prompt?) Yes, just type your program into a file (use a .py extension) and then run `python name-of-file` to run the program. Or, alternatively, at the start of the file write "#!/usr/bin/env python" and make the file executable with `chmod +x name-of-file` and run it like any other command from the shell (not available in Windows). You'll probably have to put the directory in front of it, like so: `./name-of-file`
|
What is Ruby like? And is KDevelop: Ruby the actual program in which to create it?
|
Ruby is a fantastical programming language. To sum up its virtues in one word: abstraction. I'd say, the best way to decide if you like it is to give it a shot.
And by the way, decent programming languages are not tied to IDEs -- if you want to write Ruby in KDevelop, go ahead. I use Emacs for editing everything and then run stuff from the shell (or actually, from Emacs' shell mode, but they're still standalone commands). You can really learn a lot about how stuff works by doing things from the CLI instead of relying on IDE magick. |
Where can I get a tutorial on it?
|
Quote:
There are various attempts at compiling Python to machine code, but they are either incomplete, or they package the interpreter with the Python program in one way or another. That's why I say basically, No. AFAIK, the same goes for Ruby. |
You can use py2exe on Windows and PyInstaller on Linux.
Both programs 'compiles' python scripts into 'stand alone executables'. |
Quote:
|
All times are GMT -5. The time now is 12:38 AM. |