Changeset 4692a16


Ignore:
Timestamp:
Nov 30, 2010 4:49:07 PM (14 years ago)
Author:
Ted Faber <faber@…>
Branches:
axis_example, compt_changes, info-ops, master
Children:
dee164e
Parents:
1f6a573
Message:

Gratuitious use of lambda

File:
1 edited

Legend:

Unmodified
Added
Removed
  • fedd/federation/emulab_access.py

    r1f6a573 r4692a16  
    337337        checked.  If cmp is None, the choices are sorted by priority.
    338338        """
    339         # NB: comparison order reversed so numerically larger priorities are
    340         # checked first.
    341         def prio_cmp(a, b):
    342             return cmp(b.priority, a.priority)
    343 
    344339
    345340        # Import request credentials into this (clone later??)
     
    348343            self.auth.save()
    349344
    350         c = compare or prio_cmp
     345        # NB: in the default case (the else), the comparison order is reversed
     346        # so numerically larger priorities are checked first.
     347        if compare: c = compare
     348        else: c = lambda(a, b): cmp(b,a)
     349
    351350        if filter: f = filter
    352351        else: f = lambda(x): True
Note: See TracChangeset for help on using the changeset viewer.