O'Reilly logo
  • Bob Belderbos thinks this is interesting:

def urltemplate(template): def opener(**kwargs): return urlopen(template.format_map(kwargs)) return opener # Example use yahoo = ur...

From

Cover of Python Cookbook, 3rd Edition

Note

closure instead of single method class