[PATCH] use 'x in dict' instead of 'dict.has_key(x)'

Alejandro Santos alejolp at alejolp.com
Mon Aug 24 16:48:22 CDT 2009


On Mon, Aug 24, 2009 at 4:02 PM, Nicolas Dumazet<nicdumz at gmail.com> wrote:
> # HG changeset patch
> # User Nicolas Dumazet <nicdumz.commits at gmail.com>
> # Date 1251140434 -7200
> # Node ID 4a5253995fed8d0e45e025bb103016c66dbbed8d
> # Parent  20ed9909dbd9251f76cacb463c480488eebf736b
> use 'x in dict' instead of 'dict.has_key(x)'
>
> "in" is faster, and has_key will be removed in py3k
>

The 2to3 tool handles this simple fix automatically, among lots of other ones.

-- 
Alejandro Santos,
http://www.alejolp.com.ar



More information about the Mercurial-devel mailing list