Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Debian packages RPM packages NuGet packages

Repository URL to install this package:

Details    
Cython / tests / run / unpacklistcomp.pyx
Size: Mime:
def unpack_normal(l):
    """
    >>> unpack_normal([1,2])
    (1, 2)
    >>> unpack_normal([1,2,3]) # doctest: +ELLIPSIS
    Traceback (most recent call last):
    ValueError: ...
    """
    a,b = l
    return a,b

def unpack_comp(l):
    """
    >>> unpack_comp([1,2])
    (1, 2)
    >>> unpack_comp([1,2,3]) # doctest: +ELLIPSIS
    Traceback (most recent call last):
    ValueError: ...
    """
    a,b = [ n for n in l ]
    return a,b

def unpack_expr(l):
    """
    >>> unpack_expr([1,2])
    (1, 4)
    >>> unpack_expr([1,2,3]) # doctest: +ELLIPSIS
    Traceback (most recent call last):
    ValueError: ...
    """
    a,b = [ n*n for n in l ]
    return a,b