[RFC][PERFORMANCE][PYREX][TIRED OF THESE YET?] *fast* walkdirs.

Robert Collins robertc at robertcollins.net
Fri Jun 16 10:23:12 BST 2006


On Fri, 2006-06-16 at 10:57 +1000, Martin Pool wrote:


> > Why not do it this way: for some feature foo with an optional C  
> > implementation,
> > have a foo.py that simply consists of:
> >
> >      try:
> >           from _c_foo import *
> >      except ImportError:
> >           from _py_foo import *
> >
> > Where _c_foo would be the "foo" module in C, and _py_foo would be  
> > the pure
> > python fallback.  Tests for "foo" can directly access both _c_foo  
> > and _py_foo
> > modules to make sure they both pass.  Callers of foo get the C  
> > version if
> > available, and automatically get the python version if not.
> 
> I prefer something like spiv's approach, or something along those  
> lines.  It doesn't seem that much harder and does mean that you can  
> at least name the two modules, if we want to add tests that exercise  
> both in the future.

Sure, we can do that. I dont understand your comment about adding tests
later though: we can always start with a .so and .py with the same name
and use our rename-supporting-VCS later to rename them to _c_ and _py_
forms when we decide to add those tests. Until we are writing those
tests I would call the glue file a case of YAGNI.

Rob

-- 
GPG key available at: <http://www.robertcollins.net/keys.txt>.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 191 bytes
Desc: This is a digitally signed message part
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20060616/24c90bb9/attachment.pgp 


More information about the bazaar mailing list