[PATCH 1 of 1] util: remove any() and all()

Nicolas Dumazet nicdumz at gmail.com
Sun Jan 16 04:11:47 CST 2011


2011/1/15 Benoit Boissinot <bboissin at gmail.com>:
> On Mon, Jul 5, 2010 at 9:35 AM, Martin Geisler <mg at aragost.com> wrote:
>>
>> What about augmenting the builtins on Python 2.4 with the any/all
>> functions and defaultdict class? That way our code would look like
>> Python 2.5 code, but still run on Python 2.4.
>>
>> If our util.any/all are accurate replacements for any/all in Python 2.5
>> (which I think they are) then, as far as I can see, the only problem is
>> to make sure the compatibility code is loaded before the first access to
>> any/all. Perhaps hg.py could simply do the 'import py24compat' if it
>> detects we're on Python 2.4.
>
> What do other people thing about that? Is there any other python
> sofware having that approach?

It sounds good, but I'm not so happy about the idea of potentially
slow defaultdicts in 2.4
For now in our code, we dont use defaultdict and are happy with this.
If we go on and introduce artificial defaultdicts, some code might get
faster in 2.5/2.6/2.7, but we can also potentially get slower code on
2.4. Not sure that it's worth it.

>
> Benoit
>



-- 
Nicolas Dumazet — NicDumZ


More information about the Mercurial-devel mailing list