[RFC] Adding Py3k support while maintaining compatibility with python <= 2.6

Renato Cunha renatoc at gmail.com
Thu Jun 3 11:41:16 CDT 2010


On Thu, Jun 03, 2010 at 10:23:13AM -0500, Matt Mackall wrote:
> Not sure I agree with that. In particular I know I won't be able to
> remember it and will find myself looking it up somewhere else every time
> I want to use it.
> 
> I'm beginning to think we might want to extend 2to3 for our purposes
> instead.

That's a possibility, indeed. I'm taking a look at Mark Pilgrim's Dive into
Python 3 [1] for some insights on how he ported a library that makes heavy =
use of
strings.

[1] http://diveintopython3.org/

> > As for the octal constants, using constants could be fine. In terms of
> > how much code is required for the workaround, it seems to me like just
> > using int('666', 8) might be just as clear and require less other crap
> > (importing os or referring to util.MODE_something).
> 
> Unfortunately several of these use-cases are fairly
> performance-sensitive, particularly dirstate. Here we often cache scope
> lookups in local variables for performance, just going from an octal
> constant to a variable may actually be a measurable performance hit.

Is it worth implementing the changes and measuring the performance while
operating on a huge repository? Maybe an approach that defines the constants at
the beginning of the function that is going to use them would help, or not?

Regards,
-- 
Renato Cunha <http://renatocunha.com>
Blog: http://valedotrovao.com
There's no silver bullet.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 222 bytes
Desc: not available
URL: <http://selenic.com/pipermail/mercurial-devel/attachments/20100603/77dd9574/attachment.pgp>


More information about the Mercurial-devel mailing list