python类filter()的实例源码

noniterators.py 文件源码 项目:hakkuframework 作者: 4shadoww 项目源码 文件源码 阅读 29 收藏 0 点赞 0 评论 0
def oldfilter(*args):
        """
        filter(function or None, sequence) -> list, tuple, or string

        Return those items of sequence for which function(item) is true.
        If function is None, return the items that are true.  If sequence
        is a tuple or string, return the same type, else return a list.
        """
        mytype = type(args[1])
        if isinstance(args[1], basestring):
            return mytype().join(builtins.filter(*args))
        elif isinstance(args[1], (tuple, list)):
            return mytype(builtins.filter(*args))
        else:
            # Fall back to list. Is this the right thing to do?
            return list(builtins.filter(*args))

    # This is surprisingly difficult to get right. For example, the
    # solutions here fail with the test cases in the docstring below:
    # http://stackoverflow.com/questions/8072755/
pandas_py3k.py 文件源码 项目:packaging 作者: blockstack 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def __and__(self, other):
        ''' Intersection is the minimum of corresponding counts.

        >>> Counter('abbb') & Counter('bcc')
        Counter({'b': 1})

        '''
        if not isinstance(other, Counter):
            return NotImplemented
        _min = min
        result = Counter()
        if len(self) < len(other):
            self, other = other, self
        for elem in filter(self.__contains__, other):
            newcount = _min(self[elem], other[elem])
            if newcount > 0:
                result[elem] = newcount
        return result
noniterators.py 文件源码 项目:packaging 作者: blockstack 项目源码 文件源码 阅读 30 收藏 0 点赞 0 评论 0
def oldfilter(*args):
        """
        filter(function or None, sequence) -> list, tuple, or string

        Return those items of sequence for which function(item) is true.
        If function is None, return the items that are true.  If sequence
        is a tuple or string, return the same type, else return a list.
        """
        mytype = type(args[1])
        if isinstance(args[1], basestring):
            return mytype().join(builtins.filter(*args))
        elif isinstance(args[1], (tuple, list)):
            return mytype(builtins.filter(*args))
        else:
            # Fall back to list. Is this the right thing to do?
            return list(builtins.filter(*args))

    # This is surprisingly difficult to get right. For example, the
    # solutions here fail with the test cases in the docstring below:
    # http://stackoverflow.com/questions/8072755/
noniterators.py 文件源码 项目:islam-buddy 作者: hamir 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
def oldfilter(*args):
        """
        filter(function or None, sequence) -> list, tuple, or string

        Return those items of sequence for which function(item) is true.
        If function is None, return the items that are true.  If sequence
        is a tuple or string, return the same type, else return a list.
        """
        mytype = type(args[1])
        if isinstance(args[1], basestring):
            return mytype().join(builtins.filter(*args))
        elif isinstance(args[1], (tuple, list)):
            return mytype(builtins.filter(*args))
        else:
            # Fall back to list. Is this the right thing to do?
            return list(builtins.filter(*args))

    # This is surprisingly difficult to get right. For example, the
    # solutions here fail with the test cases in the docstring below:
    # http://stackoverflow.com/questions/8072755/
noniterators.py 文件源码 项目:FightstickDisplay 作者: calexil 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def oldfilter(*args):
        """
        filter(function or None, sequence) -> list, tuple, or string

        Return those items of sequence for which function(item) is true.
        If function is None, return the items that are true.  If sequence
        is a tuple or string, return the same type, else return a list.
        """
        mytype = type(args[1])
        if isinstance(args[1], basestring):
            return mytype().join(builtins.filter(*args))
        elif isinstance(args[1], (tuple, list)):
            return mytype(builtins.filter(*args))
        else:
            # Fall back to list. Is this the right thing to do?
            return list(builtins.filter(*args))

    # This is surprisingly difficult to get right. For example, the
    # solutions here fail with the test cases in the docstring below:
    # http://stackoverflow.com/questions/8072755/
noniterators.py 文件源码 项目:cryptogram 作者: xinmingzhang 项目源码 文件源码 阅读 27 收藏 0 点赞 0 评论 0
def oldfilter(*args):
        """
        filter(function or None, sequence) -> list, tuple, or string

        Return those items of sequence for which function(item) is true.
        If function is None, return the items that are true.  If sequence
        is a tuple or string, return the same type, else return a list.
        """
        mytype = type(args[1])
        if isinstance(args[1], basestring):
            return mytype().join(builtins.filter(*args))
        elif isinstance(args[1], (tuple, list)):
            return mytype(builtins.filter(*args))
        else:
            # Fall back to list. Is this the right thing to do?
            return list(builtins.filter(*args))

    # This is surprisingly difficult to get right. For example, the
    # solutions here fail with the test cases in the docstring below:
    # http://stackoverflow.com/questions/8072755/
noniterators.py 文件源码 项目:Repobot 作者: Desgard 项目源码 文件源码 阅读 30 收藏 0 点赞 0 评论 0
def oldfilter(*args):
        """
        filter(function or None, sequence) -> list, tuple, or string

        Return those items of sequence for which function(item) is true.
        If function is None, return the items that are true.  If sequence
        is a tuple or string, return the same type, else return a list.
        """
        mytype = type(args[1])
        if isinstance(args[1], basestring):
            return mytype().join(builtins.filter(*args))
        elif isinstance(args[1], (tuple, list)):
            return mytype(builtins.filter(*args))
        else:
            # Fall back to list. Is this the right thing to do?
            return list(builtins.filter(*args))

    # This is surprisingly difficult to get right. For example, the
    # solutions here fail with the test cases in the docstring below:
    # http://stackoverflow.com/questions/8072755/
noniterators.py 文件源码 项目:UMOG 作者: hsab 项目源码 文件源码 阅读 36 收藏 0 点赞 0 评论 0
def oldfilter(*args):
        """
        filter(function or None, sequence) -> list, tuple, or string

        Return those items of sequence for which function(item) is true.
        If function is None, return the items that are true.  If sequence
        is a tuple or string, return the same type, else return a list.
        """
        mytype = type(args[1])
        if isinstance(args[1], basestring):
            return mytype().join(builtins.filter(*args))
        elif isinstance(args[1], (tuple, list)):
            return mytype(builtins.filter(*args))
        else:
            # Fall back to list. Is this the right thing to do?
            return list(builtins.filter(*args))

    # This is surprisingly difficult to get right. For example, the
    # solutions here fail with the test cases in the docstring below:
    # http://stackoverflow.com/questions/8072755/
noniterators.py 文件源码 项目:beepboop 作者: nicolehe 项目源码 文件源码 阅读 28 收藏 0 点赞 0 评论 0
def oldfilter(*args):
        """
        filter(function or None, sequence) -> list, tuple, or string

        Return those items of sequence for which function(item) is true.
        If function is None, return the items that are true.  If sequence
        is a tuple or string, return the same type, else return a list.
        """
        mytype = type(args[1])
        if isinstance(args[1], basestring):
            return mytype().join(builtins.filter(*args))
        elif isinstance(args[1], (tuple, list)):
            return mytype(builtins.filter(*args))
        else:
            # Fall back to list. Is this the right thing to do?
            return list(builtins.filter(*args))

    # This is surprisingly difficult to get right. For example, the
    # solutions here fail with the test cases in the docstring below:
    # http://stackoverflow.com/questions/8072755/
noniterators.py 文件源码 项目:hackathon 作者: vertica 项目源码 文件源码 阅读 26 收藏 0 点赞 0 评论 0
def oldfilter(*args):
        """
        filter(function or None, sequence) -> list, tuple, or string

        Return those items of sequence for which function(item) is true.
        If function is None, return the items that are true.  If sequence
        is a tuple or string, return the same type, else return a list.
        """
        mytype = type(args[1])
        if isinstance(args[1], basestring):
            return mytype().join(builtins.filter(*args))
        elif isinstance(args[1], (tuple, list)):
            return mytype(builtins.filter(*args))
        else:
            # Fall back to list. Is this the right thing to do?
            return list(builtins.filter(*args))

    # This is surprisingly difficult to get right. For example, the
    # solutions here fail with the test cases in the docstring below:
    # http://stackoverflow.com/questions/8072755/
noniterators.py 文件源码 项目:yatta_reader 作者: sound88 项目源码 文件源码 阅读 29 收藏 0 点赞 0 评论 0
def oldfilter(*args):
        """
        filter(function or None, sequence) -> list, tuple, or string

        Return those items of sequence for which function(item) is true.
        If function is None, return the items that are true.  If sequence
        is a tuple or string, return the same type, else return a list.
        """
        mytype = type(args[1])
        if isinstance(args[1], basestring):
            return mytype().join(builtins.filter(*args))
        elif isinstance(args[1], (tuple, list)):
            return mytype(builtins.filter(*args))
        else:
            # Fall back to list. Is this the right thing to do?
            return list(builtins.filter(*args))

    # This is surprisingly difficult to get right. For example, the
    # solutions here fail with the test cases in the docstring below:
    # http://stackoverflow.com/questions/8072755/
__init__.py 文件源码 项目:hakkuframework 作者: 4shadoww 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
def lfilter(*args, **kwargs):
        return list(filter(*args, **kwargs))
pandas_py3k.py 文件源码 项目:packaging 作者: blockstack 项目源码 文件源码 阅读 35 收藏 0 点赞 0 评论 0
def lfilter(*args, **kwargs):
        return list(filter(*args, **kwargs))
__init__.py 文件源码 项目:packaging 作者: blockstack 项目源码 文件源码 阅读 28 收藏 0 点赞 0 评论 0
def lfilter(*args, **kwargs):
        return list(filter(*args, **kwargs))
__init__.py 文件源码 项目:islam-buddy 作者: hamir 项目源码 文件源码 阅读 26 收藏 0 点赞 0 评论 0
def lfilter(*args, **kwargs):
        return list(filter(*args, **kwargs))
__init__.py 文件源码 项目:PyDataLondon29-EmbarrassinglyParallelDAWithAWSLambda 作者: SignalMedia 项目源码 文件源码 阅读 28 收藏 0 点赞 0 评论 0
def lfilter(*args, **kwargs):
        return list(filter(*args, **kwargs))
__init__.py 文件源码 项目:FightstickDisplay 作者: calexil 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def lfilter(*args, **kwargs):
        return list(filter(*args, **kwargs))
__init__.py 文件源码 项目:cryptogram 作者: xinmingzhang 项目源码 文件源码 阅读 27 收藏 0 点赞 0 评论 0
def lfilter(*args, **kwargs):
        return list(filter(*args, **kwargs))
__init__.py 文件源码 项目:Repobot 作者: Desgard 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def lfilter(*args, **kwargs):
        return list(filter(*args, **kwargs))
__init__.py 文件源码 项目:UMOG 作者: hsab 项目源码 文件源码 阅读 32 收藏 0 点赞 0 评论 0
def lfilter(*args, **kwargs):
        return list(filter(*args, **kwargs))
__init__.py 文件源码 项目:blackmamba 作者: zrzka 项目源码 文件源码 阅读 30 收藏 0 点赞 0 评论 0
def lfilter(*args, **kwargs):
        return list(filter(*args, **kwargs))
__init__.py 文件源码 项目:beepboop 作者: nicolehe 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
def lfilter(*args, **kwargs):
        return list(filter(*args, **kwargs))
__init__.py 文件源码 项目:hackathon 作者: vertica 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
def lfilter(*args, **kwargs):
        return list(filter(*args, **kwargs))
__init__.py 文件源码 项目:yatta_reader 作者: sound88 项目源码 文件源码 阅读 26 收藏 0 点赞 0 评论 0
def lfilter(*args, **kwargs):
        return list(filter(*args, **kwargs))


问题


面经


文章

微信
公众号

扫码关注公众号