The checking in symbolic rings should be moved to sage.repl.user_globals 
and hooked into set_global.

As for part 2, "None" is not a reserved keyword in Python2 so its in 
principle perfectly legal to use as identifier. Though it was later on 
specifically disallowed to assign to None, but assignment to True/False is 
still possible. This is fixed in Python3 where None, True, False become 
keywords.

We should probably exclude Python builtin names for that as well, i.e. 
dir(__builtin__), not because its not legal but because its mighty 
confusing to redefine int/str/id/all/...





On Sunday, May 10, 2015 at 10:26:25 PM UTC+2, vdelecroix wrote:
>
> Hello, 
>
> What should we do with variable names like 'or', 'and', ... This does 
> not break uniformly 
>
> The symbolic ring refuses the creation of such variable 
> {{{ 
> sage: SR.var('and') 
> Traceback (most recent call last): 
> ... 
> ValueError: The name "and" is not a valid Python identifier. 
> }}} 
>
> whereas polynomial rings silently fail 
> {{{ 
> sage: R = PolynomialRing(QQ, ('and', 'or')) 
> sage: R.inject_variables() 
> Defining and, or 
> sage: and 
> ... 
> SyntaxError: invalid syntax 
> sage: 'and' in globals() 
> True 
> }}} 
>
> Vincent 
>

-- 
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 http://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.

Reply via email to