emilberwald / mathematics

1 stars 0 forks source link

operators #3

Open emilberwald opened 6 years ago

emilberwald commented 6 years ago

perhaps instead of a class variable in clifford, radd and rmatmul and trace should be overloaded? so several bilinear products can be used?

emilberwald commented 6 years ago

or perhaps a method that returns the type created based on the argument?

perhaps a copy constructor like this? https://stackoverflow.com/a/27441776/3021108

emilberwald commented 6 years ago

Another option is to create a class factory

https://stackoverflow.com/questions/4858298/python-3-class-template-function-that-returns-a-parameterized-class

def subclass(name,superclasses,**kwargs): T=type(name,superclasses,kwargs) if name in globals(): return globals()[name] else: globals()[name]=T or something. Perhaps dynamically create the name. Perhaps the internal name does not matter.