On 19/03/18 15:06, Nicolas M. Thiery wrote:
On Thu, Mar 15, 2018 at 08:49:02AM -0700, William Stein wrote:
On Thu, Mar 15, 2018 at 7:43 AM, Emmanuel Charpentier
<emanuel.charpent...@gmail.com> wrote:
[...] However, most CASes now available do away without this mandatory
declaration.
And hence Sage should have automatic_names as a non-default *option*.
Yeah; it's all a balance between simplicity vs risk of confusion. From
using, teaching, and witnessing people teach SageMath, there are some
contexts where you (or more likely your teacher!) know what you are
doing, there is no risk of confusion, and simplicity primes. Most of
the time we don't want it though. So +1 as well on automatic_names as
an option not set by default. Also +1 on the message when a variable
is created.
Finally, I could suggest to write it as:
%automatic_names
to highlight that this is a magic command that alters the behavior of
the interpreter.
This is (similar to) the behavior of the IPython's built-in magic
command 'autocall', which allows calling functions without having to
type parentheses. For example:
sage: %autocall
Automatic calling is: Smart
sage: pow 3, 4
----> pow(Integer(3), Integer(4))
81
So I find the above suggestion of automatic_names to be consistent, at
least in this regard.
This lead me to discover a bug that arrives from the combination of the
Sage preparser and Python's int(). The following works:
sage: %autocall 2
Automatic calling is: Full
But without the "%" character, which is allowed because we have
%automagic on by default, it breaks:
sage: autocall 2
[snip]
sage/local/lib/python2.7/site-packages/IPython/core/magics/auto.pyc in
autocall(self, parameter_s)
108
109 if parameter_s:
--> 110 arg = int(parameter_s)
111 else:
112 arg = 'toggle'
ValueError: invalid literal for int() with base 10: 'Integer(2)'
Obviously, it does work without the preparser, or with
sage: autocall 2r
Regards,
TB
--
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 https://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.