[MERGE] bzrlib.osutils fixes

Dmitry Vasiliev dima at hlabs.spb.ru
Fri Mar 9 15:40:12 GMT 2007


Robert Collins wrote:
> Robert Collins has voted -1.
> Status is now: Vetoed
> Comment:
> _directory_kind is not being used yet, but its definately not a 
> misfeature IMNSHO:
> 
> :!python -m timeit -s 'f = "foo"; b = "bar"' 'f == b'
> 1000000 loops, best of 3: 0.26 usec per loop
> 
> :!python -m timeit -s 'f = "foo"; b = "bar"' 'f != b'
> 1000000 loops, best of 3: 0.265 usec per loop
> 
> :!python -m timeit -s 'f = "foo"; b = "bar"' 'f is b'
> 1000000 loops, best of 3: 0.213 usec per loop
> 
> :!python -m timeit -s 'f = "foo"; b = "bar"' 'f is not b'
> 1000000 loops, best of 3: 0.211 usec per loop

Hmm, maybe I've misunderstood but:

     $ python -c "d = 'directory'; print d is 'directory'"
     True

so we don't lose anything without _directory_kind only gain some code 
clearness. There is also code in osutils.copy_tree() which don't use 
_directory_kind. Moreover I believe such a micro optimizations applied 
to a real code doesn't gain much (if any at all) so code clearness is 
more preferable.

So conclude I think we need to select one preferable way and follow it 
consistently, so if we decide to leave the variable then corresponding 
variables should be added for each file kind. Am I right?

-- 
Dmitry Vasiliev <dima at hlabs.spb.ru>
http://hlabs.spb.ru



More information about the bazaar mailing list