#16971: Notebook does not complain on assignment to literal
-------------------------+-------------------------------------------------
   Reporter:  gagern     |            Owner:
       Type:  defect     |           Status:  new
   Priority:  major      |        Milestone:  sage-6.4
  Component:  notebook   |         Keywords:  assignment silent syntax
  Merged in:             |  preparse
  Reviewers:             |          Authors:
Work issues:             |  Report Upstream:  N/A
     Commit:             |           Branch:
   Stopgaps:             |     Dependencies:
-------------------------+-------------------------------------------------
 In the sage notebook (from Sage 6.2) I can write the following things
 without seeing an exception:

 {{{
 1 = 2
 foo = 1 = 2
 }}}

 On the command line, these correctly complain:

 {{{
 sage: 1 = 2
 ValueError: The name "1" is not a valid Python identifier.
 sage: foo = 1 = 2
 SyntaxError: can't assign to function call
 }}}

 But in the notebook, these apparently get executed, since at the end the
 variable `foo` has the value `2`. So it seems that the notebook does more
 than `preparse` indicates. I see no modification of global literals, but
 even so silently ignoring such errors seems like pretty bad style.
 Particular since proffesional mathematicians but novice programmers might
 tend to place `=` signs in places we don't expect them to.

--
Ticket URL: <http://trac.sagemath.org/ticket/16971>
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 unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-trac.
For more options, visit https://groups.google.com/d/optout.

Reply via email to