In article <4da83f8f$0$29986$c3e8da3$54964...@news.astraweb.com>,
 Steven D'Aprano <steve+comp.lang.pyt...@pearwood.info> wrote:

> for key in dct:
>     if key.startswith("Keyword"):
>         maxkey = max(maxkey, int(key[7:]))

I would make that a little easier to read, and less prone to "Did I 
count correctly?" bugs with something like:

prefix = "Keyword"
n = len(prefix)
for key in dct:
    name, value = key[:n], key[n:]
    if name == prefix:
        maxkey = max(maxkey, int(value))
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to