djdb/search.py
def _discard_items(target_list, num_to_discard):
    """Discards items from a list at random.

    Args:
      target_list: The list to discard items from a list.  The list is
        modified in-place.
      num_to_discard: The number of items to attempt to discard.

    Returns:
      Returns the number of items that were actually discarded.
      This number will be equal to len(target_list) if that value is
      less than num_to_discard.
    """
    if num_to_discard <= 0 or target_list is None:
        return 0
    num_to_discard = min(len(target_list), num_to_discard)
    for _ in xrange(num_to_discard):
        discarded = target_list.pop()
    return num_to_discard
Discards items from a list at random.

    Args:
      target_list: The list to discard items from a list.  The list is
        modified in-place.
      num_to_discard: The number of items to attempt to discard.

    Returns:
      Returns the number of items that were actually discarded.
      This number will be equal to len(target_list) if that value is
      less than num_to_discard.
    
Discards items from a list at random.
Discards items from a list at random .
def _discard_items(target_list, num_to_discard):
    if num_to_discard <= 0 or target_list is None:
        return 0
    num_to_discard = min(len(target_list), num_to_discard)
    for _ in xrange(num_to_discard):
        discarded = target_list.pop()
    return num_to_discard
def _discard_items ( target_list , num_to_discard ) : if num_to_discard <= 0 or target_list is None : return 0 num_to_discard = min ( len ( target_list ) , num_to_discard ) for _ in xrange ( num_to_discard ) : discarded = target_list . pop ( ) return num_to_discard
Discards items from a list at random.
Discards items from a list at random .
"""Discards items from a list at random.

    Args:
      target_list: The list to discard items from a list.  The list is
        modified in-place.
      num_to_discard: The number of items to attempt to discard.

    Returns:
      Returns the number of items that were actually discarded.
      This number will be equal to len(target_list) if that value is
      less than num_to_discard.
    """
Returns the number of items that were actually discarded.
This number will be equal to len(target_list) if that value is
less than num_to_discard.
Returns the number of items that were actually discarded . This number will be equal to len ( target_list ) if that value is less than num_to_discard .
target_list
The list to discard items from a list.  The list is
modified in-place.
The list to discard items from a list . The list is modified in - place .
num_to_discard
The number of items to attempt to discard.
The number of items to attempt to discard .