On Mar 29, 11:49 am, Jason Grout <jason-s...@creativetrax.com> wrote:
> On 3/29/12 10:20 AM, kcrisman wrote:
>
> >> experience is consistent with the initial experience, at the cost of
> >> some possible developer confusion since the default value isn't really
> >> Integers(3)(2), but rather sage_eval(repr(Integers(3)(2))).
>
> > I hope others have some input on this one, which I think is the only
> > really controversial part.  Given the purpose of interacts, I find it
> > hard to imagine that a developer would have sent something like the
> > original example to someone who didn't know what they were doing.
> > Explicit is better than implicit, right...?  But I could imagine some
> > problems.  For instance, what if the Sage object didn't have a repr
> > that was sage_eval-able?  (A common critique of sage vis-a-vis other
> > systems, IIRC.)
>
> So then how would the user enter it in the input box as a changed input?
>   Remember, everything coming from the user is a string (that is usually
> sage_eval'd)

Like a matrix.  Someone could submit an input whose string is just
words about it.  Am I unclear?  Sorry.  I'm still wrapping my head
around all this, and my opinion (as someone who uses interacts a lot
without all the advanced features) are not going to be as useful.


> The example could be rewritten like this to be more consistent:
>
> @interact
> def _(n=2, type=Integers(3)):
>      print n^2
>
> Then Integers(3)(user input) is always run.

Yes.

> Are you asking if we will make the change to interact documentation so
> that the shortcut:
>
> @interact
> def _(n="ABCDE"):
>      print n
>
> is the preferred way to deal with string inputs?  Sure, though sometimes
> we want to explicitly use input_box to set other options (like the width
> of the box).

Naturally.  I just mean that it should be obvious how to avoid all the
horrible things you mention earlier :)

-- 
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

Reply via email to