Did I find the right examples for you? yes no      Crawl my project      Python Jobs

# list.sort

All Samples(7646)  |  Call(7646)  |  Derive(0)  |  Import(0)
```L.sort(cmp=None, key=None, reverse=False) -- stable sort *IN PLACE*;
cmp(x, y) -> -1, 0, 1
```

```
nodes = build_expression_tree(Omega, rewrites)
Omega.sort(key=lambda x: nodes[x[1]].ht(), reverse=True)

# make sure we know the sign of each exp() term; after the loop,
```

```                    freqs.append(rec)
# sort according to frequencies
freqs.sort(key=operator.itemgetter(1), reverse=True)
# produce report content
rcontent = list()
```
```
# sort based on number of DOFs (we begin permuting with longer DOF lists)
dofs_across_categories.sort(key=operator.itemgetter(3), reverse=True)

# re--index gathered information to facilitate generating permutation IDs later
```

```    def sort(self, cmp=None, key=None, reverse=False):
"Standard list sort method"
if key:
temp = [(key(v),v) for v in self]
temp.sort(key=lambda x: x[0], reverse=reverse)
self[:] = [v[1] for v in temp]
else:
temp = list(self)
if cmp is not None:
temp.sort(cmp=cmp, reverse=reverse)
```
```                temp.sort(cmp=cmp, reverse=reverse)
else:
temp.sort(reverse=reverse)
self[:] = temp

```

```    def sort(self, cmp=None, key=None, reverse=False):
"Standard list sort method"
if key:
temp = [(key(v),v) for v in self]
temp.sort(key=lambda x: x[0], reverse=reverse)
self[:] = [v[1] for v in temp]
else:
temp = list(self)
if cmp is not None:
temp.sort(cmp=cmp, reverse=reverse)
```
```                temp.sort(cmp=cmp, reverse=reverse)
else:
temp.sort(reverse=reverse)
self[:] = temp

```

```    def write_stats(self):
locs = list(self.stats.keys())
locs.sort(cmp=lambda x, y: cmp(self.stats[x], self.stats[y]),
reverse=True)
for key in locs[500:]:
```
```        limit = tweaks['many_libraries']
key = sort_key if len(locs) > limit else lambda x:self.stats[x]
locs.sort(key=key, reverse=len(locs)<=limit)
for loc in locs:
yield self.pretty(loc), loc
```

```                top_cones = list(levels[-1])
if len(top_cones) == self.ngenerating_cones():
top_cones.sort(key=lambda cone:
cone.star_generator_indices()[0])
levels[-1] = top_cones
if len(levels) >= 2: # We have rays
rays = list(levels[1])
rays.sort(key=lambda cone: cone.ambient_ray_indices()[0])
```
```    # Convert to a list or make a copy, so that the input is unchanged.
cones = list(cones)
cones.sort(key=lambda cone: cone.dim(), reverse=True)
generators = []
for cone in cones:
```

```    def sort(self, cmp=None, key=None, reverse=False):
"Standard list sort method"
if key:
temp = [(key(v),v) for v in self]
temp.sort(key=lambda x: x[0], reverse=reverse)
self[:] = [v[1] for v in temp]
else:
temp = list(self)
if cmp is not None:
temp.sort(cmp=cmp, reverse=reverse)
```
```                temp.sort(cmp=cmp, reverse=reverse)
else:
temp.sort(reverse=reverse)
self[:] = temp

```

```    def test_copy(self):
dup = self.set.copy()
dup_list = list(dup);
dup_list.sort()
set_list = list(self.set);
set_list.sort()
```
```    def test_deep_copy(self):
dup = copy.deepcopy(self.set)
##print type(dup), repr(dup)
dup_list = list(dup);
dup_list.sort()
set_list = list(self.set);
set_list.sort()
```

```        sl.append(tuple)

sl.sort(key=lambda i: i[1], reverse=True)
return sl[:limit]

```

```                            annTypes.add(eType)