Created
January 3, 2013 13:55
-
-
Save briandailey/4443624 to your computer and use it in GitHub Desktop.
cycling an uninstantiated class variable
This file contains hidden or 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
| >>> from itertools import cycle | |
| >>> class Foo(object): | |
| ... c = cycle(['1', '2']) | |
| ... | |
| >>> Foo.c | |
| <itertools.cycle object at 0x1004690e0> | |
| >>> Foo.c.next() | |
| '1' | |
| >>> Foo.c.next() | |
| '2' | |
| >>> Foo.c.next() | |
| '1' | |
| >>> Foo.c.next() | |
| '2' | |
| >>> Foo.c.next() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment