# we set the cell time label to the longest
# period
grid[i][j].time_label = same_cell_below.time_label
- # then we sort emissions, and if the start
- # time is the same, the longest are put first
- def cmp_schedule(x, y):
- if x.datetime == y.datetime:
- return -cmp(x.get_duration(), y.get_duration())
- return cmp(x.datetime, y.datetime)
- grid[i][j].schedules.sort(cmp_schedule)
+ # then we sort emissions so the longest are
+ # put first
+ grid[i][j].schedules.sort(
+ lambda x, y: -cmp(x.get_duration(), y.get_duration()))
# then we add individual time labels to the
# other schedules
for schedule in current_cell_schedules: