Accept None (in addition to True or False) as empty subscript

Issue #76 resolved
Dav Clark created an issue

This is a minor, perhaps bikeshedding suggestion. But using None seems a lot more analogous to no index in expressions of the form

my_python_var_thats_an_R_array.rx(True, 1)

means

an.R.array[,1]

You could use None instead of True there and it'd make more sense (to me).

Comments (2)

  1. Laurent Gautier

    This a question I asked myself. I felt that it was ambiguous to map None to missing parameters (R also has a NULL that could be translated to None, and the missing argument does have a value at the C level) so I kept it explicit for now.

    You could do:

    from rpy2.rinterface import MissingArg
    Nil = MissingArg
    
    my_python_var_thats_an_R_array.rx(Nil, 1)
    
  2. Dav Clark reporter

    (Reply via davc...@gmail.com):

    Thanks for the idea! But, having to remember that is even harder than remembering to use True. So, I'll stick with that.

    Dav

  3. Log in to comment