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

Robert Collins robertc at robertcollins.net
Thu Jun 15 15:41:06 BST 2006


On Fri, 2006-06-16 at 00:20 +1000, Andrew Bennetts wrote:
> On Thu, Jun 15, 2006 at 08:35:19AM -0500, John Arbash Meinel wrote:
> > Andrew Bennetts wrote:
> > > Robert Collins 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 *
> > > 
> [...]
> > 
> > Actually, Robert does an even trickier method. And that is because dlls
> > are preferentially loaded before .py files (just like .pyc is loaded if
> > it is not out of date).
> > 
> > So he actually creates a 'foo.py' and a 'foo.so'.
> 
> That's a bit too tricky for my tastes.  The obvious downside is the difficulty
> of testing both the C and the pure python.  It's also likely to confuse someone
> that isn't intimately familiar with the precise behaviour of python's import
> logic (I didn't even know this was the case until I read this message).  Also,
> I'm not sure that this is guaranteed behaviour, but even if it was I still
> wouldn't like relying on it.

Interesting. I didn't think for a second that it could be ambiguous -
I'm now trying to wonder why I didn't think that....

python -vv shows that the order /looked for/ is
foo.so
foomodule.so
foo.pyc
foo.py

which doesn't really prove anything.

Whos the best person to ask what is considered 'implementation detail'
vs 'predictable behaviour' here?

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/ae916999/attachment.pgp 


More information about the bazaar mailing list