Created
June 8, 2019 16:35
-
-
Save jeetsukumaran/9c33e7fdb0ae4b2cc6104e779f0e47a1 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 | |
| # -*- coding: utf-8 -*- | |
| class A(object): | |
| def __init__(self): | |
| self._foo = None | |
| def foo(): | |
| doc = "The foo property." | |
| def fget(self): | |
| return self._foo | |
| def fset(self, value): | |
| self._foo = value | |
| def fdel(self): | |
| del self._foo | |
| return locals() | |
| foo = property(**foo()) | |
| a = A() | |
| print(a.foo) | |
| a.foo = "hello" | |
| print(a.foo) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment