|
|
Log in / Subscribe / Register

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

> I'd have to say that it is MUCH MORE than 1% improvement. You can compile just about anything in Python. With Python you have to write a lot more unit tests to verify that the code is to the level of what a clean compile would tell you in a more strongly typed language.

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....


to post comments

Unladen Swallow 2009Q2 released

Posted Jul 16, 2009 0:22 UTC (Thu) by drag (guest, #31333) [Link] (1 responses)

Sorry, I know I am being a bit foolish.

I think you meant 'statically' typed, not 'strongly' typed.

Unladen Swallow 2009Q2 released

Posted Jul 16, 2009 4:12 UTC (Thu) by k8to (guest, #15413) [Link]

Python is definitely *not* statically typed.

>>> myvar = 4
>>> myvar = "hi"
>>>

Notice no error.


Copyright © 2026, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds