News for hackers. Stuff that matters.
Re:Hidden features of Python by snprbob86 on Wednesday July 14, 2010 @03:17AM (#1513916)
Pre 2.7, you can just give the dict constructor a generator of tuples:

  >>> dict((s, len(s)) for s in ["one", "two", "three"])
  {'three': 5, 'two': 3, 'one': 3}
Re:Hidden features of Python by calibraxis on Wednesday July 14, 2010 @03:44AM (#1513961)
Thank you very much! Lack of simple dict-building had been bothering me.