Created
December 21, 2016 10:22
-
-
Save a-square/cf46fc64d649379ea41c79fd941d8f39 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 python3 | |
class Prop: | |
def __get__(self, instance, owner): | |
return 'foo' | |
class Foo: | |
foo = Prop() | |
x = Foo() | |
x.foo = 'bar' | |
print(x.foo) | |
def set_foo(self, instance, value): | |
pass | |
Prop.__set__ = set_foo | |
print(x.foo) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment