RS4Auto_Type on python3

Issue #272 resolved
Antony Lee
created an issue

Similar to #238: rpy2.robjects.methods still has an use of itertools.izip which should just be replaced by zip. A quick grep also shows uses in rpy/rinterface/tests/test_SexpVectorNumeric.py.

Also, the docs section Automated R-in-Python class definitions could also mention the Python3 metaclass syntax (class Foo(RS4, metaclass=RS4Auto_Type)). It may be easier to provide a base class to hide the metaclass issue from the end user:

if PY2:
    class RS4Auto:
        __metaclass__ = RS4Auto_Type
else:
    class RS4Auto(metaclass=RS4Auto_Type):
        pass

(untested).
Then inheriting from RS4Auto should be enough.

Comments (3)

  1. Laurent Gautier

    Yes. A lot of this was written before I heard about the module six (possibly because it was written before six existed).

    I should clean that up. Feel free to issue a pull request in the meantime.

  2. Log in to comment