-
-
Notifications
You must be signed in to change notification settings - Fork 713
Open
Description
At https://groups.google.com/forum/?fromgroups=#!topic/sage-devel/EQzNB7vkN3o , a user tries this:
sage: t=(1,2,3)
sage: type(t)
tuple
sage: len(t)
3
sage: len(t)=4
sage: t
t
sage: type(t)
sage.symbolic.expression.Expression
This strange behavior is because of the preparser:
sage: preparse('len(t) = 4')
'__tmp__=var("t"); len = symbolic_expression(Integer(4)).function(t)'
I propose that when the preparser is about to redefine a Python built-in function, we issue a warning. This will allow users to clobber the builtins, but also tell them they are possibly doing something unwise.
CC: @jasongrout
Component: user interface
Keywords: symbolic preparser builtin built-in
Author: Dan Drake
Issue created by migration from https://trac.sagemath.org/ticket/14231