Revision: 691
http://rpy.svn.sourceforge.net/rpy/?rev=691&view=rev
Author: lgautier
Date: 2008-11-12 19:31:55 +0000 (Wed, 12 Nov 2008)
Log Message:
-----------
moved rpy2.RObject.__repr__() to rpy2.RObject.r_repr().
(preventing mishaps with endless text dumps when working interactively
with large objects)
Modified Paths:
--------------
rpy2/branches/version_2.0.x/NEWS
rpy2/branches/version_2.0.x/doc/source/robjects.rst
rpy2/branches/version_2.0.x/rpy/robjects/__init__.py
rpy2/branches/version_2.0.x/rpy/robjects/tests/testRObject.py
rpy2/branches/version_2.0.x/rpy/robjects/tests/testRobjects.py
Modified: rpy2/branches/version_2.0.x/NEWS
===================================================================
--- rpy2/branches/version_2.0.x/NEWS 2008-11-12 19:04:03 UTC (rev 690)
+++ rpy2/branches/version_2.0.x/NEWS 2008-11-12 19:31:55 UTC (rev 691)
@@ -1,6 +1,12 @@
SVN
===
+Changes
+-------
+
+- :meth:`RObject.__repr__` moved to :meth:`RObject.r_repr`
+
+
Bugs fixed
----------
Modified: rpy2/branches/version_2.0.x/doc/source/robjects.rst
===================================================================
--- rpy2/branches/version_2.0.x/doc/source/robjects.rst 2008-11-12 19:04:03 UTC
(rev 690)
+++ rpy2/branches/version_2.0.x/doc/source/robjects.rst 2008-11-12 19:31:55 UTC
(rev 691)
@@ -119,10 +119,10 @@
The astute reader will quickly realize that R objects named
by python variables can
-be plugged into code through their string representation:
+be plugged into code through their `R` representation:
>>> x = robjects.r.rnorm(100)
->>> robjects.r('hist(%s, xlab="x", main="hist(x)")' %repr(x))
+>>> robjects.r('hist(%s, xlab="x", main="hist(x)")' %x.r_repr())
.. warning::
@@ -510,7 +510,7 @@
.. code-block:: python
- fit = robjects.r('lm(%s)' %repr(fmla))
+ fit = robjects.r('lm(%s)' %fmla.r_repr())
Mapping rpy2 objects to arbitrary python objects
Modified: rpy2/branches/version_2.0.x/rpy/robjects/__init__.py
===================================================================
--- rpy2/branches/version_2.0.x/rpy/robjects/__init__.py 2008-11-12
19:04:03 UTC (rev 690)
+++ rpy2/branches/version_2.0.x/rpy/robjects/__init__.py 2008-11-12
19:31:55 UTC (rev 691)
@@ -134,7 +134,11 @@
s = str.join(os.linesep, s)
return s
- def __repr__(self):
+ def r_repr(self):
+ """ R string representation for an object.
+ This string representation can be used directed
+ in R code.
+ """
return repr_robject(self, linesep='\n')
def rclass(self):
Modified: rpy2/branches/version_2.0.x/rpy/robjects/tests/testRObject.py
===================================================================
--- rpy2/branches/version_2.0.x/rpy/robjects/tests/testRObject.py
2008-11-12 19:04:03 UTC (rev 690)
+++ rpy2/branches/version_2.0.x/rpy/robjects/tests/testRObject.py
2008-11-12 19:31:55 UTC (rev 691)
@@ -18,9 +18,9 @@
del(ri_v)
self.assertEquals(rinterface.INTSXP, ro_v.typeof)
- def testRepr(self):
+ def testR_repr(self):
obj = robjects.baseNameSpaceEnv["pi"]
- s = obj.__repr__()
+ s = obj.r_repr()
self.assertTrue(s.startswith('3.14'))
Modified: rpy2/branches/version_2.0.x/rpy/robjects/tests/testRobjects.py
===================================================================
--- rpy2/branches/version_2.0.x/rpy/robjects/tests/testRobjects.py
2008-11-12 19:04:03 UTC (rev 690)
+++ rpy2/branches/version_2.0.x/rpy/robjects/tests/testRobjects.py
2008-11-12 19:31:55 UTC (rev 691)
@@ -30,7 +30,7 @@
def testEval(self):
# vector long enough to span across more than one line
x = robjects.baseNameSpaceEnv['seq'](1, 50, 2)
- res = robjects.r('sum(%s)' %repr(x))
+ res = robjects.r('sum(%s)' %x.r_repr())
self.assertEquals(625, res[0])
class MappingTestCase(unittest.TestCase):
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
rpy-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/rpy-list