#9724: Sage allows creation of variables with empty name
----------------------------+-----------------------------------------------
   Reporter:  logix         |       Owner:  burcin             
       Type:  defect        |      Status:  new                
   Priority:  minor         |   Milestone:  sage-4.5.3         
  Component:  symbolics     |    Keywords:  variable empty name
     Author:  Harold Gutch  |    Upstream:  N/A                
   Reviewer:                |      Merged:                     
Work_issues:                |  
----------------------------+-----------------------------------------------
 Sage allows you to create a variable with an empty name.  While this at
 first appears not to cause any problems, one thing it does break is
 reset():
 {{{
 sage: var(' ')
 (, )
 sage: whos
 Variable   Type          Data/Info
 ----------------------------------
            Expression
 sage: reset()
 ERROR: An unexpected error occurred while tokenizing input
 The following traceback may be corrupted or invalid
 The error message is: ('EOF in multi-line statement', (437, 0))

 ---------------------------------------------------------------------------
 IndexError                                Traceback (most recent call
 last)

 /usr/local/sage/local/lib/python2.6/site-packages/sage/all_cmdline.pyc in
 <module>()

 /usr/local/sage/local/lib/python2.6/site-packages/sage/misc/reset.so in
 sage.misc.reset.reset (sage/misc/reset.c:838)()

 IndexError: string index out of range
 sage: del globals()['']
 sage: reset()
 }}}
 Sage also allows the creation of variables with other illegal names (e.g.
 '1a' or '1'), but for these at least reset() still works.  There are two
 ways to fix this, the first is to disallow the creation of such variables
 via var(), but then all illegal cases would have to be taken care of, and
 it wouldn't help if you created illegal variables manually by inserting
 them into globals() (but I would argue that if you do this, you're on your
 own anyway).  The second way to fix the behaviour above would be to make
 reset() able to delete empty variables too.  This however is only viable
 if these variables don't break anything else, other than the case
 mentioned above.

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/9724>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica, 
and MATLAB

-- 
You received this message because you are subscribed to the Google Groups 
"sage-trac" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sage-trac?hl=en.

Reply via email to