Path: csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail From: Ben Finney Newsgroups: comp.lang.python Subject: Re: Pyhon 2.x or 3.x, which is faster? Date: Thu, 10 Mar 2016 13:29:54 +1100 Lines: 54 Message-ID: References: <56df6761$0$1588$c3e8da3$5496439d@news.astraweb.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Trace: news.uni-berlin.de be6E9vh2LHnJpiTfc7hbwAu4es8oaJupv+wW+7i+svWQ== Cancel-Lock: sha1:GoOR3VdEf7jhtsIqY0Z3keJ9Zdc= Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.007 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'python,': 0.02; 'false,': 0.07; 'plenty': 0.07; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'scripting': 0.09; 'statements': 0.09; 'subject:which': 0.09; 'python': 0.10; 'different;': 0.16; 'preserving': 0.16; 're-usable': 0.16; 'received:80.91.229.3': 0.16; 'received:io': 0.16; 'received:plane.gmane.org': 0.16; 'received:psf.io': 0.16; 'sebastian': 0.16; 'slave': 0.16; 'slow,': 0.16; 'trade-offs': 0.16; 'trivially': 0.16; 'written.': 0.16; 'programmer': 0.18; 'language': 0.19; 'library': 0.20; 'expense': 0.22; 'made.': 0.22; 'ones.': 0.22; 'needed.': 0.23; 'slightly': 0.23; "i've": 0.25; 'header:User-Agent:1': 0.26; 'header:X-Complaints-To:1': 0.26; 'question': 0.27; 'function': 0.28; 'release.': 0.29; 'use?': 0.29; 'asked': 0.29; "i'm": 0.30; 'code': 0.30; 'operations': 0.31; 'another': 0.32; 'language.': 0.32; 'statement': 0.32; 'point': 0.33; 'languages': 0.34; 'maintaining': 0.34; 'previous': 0.34; 'skip:d 20': 0.34; 'gets': 0.35; 'done': 0.35; 'c++': 0.35; 'conditions.': 0.35; 'express': 0.35; 'but': 0.36; 'needed': 0.36; 'there': 0.36; 'created': 0.36; "wasn't": 0.36; 'to:addr:python-list': 0.36; 'subject:?': 0.36; 'subject:: ': 0.37; 'being': 0.37; 'received:org': 0.37; 'things': 0.38; 'no,': 0.38; 'version': 0.38; 'someone': 0.38; 'why': 0.39; 'whatever': 0.39; 'enough': 0.39; 'to:addr:python.org': 0.40; 'some': 0.40; 'easy': 0.60; 'ever': 0.60; 'your': 0.60; 'valuable': 0.61; 'yes': 0.62; 'course': 0.62; 'more': 0.63; 'you.': 0.64; 'touch': 0.66; '\xe2\x80\x93': 0.72; '_o__)': 0.84; 'citation': 0.84; 'fast,': 0.84; 'non-critical': 0.84; 'reap': 0.84; 'received:125': 0.84; 'trades': 0.84; 'attitude': 0.91; 'musical': 0.91; 'instrument': 0.95 X-Injected-Via-Gmane: http://gmane.org/ X-Gmane-NNTP-Posting-Host: jigong.madmonks.org X-Public-Key-ID: 0xAC128405 X-Public-Key-Fingerprint: 517C F14B B2F3 98B0 CB35 4855 B8B2 4C06 AC12 8405 X-Public-Key-URL: http://www.benfinney.id.au/contact/bfinney-pubkey.asc X-Post-From: Ben Finney User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4 (gnu/linux) X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Xref: csiph.com comp.lang.python:104466 BartC writes: > 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? Because some operations actually need to be very fast, even at the expense of difficult-to-maintain code in a difficult-to-use language. > 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? Because that's the whole point of writing a small re-usable library and maintaining it: countless gobs of badly-written imitations thereby never need to be written. > 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. Yes, that's pretty much the answer to the question you asked above. > But the attitude in this group has been very different; Python /is/ > slow, but so what? Just a general shrug. I'm sorry you drew that inference. Comprehensive answers – not a “general shrug” – have in fact been given to you. The answer boils down to the fact that there are trade-offs to be made. One that is easy to express is that Python trades preserving valuable programmer time, at the expense of some non-critical operations being slightly slower. And no, of course it's not “Python is slow”. Such a broad statement is erxactly what gets mocking scorn in response: you need to be *much* more specific about what is slow, under what conditions. Python is plenty fast enough at most of the things it is used for. > 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! Citation needed. I don't know of any released version of Python that was ever “twice as slow” – no qualifiers – than the previous release. Make such sweeping, hand-waving statements that are trivially demonstrated false, and yes your statements will be dismissed. With sneers by some, and with a shrug by most. -- \ “It's easy to play any musical instrument: all you have to do | `\ is touch the right key at the right time and the instrument | _o__) will play itself.” —Johann Sebastian Bach | Ben Finney