Exposing the visibility global flag R_Visible is definitely making sense 
(since functions returning "invisibly" is something R-ish)

However, I think that the check that R_Visible is FALSE should occur 
after the call to Rf_eval has been made. In R, something returned 
"invisibly" is only returned if there is a left side to an assign 
function call. For a start, having this as a read-only variable from 
Python might also be enough.

The following snapshot from an R console should make it explicit
 > foo <- get("<-")
 > foo("x", 123) # return invisibly its result
 > x
[1] 123
 > y <- foo("x", 123)
 > y
[1] 123

Right now having R_Visible as a global is ok for 2.0.x, but for 2.1.x I 
will be considering whether a call to an invisibly returning function 
should return None to Python, or else (visibility attribute with the 
returned objects, etc...).

Otherwise, I had a quick look at R's gnomeGUI and it seems that only 
read and write callbacks are doing the trick for console I/O.
May be something to investigate.



L.



Nathaniel Smith wrote:
> On Mon, Mar 2, 2009 at 5:06 PM, Carson Farmer <carson.far...@gmail.com> wrote:
>>> This has been annoying me too, so I had a quick look... apparently the
>>> (totally awesome) API for this is that you set the global variable
>>> R_Visible to FALSE before calling Rf_eval, and then you check it
>>> afterwards to see if the return value should be printed.
>> hmmm, so is this something I can implement myself, or something the good
>> folks at rpy2 have to consider for implementation?
>> I don't have much experience with the R API (pretty much zero actually), but
>> I would really like to have auto-print functionality, so I don't mind having
>> a crack at this if I can ;-)
> 
> It would need changes to rpy2, yeah, because it's a C API that rpy2
> doesn't currently expose. So send a request in triplicate to Rpy2
> World Headquarters, marked "Attn: Undersecretary of Evaluation",
> and...
> 
> ...no, wait, I got confused. rpy2 is just the folks on the list and a
> source code repository, so if you want to submit a patch, then go for
> it, and then you can be an "rpy2 folk" too ;-). (Or I might do it next
> week if I have some time, not sure.)
> 
> -- Nathaniel


------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________
rpy-list mailing list
rpy-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rpy-list

Reply via email to