#2963: make it so that strings pass as arguments and keyword arguments for the
expect interfaces are passed down as string.
-------------------------+--------------------------------------------------
Reporter: mhansen | Owner: mhansen
Type: enhancement | Status: new
Priority: major | Milestone: sage-4.1.2
Component: interfaces | Keywords:
Reviewer: | Author:
Merged: |
-------------------------+--------------------------------------------------
Comment(by SimonKing):
Hi Mike!
Just a quick idea:
Couldn't one simply do
{{{
def png(self, *args, **kwds):
...
f = lambda x: x if not isinstance(x,basestring) else ('%s'%x if
x[0]==x[-1]=='"' else '"%s"'%x)
return RFunction(self, 'png')(*[f(x) for x in args],
**dict([(x,f(y)) for x,y in kwds.items()]))
}}}
This would transform any string into a '"string"', unless string starts
and ends with '"' already, and any other input is untouched. In
particular, my suggestion would not break existing code, since
{{{r.png(file='"myplot3.png"')}}} would still be valid.
I don't know in what way png is usually called: Frequently and with many
arguments? Then my suggestion might involve a performance problem. Also I
don't know if the application of {{{f}}} to {{{args}}} is needed as well,
or if the application to {{{kwds}}} would be enough.
Regards,
Simon
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/2963#comment:1>
Sage <http://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 post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/sage-trac?hl=en
-~----------~----~----~----~------~----~------~--~---