Wrapper for itertools.zip_longest

  • Share this:

Code introduction


This function is a wrapper for `itertools.zip_longest`, which combines multiple iterable objects into an iterator. If one of the iterable objects is shorter, it is filled with `fillvalue`.


Technology Stack : itertools

Code Type : Function

Code Difficulty : Intermediate


                
                    
def zip_longest(*args, fillvalue=None):
    from itertools import zip_longest as zip_longest_itertools

    def zip_longest(*args, fillvalue=None):
        return zip_longest_itertools(*args, fillvalue=fillvalue)

    return zip_longest                
              
Tags: