I think a property decorator can be useful, because you consider the simplest 
case with:
```python
class MyClass:
    @my_property
    name = arg
```
but consider it can generate the following code:
```python
class MyClass:
    def name(self):
        ...

     def see_name(self):
        ...
```
Or consider the following example:
```python
class MyClass:
    @factory
    strategy= arg
```
that can will generate:
```python
class MyClass:
    class MyClassStrategy:
        ...

    strategy= MyClassStrategy(arg)
```

All it will be possible if attribute decorator will have the following 
signature:
```python
def factory(name, value, self, cls):
    # Where name - name of the property
    #            value - initial value of the property
    #            self - instance of created object before call __init__
    #            cls - class object (MyClass)
    ...
```
of course some of properties could be omitted like this:
```python
def factory(name, value, cls):
    # Where name - name of the property
    #            value - initial value of the property
    #            cls - class object (MyClass)
    ...
```

As you can see property decorators could be very powerful thing if it will done 
right ;)
_______________________________________________
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/MCQBK7GRYIUTA5AQAOVMEQNZANXTIDIY/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to