![]() An example usage would be to initialize vI as a. Calling the vector to be reordered vA, and the vector of indices vI, then vA should be reordered in this order, vA vI 0, vA vI 1, vA vI 2. New_(key=operator. This is an update to a previous question about reordering in place There was some confusion about the vector of indices. # new_(key=lambda x: x._name_, reverse=True) # Uncomment the line bellow after you've read the comment in all the match returns a vector of the positions of (first) matches of its first argument in its second. New_klass = super(Ordered, cls)._new_(cls, name, bases, attr) This will insert at a particular position, and take care of repeating positions automatically.While I disagree with the approach, this is what you need to do: (I've modified the code as little as possible, and added tests at the bottom to prove it works) import operator
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |