Note that there are some explanatory texts on larger screens.

plurals
  1. POPython lists with STL like interface
    primarykey
    data
    text
    <p>I have to port a C++ STL application to Python. I am a Python newbie, but have been programming for over a decade. I have a great deal of experience with the STL, and find that it keeps me hooked to using C++. I have been searching for the following items on Google these past several days:</p> <ol> <li>Python STL (in hope of leveraging my years of STL experience)</li> <li>Python linked lists</li> <li>Python advanced list usage</li> <li>Python list optimization </li> <li>Python ordered sets</li> </ol> <p>And have found posts about the above topic, tutorials on Python lists that are decidedly NOT advanced, or dead ends. I am really surprised at my lack of success, I think I am just burned out from overworking and entering bad search terms!</p> <p>(MY QUESTION) Can I get a Python STL wrapper, or an interface to Python lists that works like the STL? If not can someone point me to a truly advanced tutorial or paper on managing very large sorted collections of non trivial objects?</p> <p>P.S. I can easily implement workarounds for one or two uses, but if management wants to port more code, I want to be ready to replace any STL code I find with equivalent Python code immediately. And YES I HAVE MEASURED AND DO NEED TO HAVE TOTALLY OPTIMAL CODE! I CANT JUST DO REDUNDANT SORTS AND SEARCHES!</p> <p>(ADDENDUM) Thanks for the replies, I have checked out some of the references and am pleased. In response to some of the comments here:</p> <p>1 - It is being ported to python because managements says so, I would just as soon leave it alone - if it aint broke, why fix it?</p> <p>2 - Advanced list usage with non trivial objects, what I mean by that is: Many different ways to order and compare objects, not by one <strong>cmp</strong> method. I want to splice, sort, merge, search, insert, erase, and combine the lists extensively. I want lists of list iterators, I want to avoid copying.</p> <p>3 - I now know that built in lists are actually arrays, and I should be looking for a different python class. I think this was the root of my confusion.</p> <p>4 - Of course I am learning to do things in the Python way, but I also have deadlines. The STL code I am porting is working right, I would like to change it as little as possible, because that would introduce bugs.</p> <p>Thanks to everyone for their input, I really appreciate it.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload