On Sat, 8 Oct 2016, Emmanuel Charpentier wrote:
I wonder if it is possible to patch a new method in an existing class.
TypeError: can't set attributes of built-in/extension type 'sage.symbolic.ex pression.Expression'
AFAIK it is impossible due to limitations of Python. You can patch classes not defined in C, like
type(Graph()).is_eulerian_and_hamiltonian = lambda self: self.is_eulerian() and self.is_hamiltonian() but that won't work for example to Sage integers. -- Jori Mäntysalo
