def list_reverse__List(space, w_list): w_list.wrappeditems.reverse() return space.w_None # ____________________________________________________________ # Sorting # Reverse a slice of a list in place, from lo up to (exclusive) hi. # (used in sort) class KeyContainer(baseobjspace.W_Root): def __init__(self, w_key, w_item): self.w_key = w_key self.w_item = w_item TimSort = make_timsort_class() # NOTE: all the subclasses of TimSort should inherit from a common subclass, # so make sure that only SimpleSort inherits directly from TimSort. # This is necessary to hide the parent method TimSort.lt() from the # annotator. class SimpleSort(TimSort): def lt(self, a, b): space = self.space return space.is_true(space.lt(a, b)) class CustomCompareSort(SimpleSort): def lt(self, a, b): space = self.space w_cmp = self.w_cmp w_result = space.call_function(w_cmp, a, b) try:
if space.eq_w(w_list.getitem(i), w_any): count += 1 i += 1 return space.wrap(count) def list_reverse__List(space, w_list): w_list.reverse() return space.w_None # ____________________________________________________________ # Sorting # Reverse a slice of a list in place, from lo up to (exclusive) hi. # (used in sort) TimSort = make_timsort_class() IntBaseTimSort = make_timsort_class() FloatBaseTimSort = make_timsort_class() StringBaseTimSort = make_timsort_class() class KeyContainer(baseobjspace.W_Root): def __init__(self, w_key, w_item): self.w_key = w_key self.w_item = w_item # NOTE: all the subclasses of TimSort should inherit from a common subclass, # so make sure that only SimpleSort inherits directly from TimSort. # This is necessary to hide the parent method TimSort.lt() from the # annotator. class SimpleSort(TimSort): def lt(self, a, b):
i += 1 return space.wrap(count) def list_reverse__List(space, w_list): w_list.reverse() return space.w_None # ____________________________________________________________ # Sorting # Reverse a slice of a list in place, from lo up to (exclusive) hi. # (used in sort) TimSort = make_timsort_class() IntBaseTimSort = make_timsort_class() FloatBaseTimSort = make_timsort_class() StringBaseTimSort = make_timsort_class() class KeyContainer(baseobjspace.W_Root): def __init__(self, w_key, w_item): self.w_key = w_key self.w_item = w_item # NOTE: all the subclasses of TimSort should inherit from a common subclass, # so make sure that only SimpleSort inherits directly from TimSort. # This is necessary to hide the parent method TimSort.lt() from the # annotator.