On Sep 30, 12:52 am, "Prasad, Ramit" <ramit.pra...@jpmorgan.com> wrote: > -----Original Message----- > From: python-list-bounces+ramit.prasad=jpmorgan....@python.org > [mailto:python-list-bounces+ramit.prasad=jpmorgan....@python.org] On Behalf > Of Chris Angelico > Sent: Thursday, September 29, 2011 11:51 AM > To: python-l...@python.org > Subject: Re: Question on Manipulating List and on Python > > On Fri, Sep 30, 2011 at 2:36 AM, Subhabrata Banerjee > <subhagurgaon2...@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 athttp://www.jpmorgan.com/pages/disclosures/email. > >
Dear Group, Thanks for your suggestions. I'll check if these work. Converting to dictionary I was thinking but others I have to test. Without patting my own back(I do not write algorithms that good), I can say Python is indeed damn fast. A reason many of my friends are shifting fast to Python and I was suggested by a reputed person of MIT CogLab to use Python instead of C++ and it worked just fabulous for me. To my collegue I would find out an answer. Regards, Subhabrata. -- http://mail.python.org/mailman/listinfo/python-list