In article <[email protected]>,
 Steven D'Aprano <[email protected]> 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