Question on Manipulating List and on Python

Prasad, Ramit ramit.prasad at jpmorgan.com
Thu Sep 29 15:52:52 EDT 2011


-----Original Message-----
From: python-list-bounces+ramit.prasad=jpmorgan.com at python.org [mailto:python-list-bounces+ramit.prasad=jpmorgan.com at python.org] On Behalf Of Chris Angelico
Sent: Thursday, September 29, 2011 11:51 AM
To: python-list at python.org
Subject: Re: Question on Manipulating List and on Python

On Fri, Sep 30, 2011 at 2:36 AM, Subhabrata Banerjee
<subhagurgaon2011 at gmail.com> wrote:
> And Python seems faster than C++/Java. It is indeed. I also experience
> it.
>

Python compared to Java? Difficult to compare. Python to C++?
Impossible to compare. But performance depends MASSIVELY on
algorithmic quality; if you code the exact same thing in Python and in
C++, you would probably find that the C++ one is faster, but chances
are you're implementing approximately the same thing in two quite
different ways. Or possibly you're using a slow and inefficient
library or third-party function.

I've sometimes written code in one language and directly ported it to
another, and then run both on the same hardware. With most such
experiments, CPython generally doesn't perform all that well, and C or
C++ rocks. But frequently, the C/C++ code is more verbose and more
error-prone than the Python - because Python's biggest boast is not
that it's fast, but that it's *fast enough*, while being easy to work
with. (And every once in a while there's something where I want to use
a pointer to some other variable, and that's a concept that just plain
doesn't work in Python. You have references to objects, but you can't
from one place change another variable, without using some kind of
mutable object that they both reference.)
-----------------------------------------------------------------------


I think Steven D'Aprano had an excellent post on this a week or so ago (on the tutor list, not this one).

See: http://mail.python.org/pipermail/tutor/2011-September/085573.html 




Ramit


Ramit Prasad | JPMorgan Chase Investment Bank | Currencies Technology
712 Main Street | Houston, TX 77002
work phone: 713 - 216 - 5423



ChrisA
-- 
http://mail.python.org/mailman/listinfo/python-list
This email is confidential and subject to important disclaimers and
conditions including on offers for the purchase or sale of
securities, accuracy and completeness of information, viruses,
confidentiality, legal privilege, and legal entity disclaimers,
available at http://www.jpmorgan.com/pages/disclosures/email.  



More information about the Python-list mailing list