I didn't.

I like the idea.



Thanks,


L.


2008/7/1 Michael Sorich <[EMAIL PROTECTED]>:
> With regard to R indexing on the objects have you thought about using
> the __getitem__ method of an attribute.
>
> E.g. python indexing m[:,1], r indexing m.r[:,2]
>
> class RIndex(object):
>    def __init__(self, parent):
>        self.parent = parent
>
>    def __getitem__(self, index):
>        return self.parent.subset(index)
>
>    def __setitem__(self, index, value):
>        #pass
>
> class RObject:
>
>    def __init__(self, robj):
>        self.r = RIndex(self)
>
>
>> I have contemplated the idea of having the method 'subset' defined above
>> in place of the python method '__getitem__'... but I ultimately found
>> it error-prone.
>> Features like R indexes starting at one, and Python indexes starting
>> at zero for example
>> made me prefer two separate method to access items: the Python one (that 
>> behaves
>> the way a Python programmer is used to), and the R one.
>> My current dissatisfaction is with the name 'subset' (as it reminds of
>> the R-base function
>> subset, and it is annoyingly longer that the "[" operator __getitem__
>> benefits from).
>>
>>
>> L.
>>
>>
>>> Thanks,
>>>
>>> Laurent
>>>
>>> -------------------------------------------------------------------------
>>> Check out the new SourceForge.net Marketplace.
>>> It's the best place to buy or sell services for
>>> just about anything Open Source.
>>> http://sourceforge.net/services/buy/index.php
>>> _______________________________________________
>>> rpy-list mailing list
>>> rpy-list@lists.sourceforge.net
>>> https://lists.sourceforge.net/lists/listinfo/rpy-list
>>>
>>>
>>
>> -------------------------------------------------------------------------
>> Check out the new SourceForge.net Marketplace.
>> It's the best place to buy or sell services for
>> just about anything Open Source.
>> http://sourceforge.net/services/buy/index.php
>> _______________________________________________
>> rpy-list mailing list
>> rpy-list@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/rpy-list
>>
>
> -------------------------------------------------------------------------
> Check out the new SourceForge.net Marketplace.
> It's the best place to buy or sell services for
> just about anything Open Source.
> http://sourceforge.net/services/buy/index.php
> _______________________________________________
> rpy-list mailing list
> rpy-list@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/rpy-list
>

-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
rpy-list mailing list
rpy-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rpy-list

Reply via email to