On Fri, Mar 4, 2011 at 12:45 AM, Simon King <simon.k...@uni-jena.de> wrote: > Hi Robert, > > On 4 Mrz., 09:30, Robert Bradshaw <rober...@math.washington.edu> > wrote: >> So one would have to do >> >> alpha=var("α", validate_name=False) >> >> to avoid an error? > > Yes, that was the idea. > >> Also, I'd still like to avoid >> >> var("[]", ...) >> >> working at all. We could accept all valid Python3 identifiers, and >> print a warning if we were unable to insert them into the global >> namespace, e.g. they're not valid Python2 identifiers. (The warning >> could be suppressed if one did, say, var("α", inject=False).) > > How to test whether something is a valid identifier in Python3? I > don't know.
Fortunately, Python is open source :) I can't imagine it would be that hard to figure out. > And what shall we do with reserved keywords like "def"? Should > var("def") always result in an error (probably not), or should it just > not be injected into the global name space? Hence, a warning is > printed unless it is var('def',inject=False)? Yep, that'd what I was thinking. - Robert -- To post to this group, send an email to sage-devel@googlegroups.com To unsubscribe from this group, send an email to sage-devel+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-devel URL: http://www.sagemath.org