Unladen Swallow 2009Q2 released
Unladen Swallow 2009Q2 released
Posted Jul 16, 2009 0:17 UTC (Thu) by drag (guest, #31333)In reply to: Unladen Swallow 2009Q2 released by clugstj
Parent article: Unladen Swallow 2009Q2 released
Python is a strongly typed language....
$ python
Python 2.5.4 (r254:67916, Feb 17 2009, 20:16:45)
[GCC 4.3.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> cow = "5"
>>> cow = 1 + cow
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: unsupported operand type(s) for +: 'int' and 'str'
-------------------
You can 'compile' it also:
$ cat > hello_world.py
print("hello world")
$ python
Python 2.5.4 (r254:67916, Feb 17 2009, 20:16:45)
[GCC 4.3.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import py_compile
>>> py_compile.compile("hello_world.py")
>>> exit()
$ rm hello_world.py ; chmod +x hello_world.pyc
$ ./hello_world.pyc
hello world
:)
Well.. it's byte-compiled, not native machine code. Same difference, pretty much. What don't you get from executing a python program that you don't get from compiling C++?
There are plenty of tools for analyzing python code for correctness and whatnot....
