There are several ways to implement properties of sympy objects. The
simplest one is:
```
def __new__(*args):
    obj = Basic(*args)
    obj.prop = 'some_property'
```
A slightly more complicated one is:
```
def __new__(*args):
    obj = Basic(*args)
    obj._prop = 'some_property'

@property
def prop(self):
    return self._prop
```

The first method is simpler and shorter, but the second one explicitly
forbids assignments `obj.prop = ...`. I have tried looking into various
sympy modules and the practices are different. Which implementation is
preferable? And on a more general topic, is there a "coding guidelines"
webpage, where issues like this should be resolved once and for all? Maybe
it makes sense to create one? I believe it will improve both the code and
user experience.

Best Regards,
Denys Rybalka

-- 
You received this message because you are subscribed to the Google Groups 
"sympy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sympy/CAOsx_LqFFGo9wifF30QC8sT%3DYutaEcj6aYPNU7Tt154ZbPnD2w%40mail.gmail.com.

Reply via email to