Actually in example:
```python
class MyClass:
@my_property
name = arg
class MyClass:
def name(self):
...
def see_name(self):
...
```
I have done mistake ... of course it will not be like this ...
What I wanted to show that @my_property could add more complex behavior than
just small wrapper in one line
For example:
```python
# Module a.py
class SomeFactory:
def __init__(self, cls):
self.cls = cls
def build_context(self):
return context
def factory(name, value, self, cls):
return SomeFactory(cls)
# Module b.py
class MyClass:
@factory
name = arg
```
And so one ... also could be added optionally logging to track each time when
somebody read property:
```python
# Module b.py
class MyClass:
@logging # Help to track each time when somebody access property
@factory
name = arg
```
I see lots of use-cases for property decorators ...
_______________________________________________
Python-ideas mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at
https://mail.python.org/archives/list/[email protected]/message/FY57MAJYDSKZ4DQVRAKG2K6XA7BQ6PC4/
Code of Conduct: http://python.org/psf/codeofconduct/