Last active
October 28, 2015 04:54
-
-
Save nirum/32cc4866fa5311d04c64 to your computer and use it in GitHub Desktop.
classes in python
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
class Foo(object): | |
def __init__(self, data): | |
self.data = data | |
self.shape = self.data.shape | |
def __getitem__(self, index): | |
return self.data[index] ** 2 | |
def __dir__(self): | |
return ['data'] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment