As a first suggestion, if you want to create a SymPy object, I would
suggest to inherit from sympy.core.basic.Basic, something like this:
class YourClass(Basic):
# constructor:
def __new__(cls, arg1, arg2, ... ):
obj = Basic.__new__(cls, arg1, arg2, ... )
return obj
@property
def arg1(self):
return self.args[0]
@property
def arg2(self):
return self.args[1]
An alternative would be to put *obj._arg1 = arg1* in the constructor, the
*return
self._arg1* in the properties.
In this way, some functions such as __eq__ and __hash__ will be
automatically defined, __eq__ will compare the constructor arguments, and
it's probably going to be more efficient, as SymPy's core uses hashes.
On Friday, January 16, 2015 at 11:49:13 AM UTC+1, [email protected] wrote:
>
> I've put it on github: https://github.com/warpfel/PyLie
>
>
> Am Donnerstag, 15. Januar 2015 19:25:16 UTC+1 schrieb Francesco Bonazzi:
>>
>> OK that's nice. I think you had better post your code on github, it
>> offers some advantages, such as commenting code on the lines.
>
>
--
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 post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sympy.
To view this discussion on the web visit
https://groups.google.com/d/msgid/sympy/9ba3b03d-5198-4318-a1ab-0c10bfaf45bf%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.