turntable/spin.py
def series(collection, method, prints = 15, *args, **kwargs):
    '''
    Processes a collection in series 

    Parameters
    ----------
    collection : list
        list of Record objects
    method : method to call on each Record
    prints : int
        number of timer prints to the screen

    Returns
    -------
    collection : list
        list of Record objects after going through method called
    
    If more than one collection is given, the function is called with an argument list 
    consisting of the corresponding item of each collection, substituting None for 
    missing values when not all collection have the same length.  
    If the function is None, return the original collection (or a list of tuples if multiple collections).
    
    Example
    -------
    adding 2 to every number in a range

    >>> import turntable
    >>> collection = range(100)
    >>> method = lambda x: x + 2
    >>> collection = turntable.spin.series(collection, method)
    
    '''

    if 'verbose' in kwargs.keys():
        verbose = kwargs['verbose']
    else:
        verbose = True

    results = []
    timer = turntable.utils.Timer(nLoops=len(collection), numPrints=prints, verbose=verbose)
    for subject in collection:
        results.append(method(subject, *args, **kwargs))
        timer.loop()
    timer.fin()
    return results
def series(collection, method, prints = 15, *args, **kwargs):
    '''
    Processes a collection in series 

    Parameters
    ----------
    collection : list
        list of Record objects
    method : method to call on each Record
    prints : int
        number of timer prints to the screen

    Returns
    -------
    collection : list
        list of Record objects after going through method called
    
    If more than one collection is given, the function is called with an argument list 
    consisting of the corresponding item of each collection, substituting None for 
    missing values when not all collection have the same length.  
    If the function is None, return the original collection (or a list of tuples if multiple collections).
    
    Example
    -------
    adding 2 to every number in a range

    >>> import turntable
    >>> collection = range(100)
    >>> method = lambda x: x + 2
    >>> collection = turntable.spin.series(collection, method)
    
    '''

    if 'verbose' in kwargs.keys():
        verbose = kwargs['verbose']
    else:
        verbose = True

    results = []
    timer = turntable.utils.Timer(nLoops=len(collection), numPrints=prints, verbose=verbose)
    for subject in collection:
        results.append(method(subject, *args, **kwargs))
        timer.loop()
    timer.fin()
    return results
def series ( collection , method , prints = 15 , * args , * * kwargs ) : if 'verbose' in kwargs . keys ( ) : verbose = kwargs [ 'verbose' ] else : verbose = True results = [ ] timer = turntable . utils . Timer ( nLoops = len ( collection ) , numPrints = prints , verbose = verbose ) for subject in collection : results . append ( method ( subject , * args , * * kwargs ) ) timer . loop ( ) timer . fin ( ) return results
Processes a collection in series 

    Parameters
    ----------
    collection : list
        list of Record objects
    method : method to call on each Record
    prints : int
        number of timer prints to the screen

    Returns
    -------
    collection : list
        list of Record objects after going through method called
    
    If more than one collection is given, the function is called with an argument list 
    consisting of the corresponding item of each collection, substituting None for 
    missing values when not all collection have the same length.  
    If the function is None, return the original collection (or a list of tuples if multiple collections).
    
    Example
    -------
    adding 2 to every number in a range

    >>> import turntable
    >>> collection = range(100)
    >>> method = lambda x: x + 2
    >>> collection = turntable.spin.series(collection, method)
Processes a collection in series