Carson Farmer wrote: > Laurent (et al.), >> 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...). > The output of withVisible in R simply returns a list with a) the > returned value, and b) its visibility: > > > withVisible( a <- c(1, 2, 3, 4, 5, 6) ) > $value > [1] 1 2 3 4 5 6 > > $visible > [1] FALSE > > > withVisible( c(1, 2, 3, 4, 5, 6) ) > $value > [1] 1 2 3 4 5 6 > > $visible > [1] TRUE > > > something similar might be useful in this case as well?
Yes, although it might just be implicit. In the case of implementing a console for an embedded R, looking what is the status of the R C-level global variable R_Visible is going to be enough. An if/else branching will decide whether something is returned to the console or not (just like in the example of a python with_visible() function below). R's withVisible() is returning the result of the function call together with a snapshot of R_Visible upon return (I think - and I am seeing this as a confirmation that R_Visible exposed to Python should be a read-only thing for now). Implementing something like it would be straightforward (example from a global) def with_visible(function, *args, **kwargs): sexp = function(*args, **kwargs) if rpy2.rinterface.r_visible: return sexp else: return None but my concern is over possible object duplication when returning from 'function(*args, **kwargs)' (not necessarily the case, but if something is invisible and I can't get rid of copying this is annoying - I need more thinking about this). Anyway, there is still time to think about it, I don't expect much visibility about a possible schedule for 2.1.0 before weeks. L. > Carson > ------------------------------------------------------------------------------ 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