On 1/19/10 12:46 PM, Luca Beltrame wrote:
> Hello again,
>
> the porting of the code is getting along nicely (thanks to the help in this
> ML), and I've got more questions on the way.
>
> In particular, how is the case of attrs(object, value) handled? In Python a
> function can't be an expression, so this can pose an issue when porting code
> that uses it. I read on the rinterface docs that do_slots_assign could be
> used, but I'm not sure if it's the right way to go.

I am not sure to follow you about "In Python a function can't be an 
expression".
The method "do_slots_assign" should able to set attributes.


> Likewise, I have a question on the *apply functions. Usually I *don't* use
> them (as I have equivalents in Python that are faster to use) but for certain
> specific objects they are required. As you can't really pass a Python function
> there, should I just use the "r" instance to generate a function and pass it
> like that? Example:

Passing Python function should be possible (but that would be for 
release 2.2, most likely).

> my_function = ro.r("my_function (x)<- do_something_there")
> base.apply(data_structure, 1, my_function)
>
> Or is there a better way?

Here "better" is context-dependent, I suppose.

If my_function can be written in Python, one option is:

m = data_structure
res = [ my_function( m.rx(i+1, True) )for i in xrange(m.nrow) ]


L.



> Thanks!
>
>
>
> ------------------------------------------------------------------------------
> Throughout its 18-year history, RSA Conference consistently attracts the
> world's best and brightest in the field, creating opportunities for Conference
> attendees to learn about information security's most important issues through
> interactions with peers, luminaries and emerging and established companies.
> http://p.sf.net/sfu/rsaconf-dev2dev
>
>
>
> _______________________________________________
> rpy-list mailing list
> rpy-list@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/rpy-list


------------------------------------------------------------------------------
Throughout its 18-year history, RSA Conference consistently attracts the
world's best and brightest in the field, creating opportunities for Conference
attendees to learn about information security's most important issues through
interactions with peers, luminaries and emerging and established companies.
http://p.sf.net/sfu/rsaconf-dev2dev
_______________________________________________
rpy-list mailing list
rpy-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rpy-list

Reply via email to