Consider the following code:

0 = 42
print 0

If you write it into sage's ipython, it of course gives you an error. More 
precisely, you get 
ValueError: The name "0" is not a valid Python identifier.

But suppose you write it into a file bug.sage, and execute it using sage 
bug.sage, you get 42! The explanation is actually pretty simple: when you 
execute sage bug.sage, bug.sage is preparsed to bug.sage.py which is the 
following:

# This file was *autogenerated* from the file bug.sage
from sage.all_cmdline import *   # import sage library

_sage_const_42 = Integer(42); _sage_const_0 = Integer(0)
_sage_const_0  = _sage_const_42 
print _sage_const_0 


Since 0 is replaced by _sage_const_0, you can affect any value to it. 

Is this a known bug? Is there a way in Python to declare that _sage_const_i 
is immutable?

I wanted to open a ticket, but as noticed by Dima, trac seems to be down...

Bruno


-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.

Reply via email to