Last active
January 21, 2016 05:02
-
-
Save Gohan/46be9ed0f2d01f8df4d3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def new_counter(c): | |
counter = itertools.count(c) | |
def f(): | |
return counter.next() | |
return f; | |
def new_counter(c): | |
counter = itertools.count(c) | |
return lambda x=0:counter.next() | |
class new_counter(itertools.count): | |
def __init__(self, *args, **kwargs): | |
super(new_counter, self).__init__(*args, **kwargs) | |
def __call__(self): | |
return self.next() | |
``` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment