Created
February 17, 2016 19:28
-
-
Save ehermes/81e98a61caa285707810 to your computer and use it in GitHub Desktop.
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
| #!/usr/bin/env python | |
| from __future__ import print_function, division | |
| class MultiplyBy(object): | |
| def __init__(self, n): | |
| self.n = n | |
| def __getitem__(self, i): | |
| return self.n * i | |
| multiply_by_two = MultiplyBy(2) | |
| print(multiply_by_two[7]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment