What is the difference between two ways to instantiate a variable?

29 views
Skip to first unread message

Jim Mooney

unread,
May 4, 2017, 7:02:11 PM5/4/17
to sage-support
Why do I sometimes see just var('y') and other times see y = var('y')? The result seems to be the same since I can use y in either case.

Nils Bruin

unread,
May 5, 2017, 1:05:27 AM5/5/17
to sage-support
On Thursday, May 4, 2017 at 4:02:11 PM UTC-7, Jim Mooney wrote:
Why do I sometimes see just var('y') and other times see y = var('y')? The result seems to be the same since I can use y in either case.

See the doc of SR.var and var.

y=SR.var('y')

is the "fundamental" construct, and assignment is required.

For interactive use, `var("y")` can be used. It needs some dark magic to inject the bindings. `y=var('y")` basically binds y twice. It's a matter of taste which you prefer.
Reply all
Reply to author
Forward
0 new messages