Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

How does SageMath assign to a function call without raising an exception?

I can assign some functions to a function call like this:

sage: f(x) = cos(x)

But I can't assign other functions like this:

sage: f(x) = lambda x: 1

which happens to raise a different exception in Python:

>>> f(x) = lambda x: 1
SyntaxError: can't assign to function call

So, how does the SageMath interpreter change the behavior of Python?