[Rpy] [patch] rpy2 tip broken on Unix systems

2009-02-08 Thread Nathaniel Smith
I tracked down that strange "unresolved symbol" error I was getting.
It turns out that rpy2 tip includes a reference to R_ProcessEvents
unconditionally, but in fact R_ProcessEvents is not a portable API.
R_ProcessEvents only exists on Win32 and OS X/Aqua builds of R.

And on OS X, unless someone has used the C api to define a special
hook function, all it does is check R_interrupts_pending. The only
time it really does anything useful is on Win32, and most calls to it
in the R source are protected by #ifdef Win32.

Attached patch stubs out the call to R_ProcessEvents unless defined(Win32).

Built and tested on Linux (after also stubbing out the new device
code, since it fails to compile).

-- Nathaniel


NEW_make-ProcessEvents-windows-only
Description: Binary data
--
Create and Deploy Rich Internet Apps outside the browser with Adobe(R)AIR(TM)
software. With Adobe AIR, Ajax developers can use existing skills and code to
build responsive, highly engaging applications that combine the power of local
resources and data with the reach of the web. Download the Adobe AIR SDK and
Ajax docs to start building applications today-http://p.sf.net/sfu/adobe-com___
rpy-list mailing list
rpy-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rpy-list


[Rpy] [patch] expose R_MissingArg

2009-02-08 Thread Nathaniel Smith
There are several times in R when it is valuable to explicitly leave
an argument missing. For example, when extracting a row from a matrix:

> m <- matrix(1:4, nrow=2)
> m[2]   # Flat indexing
[1] 2
> m[2, ] # Note the comma!
[1] 2 4

However, there is currently no way to support this (rather
idiosyncratic) syntax in rpy2.

The attached patch adds a function rpy2.rinterface.getMissingArgSexp
which returns an Sexp wrapping the magic R_MissingArg object. With
this patch, the following becomes possible:

>>> m = r.matrix([1, 2, 3, 4], nrow=2)
>>> r["["](m, 2, rpy2.rinterface.getMissingArgSexp())

Patch includes tests, which pass for me.

-- Nathaniel


NEW_getMissingArgSexp
Description: Binary data
--
Create and Deploy Rich Internet Apps outside the browser with Adobe(R)AIR(TM)
software. With Adobe AIR, Ajax developers can use existing skills and code to
build responsive, highly engaging applications that combine the power of local
resources and data with the reach of the web. Download the Adobe AIR SDK and
Ajax docs to start building applications today-http://p.sf.net/sfu/adobe-com___
rpy-list mailing list
rpy-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rpy-list


[Rpy] [patch] expose Rf_duplicate

2009-02-08 Thread Nathaniel Smith
The attached patch adds a method ".duplicate" to rinterface.Sexp
objects. When called, it returns a new Sexp that is identical to the
first, but shares no memory with the first. (Underlyingly, it just
calls Rf_duplicate.)

This is useful when you have an Sexp that you want to mutate, but you
also want to correctly preserve R's copy-on-write semantics.

Tests are included, and pass for me.

-- Nathaniel


NEW_expose_Rf_duplicate
Description: Binary data
--
Create and Deploy Rich Internet Apps outside the browser with Adobe(R)AIR(TM)
software. With Adobe AIR, Ajax developers can use existing skills and code to
build responsive, highly engaging applications that combine the power of local
resources and data with the reach of the web. Download the Adobe AIR SDK and
Ajax docs to start building applications today-http://p.sf.net/sfu/adobe-com___
rpy-list mailing list
rpy-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rpy-list


Re: [Rpy] [patch] misc cleanups

2009-02-08 Thread Nathaniel Smith
On Sun, Feb 8, 2009 at 1:40 AM, Nathaniel Smith  wrote:
> This patch just cleans up a few things I noticed while hacking:
>  - The testSexp_sexp_destroyCobj test is a no-op. I'm not sure what
> it's trying to test, but whatever it is, it isn't testing it.
>  - Fix most compile warnings that occur when building rinterface.c
>
> The remaining build warning I get is:
>  rpy/rinterface/rinterface.c:3024: warning: 'externalMethods' defined
> but not used
> which looks to be caused by some stub code... so I left it there.

Patch.

-- Nathaniel


NEW_misc_cleanups
Description: Binary data
--
Create and Deploy Rich Internet Apps outside the browser with Adobe(R)AIR(TM)
software. With Adobe AIR, Ajax developers can use existing skills and code to
build responsive, highly engaging applications that combine the power of local
resources and data with the reach of the web. Download the Adobe AIR SDK and
Ajax docs to start building applications today-http://p.sf.net/sfu/adobe-com___
rpy-list mailing list
rpy-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rpy-list


[Rpy] [patch] misc cleanups

2009-02-08 Thread Nathaniel Smith
This patch just cleans up a few things I noticed while hacking:
 - The testSexp_sexp_destroyCobj test is a no-op. I'm not sure what
it's trying to test, but whatever it is, it isn't testing it.
 - Fix most compile warnings that occur when building rinterface.c

The remaining build warning I get is:
  rpy/rinterface/rinterface.c:3024: warning: 'externalMethods' defined
but not used
which looks to be caused by some stub code... so I left it there.

-- Nathaniel

--
Create and Deploy Rich Internet Apps outside the browser with Adobe(R)AIR(TM)
software. With Adobe AIR, Ajax developers can use existing skills and code to
build responsive, highly engaging applications that combine the power of local
resources and data with the reach of the web. Download the Adobe AIR SDK and
Ajax docs to start building applications today-http://p.sf.net/sfu/adobe-com
___
rpy-list mailing list
rpy-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rpy-list


Re: [Rpy] [patch] rpy2 tip broken on Unix systems

2009-02-08 Thread Laurent Gautier
Nathaniel Smith wrote:
> I tracked down that strange "unresolved symbol" error I was getting.
> It turns out that rpy2 tip includes a reference to R_ProcessEvents
> unconditionally, but in fact R_ProcessEvents is not a portable API.
> R_ProcessEvents only exists on Win32 and OS X/Aqua builds of R.
> 
> And on OS X, unless someone has used the C api to define a special
> hook function, all it does is check R_interrupts_pending. The only
> time it really does anything useful is on Win32, and most calls to it
> in the R source are protected by #ifdef Win32.

R has enough platform-specific twists as it is, so I'd rather stick to 
the unifying effort, even if embryonic, and keep the #ifdef count as low 
as I can.

> Attached patch stubs out the call to R_ProcessEvents unless defined(Win32).
> 
> Built and tested on Linux (after also stubbing out the new device
> code, since it fails to compile).


I am hoping from one platform to the other, so I can have missed 
something, but the rpy2 tip seem to build and run on Linux here. May be 
we should look into what is specific to either my or your configuration
(we can do that off-list).


L.



> -- Nathaniel
> 
> 
> 
> 
> --
> Create and Deploy Rich Internet Apps outside the browser with Adobe(R)AIR(TM)
> software. With Adobe AIR, Ajax developers can use existing skills and code to
> build responsive, highly engaging applications that combine the power of local
> resources and data with the reach of the web. Download the Adobe AIR SDK and
> Ajax docs to start building applications today-http://p.sf.net/sfu/adobe-com
> 
> 
> 
> 
> ___
> rpy-list mailing list
> rpy-list@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/rpy-list


--
Create and Deploy Rich Internet Apps outside the browser with Adobe(R)AIR(TM)
software. With Adobe AIR, Ajax developers can use existing skills and code to
build responsive, highly engaging applications that combine the power of local
resources and data with the reach of the web. Download the Adobe AIR SDK and
Ajax docs to start building applications today-http://p.sf.net/sfu/adobe-com
___
rpy-list mailing list
rpy-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rpy-list


Re: [Rpy] [patch] expose R_MissingArg

2009-02-08 Thread Laurent Gautier
Nathaniel Smith wrote:
> There are several times in R when it is valuable to explicitly leave
> an argument missing. For example, when extracting a row from a matrix:
> 
>> m <- matrix(1:4, nrow=2)
>> m[2]   # Flat indexing
> [1] 2
>> m[2, ] # Note the comma!
> [1] 2 4
> 
> However, there is currently no way to support this (rather
> idiosyncratic) syntax in rpy2.

In the case of extracting elements from a matrix, there is a way
(working in R, as well as in rpy2):

m[2, TRUE] # Note the TRUE !
[1] 2 4


There are otherwise other functions checking for "missing" arguments, 
but I postponed the resolution of that to a post-2.0 release.
(I thought that they are not as frequent at when using "[").

> The attached patch adds a function rpy2.rinterface.getMissingArgSexp
> which returns an Sexp wrapping the magic R_MissingArg object. With
> this patch, the following becomes possible:
> 
 m = r.matrix([1, 2, 3, 4], nrow=2)
 r["["](m, 2, rpy2.rinterface.getMissingArgSexp())
> 
> Patch includes tests, which pass for me.

I'd be more keen on defining the missing magic, as well as NULL and the 
NA_* group as user-immutable objects in a module (rather than functions).

import rpy2.robjects as ro
import rpy2.rinterface.defs as rstuff

# to use your example above
m = ro.r.matrix(ro.IntVector([1,2,3,4]), nrow=2)
ro.r["["](m, 2, rstuff.MISSING)

# but right now the following is already working:
ro.r["["](m, 2, True)


I started looked at how this could happen with the NA_* group, but got 
too busy on the day job otherwise and had to interrupt half-way through.
One point of concern is that that those variables are not valid until R 
is initialized. This is rather easy to solve when considering the use of 
functions such as getNA_REAL() or getMissingArg(), but not when 
considering non-callable objects in a module.

After several (unsuccessful) attempts, I am now seeing the use of a 
module-mimicking class with getters as one way.


L.


> -- Nathaniel
> 
> 
> 
> 
> --
> Create and Deploy Rich Internet Apps outside the browser with Adobe(R)AIR(TM)
> software. With Adobe AIR, Ajax developers can use existing skills and code to
> build responsive, highly engaging applications that combine the power of local
> resources and data with the reach of the web. Download the Adobe AIR SDK and
> Ajax docs to start building applications today-http://p.sf.net/sfu/adobe-com
> 
> 
> 
> 
> ___
> rpy-list mailing list
> rpy-list@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/rpy-list


--
Create and Deploy Rich Internet Apps outside the browser with Adobe(R)AIR(TM)
software. With Adobe AIR, Ajax developers can use existing skills and code to
build responsive, highly engaging applications that combine the power of local
resources and data with the reach of the web. Download the Adobe AIR SDK and
Ajax docs to start building applications today-http://p.sf.net/sfu/adobe-com
___
rpy-list mailing list
rpy-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rpy-list


Re: [Rpy] rpy2 design questions

2009-02-08 Thread Laurent Gautier
Michael Held wrote:
> hi folks,
> 
> coming from rpy I was wondering why rpy2 is trying to make so much
> overhead. I was used to a convenient way of using R from Python, but the
> use of robjects.FloatVector([]) and co in rpy2 is blowing up my code.
> what is the reason for that?

The choice rpy2.robjects was made to go for explicit rather than 
implicit for vectors. In that particular case implicitness has a cost in 
term of performances when working with long lists (all elements must be 
inspected before choosing a type).

> the decoupling of rpy2 and numpy is also hard to understand.

http://rpy.sourceforge.net/rpy2/doc/html/numpy.html#from-numpy-to-rpy2

> I had to change from rpy to rpy2 since I had problems to install rpy for
> R2.8

You could also either make rpy work with R-2.8 (C required), customize 
rpy2 to be the way you like (made easy by design), or use 
rpy2.rpy_classic (that is also an example of easy customization of rpy2).

> sorry for bothering you guys. I just wondered what the reason for this
> extra layer of inconvenience is...

Did I miss something, or is there no real inconvenience ?



L.




> cheers
> mike
> 
> --
> Create and Deploy Rich Internet Apps outside the browser with Adobe(R)AIR(TM)
> software. With Adobe AIR, Ajax developers can use existing skills and code to
> build responsive, highly engaging applications that combine the power of local
> resources and data with the reach of the web. Download the Adobe AIR SDK and
> Ajax docs to start building applications today-http://p.sf.net/sfu/adobe-com
> ___
> rpy-list mailing list
> rpy-list@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/rpy-list


--
Create and Deploy Rich Internet Apps outside the browser with Adobe(R)AIR(TM)
software. With Adobe AIR, Ajax developers can use existing skills and code to
build responsive, highly engaging applications that combine the power of local
resources and data with the reach of the web. Download the Adobe AIR SDK and
Ajax docs to start building applications today-http://p.sf.net/sfu/adobe-com
___
rpy-list mailing list
rpy-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rpy-list


Re: [Rpy] [patch] numpy.asarray(SexpVector([...], LGLSXP)) fails

2009-02-08 Thread Laurent Gautier
Thanks for your patch.


I had to replace in test_SexpVectorNumeric.py
nx.typecode()
by
nx.dtype.kind

I am not using numpy as much as as use other packages, but I think that 
typecode() was coming from Numeric and is disappearing.

I am patching the tip, and will likely backport this to the branch 2.0.x 
   if no problem seem to arise from having it.


L.


Nathaniel Smith wrote:
> Patch.
> 
> 
> 
> 
> --
> Create and Deploy Rich Internet Apps outside the browser with Adobe(R)AIR(TM)
> software. With Adobe AIR, Ajax developers can use existing skills and code to
> build responsive, highly engaging applications that combine the power of local
> resources and data with the reach of the web. Download the Adobe AIR SDK and
> Ajax docs to start building applications today-http://p.sf.net/sfu/adobe-com
> 
> 
> 
> 
> ___
> rpy-list mailing list
> rpy-list@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/rpy-list


--
Create and Deploy Rich Internet Apps outside the browser with Adobe(R)AIR(TM)
software. With Adobe AIR, Ajax developers can use existing skills and code to
build responsive, highly engaging applications that combine the power of local
resources and data with the reach of the web. Download the Adobe AIR SDK and
Ajax docs to start building applications today-http://p.sf.net/sfu/adobe-com
___
rpy-list mailing list
rpy-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rpy-list


Re: [Rpy] [patch] expose Rf_duplicate

2009-02-08 Thread Laurent Gautier
Nice.

What about calling the method __copy__ instead (so it fits other Python 
objects) ?


L.

Nathaniel Smith wrote:
> The attached patch adds a method ".duplicate" to rinterface.Sexp
> objects. When called, it returns a new Sexp that is identical to the
> first, but shares no memory with the first. (Underlyingly, it just
> calls Rf_duplicate.)
> 
> This is useful when you have an Sexp that you want to mutate, but you
> also want to correctly preserve R's copy-on-write semantics.
> 
> Tests are included, and pass for me.
> 
> -- Nathaniel
> 
> 
> 
> 
> --
> Create and Deploy Rich Internet Apps outside the browser with Adobe(R)AIR(TM)
> software. With Adobe AIR, Ajax developers can use existing skills and code to
> build responsive, highly engaging applications that combine the power of local
> resources and data with the reach of the web. Download the Adobe AIR SDK and
> Ajax docs to start building applications today-http://p.sf.net/sfu/adobe-com
> 
> 
> 
> 
> ___
> rpy-list mailing list
> rpy-list@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/rpy-list


--
Create and Deploy Rich Internet Apps outside the browser with Adobe(R)AIR(TM)
software. With Adobe AIR, Ajax developers can use existing skills and code to
build responsive, highly engaging applications that combine the power of local
resources and data with the reach of the web. Download the Adobe AIR SDK and
Ajax docs to start building applications today-http://p.sf.net/sfu/adobe-com
___
rpy-list mailing list
rpy-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rpy-list


Re: [Rpy] [patch] rpy2 tip broken on Unix systems

2009-02-08 Thread Laurent Gautier
It turned out that a stale PYTHONPATH was getting an older version of 
rpy2 when running it on my end.
So much for the cross-platform unifying bit. :/

Now the tip should build and run on Linux.

Thanks for following the bitbucket tip.


L.

Laurent Gautier wrote:
> Nathaniel Smith wrote:
>> I tracked down that strange "unresolved symbol" error I was getting.
>> It turns out that rpy2 tip includes a reference to R_ProcessEvents
>> unconditionally, but in fact R_ProcessEvents is not a portable API.
>> R_ProcessEvents only exists on Win32 and OS X/Aqua builds of R.
>>
>> And on OS X, unless someone has used the C api to define a special
>> hook function, all it does is check R_interrupts_pending. The only
>> time it really does anything useful is on Win32, and most calls to it
>> in the R source are protected by #ifdef Win32.
> 
> R has enough platform-specific twists as it is, so I'd rather stick to 
> the unifying effort, even if embryonic, and keep the #ifdef count as low 
> as I can.
> 
>> Attached patch stubs out the call to R_ProcessEvents unless 
>> defined(Win32).
>>
>> Built and tested on Linux (after also stubbing out the new device
>> code, since it fails to compile).
> 
> 
> I am hoping from one platform to the other, so I can have missed 
> something, but the rpy2 tip seem to build and run on Linux here. May be 
> we should look into what is specific to either my or your configuration
> (we can do that off-list).
> 
> 
> L.
> 
> 
> 
>> -- Nathaniel
>>
>>
>> 
>>
>> --
>>  
>>
>> Create and Deploy Rich Internet Apps outside the browser with 
>> Adobe(R)AIR(TM)
>> software. With Adobe AIR, Ajax developers can use existing skills and 
>> code to
>> build responsive, highly engaging applications that combine the power 
>> of local
>> resources and data with the reach of the web. Download the Adobe AIR 
>> SDK and
>> Ajax docs to start building applications 
>> today-http://p.sf.net/sfu/adobe-com
>>
>>
>> 
>>
>> ___
>> rpy-list mailing list
>> rpy-list@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/rpy-list
> 


--
Create and Deploy Rich Internet Apps outside the browser with Adobe(R)AIR(TM)
software. With Adobe AIR, Ajax developers can use existing skills and code to
build responsive, highly engaging applications that combine the power of local
resources and data with the reach of the web. Download the Adobe AIR SDK and
Ajax docs to start building applications today-http://p.sf.net/sfu/adobe-com
___
rpy-list mailing list
rpy-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rpy-list


Re: [Rpy] [patch] expose Rf_duplicate

2009-02-08 Thread Nathaniel Smith
On Sun, Feb 8, 2009 at 6:13 AM, Laurent Gautier  wrote:
> Nice.
>
> What about calling the method __copy__ instead (so it fits other Python
> objects) ?

I don't really care either way. I guess calling it "duplicate" avoids
any question of whether it should be __copy__ or __deepcopy__, but
since it will probably only be used by a few people writing
robjects-type wrapper APIs anyway, the name probably doesn't matter
much. Just so the functionality is there :-).

-- Nathaniel

--
Create and Deploy Rich Internet Apps outside the browser with Adobe(R)AIR(TM)
software. With Adobe AIR, Ajax developers can use existing skills and code to
build responsive, highly engaging applications that combine the power of local
resources and data with the reach of the web. Download the Adobe AIR SDK and
Ajax docs to start building applications today-http://p.sf.net/sfu/adobe-com
___
rpy-list mailing list
rpy-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rpy-list


Re: [Rpy] [patch] expose R_MissingArg

2009-02-08 Thread Nathaniel Smith
On Sun, Feb 8, 2009 at 2:22 AM, Laurent Gautier  wrote:
> In the case of extracting elements from a matrix, there is a way
> (working in R, as well as in rpy2):
>
> m[2, TRUE] # Note the TRUE !
> [1] 2 4

Ah, cute trick, thanks.

> I'd be more keen on defining the missing magic, as well as NULL and the NA_*
> group as user-immutable objects in a module (rather than functions).
> I started looked at how this could happen with the NA_* group, but got too
> busy on the day job otherwise and had to interrupt half-way through.
> One point of concern is that that those variables are not valid until R is
> initialized. This is rather easy to solve when considering the use of
> functions such as getNA_REAL() or getMissingArg(), but not when considering
> non-callable objects in a module.

Well, I agree that attributes look nicer, but like you say, the way I
did it has the advantage of actually working :-).

One could just add the line
  MISSING = rinterface.getMissingArgSexp()
to robjects/__init__.py and have the nice API that way. (It wouldn't
be immutable in the same way, but that's true of basically everything
in the entire Python world, including __builtins__, so that doesn't
seem too bad.)

Alternatively, why not just initialize R unconditionally at rinterface
import time? In practice everyone does this anyway (because they
import robjects rather than rinterface), and since R actually cannot
be initialized/deinitialized/reinitialized anyway, there isn't much
use in exposing the functions to do it. And it would make all this
stuff trivial.

-- Nathaniel

--
Create and Deploy Rich Internet Apps outside the browser with Adobe(R)AIR(TM)
software. With Adobe AIR, Ajax developers can use existing skills and code to
build responsive, highly engaging applications that combine the power of local
resources and data with the reach of the web. Download the Adobe AIR SDK and
Ajax docs to start building applications today-http://p.sf.net/sfu/adobe-com
___
rpy-list mailing list
rpy-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rpy-list


Re: [Rpy] [patch] rpy2 tip broken on Unix systems

2009-02-08 Thread Nathaniel Smith
On Sun, Feb 8, 2009 at 2:01 PM, Laurent Gautier  wrote:
> It turned out that a stale PYTHONPATH was getting an older version of rpy2
> when running it on my end.
> So much for the cross-platform unifying bit. :/
>
> Now the tip should build and run on Linux.

It does work for me, though my internal code interpreter is now
twitching a bit, because your version of the patch basically leaves in
the bad code, but then it turns out okay because gcc's optimizer takes
out the bad code before the linker can see it. Not terribly obvious.

It would make my subconscious happier if instead of:
  #if  !( defined(HAVE_AQUA) || defined(Win32) )
  [...]
  return NULL;
  #endif
  [...]
  R_ProcessEvents();
  [...]

We had:
  #if  !( defined(HAVE_AQUA) || defined(Win32) )
  [...]
  return NULL;
  #else
  [...]
  R_ProcessEvents();
  [...]
  #endif

> Thanks for following the bitbucket tip.

Oh, well, I send all these patches because I am using the
functionality they add, and it's easier to follow tip than to maintain
my own hacked-up fork :).

Perhaps it would be better to send them against the stable branch,
though? You tell me.

-- Nathaniel

--
Create and Deploy Rich Internet Apps outside the browser with Adobe(R)AIR(TM)
software. With Adobe AIR, Ajax developers can use existing skills and code to
build responsive, highly engaging applications that combine the power of local
resources and data with the reach of the web. Download the Adobe AIR SDK and
Ajax docs to start building applications today-http://p.sf.net/sfu/adobe-com
___
rpy-list mailing list
rpy-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rpy-list


[Rpy] [patch] R 2.7 compatibility fix for rpy_device.c

2009-02-08 Thread Nathaniel Smith
I tracked down that build error I've mentioned a few times with the
new graphics device code -- it's an R 2.7 vs. R 2.8 compatibility bug.
In 2.8, pDevDesc is (DevDesc *), but in 2.7 it's (NewDevDesc *), and
so trying to malloc a DevDesc doesn't work in 2.7, you need to malloc
a NewDevDesc instead.

I'm not really sure how well the python device stuff is expected to
work right now, or indeed what use its intended to have. However, with
the attached patch, it at least builds against both 2.7 and 2.8, and
doesn't introduce any new test failures (or #ifdefs).

I think this is the last patch needed to make tip really usable for me
(for now). Unless you'd be willing to take de-tab-ification patchs,
since my editor is set up to hate them (a la
http://www.jwz.org/doc/tabs-vs-spaces.html) and it's a bit of a pain
to always preserve all the tabs in the C files :-).

-- Nathaniel


NEW_rpy_device_on_2.7
Description: Binary data
--
Create and Deploy Rich Internet Apps outside the browser with Adobe(R)AIR(TM)
software. With Adobe AIR, Ajax developers can use existing skills and code to
build responsive, highly engaging applications that combine the power of local
resources and data with the reach of the web. Download the Adobe AIR SDK and
Ajax docs to start building applications today-http://p.sf.net/sfu/adobe-com___
rpy-list mailing list
rpy-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rpy-list


[Rpy] [patch] allow do_slot_assign to create new attributes

2009-02-08 Thread Nathaniel Smith
Currently, the following generates an exception:

>>> s = ri.SexpVector([1, 2, 3, 4], ri.INTSXP)
>>> s.do_slot_assign("dim", ri.SexpVector([2, 2], ri.INTSXP)

The issue is that s has no "dim" attribute to start off with, and
do_slot_assign's implementation checks R_has_slot and errors out if it
returns false.

However, there is no reason to do this; the actual SET_SLOT call that
rpy2 issues does the correct thing whether or not the slot already
exists (it ends up calling exactly the same function as R's own dim<-
operator, in fact).

The attached patch removes the offending check. Built and tested.

-- Nathaniel


NEW_allow_new_slot_creation
Description: Binary data
--
Create and Deploy Rich Internet Apps outside the browser with Adobe(R)AIR(TM)
software. With Adobe AIR, Ajax developers can use existing skills and code to
build responsive, highly engaging applications that combine the power of local
resources and data with the reach of the web. Download the Adobe AIR SDK and
Ajax docs to start building applications today-http://p.sf.net/sfu/adobe-com___
rpy-list mailing list
rpy-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rpy-list