On Tue, Jun 15, 2010 at 8:26 AM, Nicolas M. Thiery
<nicolas.thi...@u-psud.fr> wrote:
> I have a question about passing down strings to functions of other
> systems. For (a stupid) example, if I want to concatenate two strings
> in GAP, I need to do:
>
>    sage: gap.Concatenation("\"foo\"", "\"bar\"")
>    foobar

Or

sage: gap.Concatenation('"foo"', '"bar"')

> Is there a reason that we can't just do the natural:
>
>    sage: gap.Concatenation("foo", "bar")
>    foobar

Currently, strings are passed directly down to the interfaces.  So, if
you had two strings stored in the variables f and g in the GAP
session, doing

gap.Concatenation("f", "g")

would return the concatenation of those to string as opposed to "fg".
However, one could get a similar effect with

gap.Concatenation(gap.f, gap.g)

That only works for things where the underlying thing has a name which
is a valid Python identifier.  You could instead want to do

gap.Concatenation(gap("f") gap("g"))

but then you might expect those to be strings too.

There is already a ticket for this at
http://trac.sagemath.org/sage_trac/ticket/2963 . The main reason it
isn't done is that it could break a lot of existing code, but we could
try to come up with a transition plan.

--Mike

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