Pyhon 2.x or 3.x, which is faster?

BartC bc at freeuk.com
Wed Mar 9 20:30:35 EST 2016


On 09/03/2016 23:38, Chris Angelico wrote:
> On Thu, Mar 10, 2016 at 10:14 AM, BartC <bc at freeuk.com> wrote:

>> program to be actually written in Python. Sometimes you want to understand
>> how code works or what it does or simply to learn from it. (Or sometimes, to
>> rip bits off.) Then it's frustrating when you come up against a dead-end so
>> quickly. Because the real meat isn't in Python at all.
>
> What *is* the real meat of a program? Every action is defined in terms
> of smaller actions - a Python program is built out of Python
> primitives and function calls, a C program is built out of C
> primitives and function calls, an 80x86 machine code program is built
> out of 80x86 CPU instructions and calls to other code. Does my MUD
> server need to have its own memory allocation code? No. Does it need
> an algorithm for adding two integers together? Certainly not! And nor
> does it need PNG encoding and decoding algorithms; I simply call on
> Image.PNG.encode() and Image.PNG.decode() to do the work, passing
> images around in my code as first-class objects. Does it detract from
> my code? Not in the least. My code treats "load an image from a PNG
> file" as a fundamental operation, and gets on with doing its stuff.

Yes we understand how libraries can be useful.

But, someone had to write that Image.PNG.encode() function at some time. 
What language did they use? If it wasn't Python, then why not?

Why is it OK to let some poor sod slave away in C++ or whatever (a 
ghastly language), while others then reap the benefits writing in an 
easy 'soft' language?

I've been interested for a while in broadening the scope of scripting 
languages so that less work has to be done in 'hard' ones. (Although I 
admit that taking over imaging functions is probably not going to be 
viable, except perhaps for rather small images.)

It seems other have the same idea with the advent of fast JIT systems.

But the attitude in this group has been very different; Python /is/ 
slow, but so what? Just a general shrug. So long as /someone else/ uses 
the hard language to created the needed libraries, the speed of pure 
Python is irrelevant. New version of Python is now half the speed? 
Another shrug!

> Reinventing the wheel does NOT intrinsically make your code better.

But you might end up with a small, manageable wheel that does just what 
you want instead of the same 100' monster than everything else is using!

-- 
Bartc



More information about the Python-list mailing list