On 25/02/11 18:59, Artur Wroblewski wrote:
> On Fri, Feb 25, 2011 at 5:25 PM, Laurent<lgaut...@gmail.com>  wrote:
>> On 24/02/11 11:26, Artur Wroblewski wrote:
> [...]
>>> In Python
>>>
>>>      >>>    (1, None, 2, None, 3)
>>>      (1, None, 2, None, 3)
>>>
>>> In R
>>>
>>>      >    c(1, NULL, 2, NULL, 3)
>>>      [1] 1 2 3<- NULL is removed, by default
>>>
>>>      >    c(1, NA, 2, NA, 3)
>>>      [1]  1 NA  2 NA  3<- NA is kept, by default
>>
>>
>> There are places where some people can see R as counter-intuitive, and I
>> think that this is one such place. Although Python-None seems closer to
>> C-Null and R-NULL, the behaviour you describe is what made me have None in
>> the list passed to the constructor raise an exception: better explicit than
>> implicit when confusion can occur.
>> Rather than None, one should be using one of the
>> rpy2.rinterface.NA_<whatever>.
>
> I assume, that while using Python, in his/her code, everyone is going to use
> None.

I am not sure about that. I believe that generally one would populate a 
list built in upstream code what they think will be useful in downstream 
code (here a call to a constructor for <Whatever>Vector).

  I do no understand why rpy cannot change None to NA during
> conversion to a vector (by default or with some parameter).

Because None is conceptually closer to Python-NULL and C-Null, rather 
than the idea of a missing value (that point of view seems to be, at 
least in parts, shared by array and numpy)

 >>> import array
 >>> array.array('i', (1, None, 3))
Traceback (most recent call last):
   File "<stdin>", line 1, in <module>
TypeError: an integer is required



Cheers,

Laurent

> Best regards,
>
> Artur
>
> ------------------------------------------------------------------------------
> Free Software Download: Index, Search&  Analyze Logs and other IT data in
> Real-Time with Splunk. Collect, index and harness all the fast moving IT data
> generated by your applications, servers and devices whether physical, virtual
> or in the cloud. Deliver compliance at lower cost and gain new business
> insights. http://p.sf.net/sfu/splunk-dev2dev
> _______________________________________________
> rpy-list mailing list
> rpy-list@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/rpy-list


------------------------------------------------------------------------------
Free Software Download: Index, Search & Analyze Logs and other IT data in 
Real-Time with Splunk. Collect, index and harness all the fast moving IT data 
generated by your applications, servers and devices whether physical, virtual
or in the cloud. Deliver compliance at lower cost and gain new business 
insights. http://p.sf.net/sfu/splunk-dev2dev 
_______________________________________________
rpy-list mailing list
rpy-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rpy-list

Reply via email to