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

Martin Geisler mg at aragost.com
Mon Jul 5 02:35:50 CDT 2010


Nicolas Dumazet <nicdumz at gmail.com> writes:

> 2010/7/5 Dirkjan Ochtman <dirkjan at ochtman.nl>:
>> On Sun, Jul 4, 2010 at 18:24, Steve Losh <steve at stevelosh.com> wrote:
>>> Now that Python 2.7 has been released the three latest versions of Python are
>>> 2.5, 2.6 and 2.7, all of which have these functions built in.
>>
>> Bzzzt. We support whatever we chose to support, not just the latest
>> three versions. We will deprecate 2.4 when the time is there, and I
>> don't think you'll be able to convince everyone that that time is now.
>> :)
>
> Hehe, too bad, I would have been rushing around the code, adding
> defaultdicts everywhere =)

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.

-- 
Martin Geisler

aragost Trifork
Professional Mercurial support
http://aragost.com/mercurial/


More information about the Mercurial-devel mailing list