Opened 13 years ago
Last modified 5 years ago
#2963 new enhancement
R interface: fix passing strings
Reported by: | mhansen | Owned by: | mhansen |
---|---|---|---|
Priority: | major | Milestone: | sage-6.8 |
Component: | interfaces | Keywords: | |
Cc: | Merged in: | ||
Authors: | Reviewers: | ||
Report Upstream: | N/A | Work issues: | |
Branch: | Commit: | ||
Dependencies: | Stopgaps: |
Description
One should be able to do
r.png(file="myplot3.png")
instead of
sage: r.png(file='"myplot3.png"')
Change History (8)
comment:1 follow-up: ↓ 2 Changed 11 years ago by
comment:2 in reply to: ↑ 1 Changed 11 years ago by
Replying to SimonKing:
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
toargs
is needed as well, or if the application tokwds
would be enough.
Sorry, perhaps I misunderstood the role of png: It is just one example, isn't it? But actually you want that in all expect interfaces the transition from 'bla' to '"bla"' is done, right? Then still my suggestion would solve the problem, but I guess the above lambda function should be defined in expect.py on module level, so that there is no need to create the function over and over again.
Then, one would go through all methods of all expect interfaces, and do changes to the arguments, if they might be strings. Wow, that would be much to do! And then I don't know how much performance regression would occur and if that price would be worth to pay for making the input more comfortable.
Cheers, Simon
comment:3 Changed 8 years ago by
- Report Upstream set to N/A
See also #12948, as many many people have asked how to do this in R and we still don't really have a nice solution for this in general.
comment:4 Changed 7 years ago by
- Milestone changed from sage-5.11 to sage-5.12
comment:5 Changed 7 years ago by
- Milestone changed from sage-6.1 to sage-6.2
comment:6 Changed 6 years ago by
- Milestone changed from sage-6.2 to sage-6.3
comment:7 Changed 6 years ago by
- Milestone changed from sage-6.3 to sage-6.4
comment:8 Changed 5 years ago by
- Milestone changed from sage-6.4 to sage-6.8
- Summary changed from make it so that strings pass as arguments and keyword arguments for the expect interfaces are passed down as string. to R interface: fix passing strings
Hi Mike!
Just a quick idea: Couldn't one simply do
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
toargs
is needed as well, or if the application tokwds
would be enough.Regards,