News for hackers. Stuff that matters.
Re:Python idiom for taking the single item from a list by swolchok on Monday September 27, 2010 @05:24PM (#1733500)
This is Python. Subclass it and fix the problem, unless the guts are so opaque that your code would be littered with subclasses and you can't figure out an elegant, general way of fixing it (unlikely).
Re:Python idiom for taking the single item from a list by tmsh on Monday September 27, 2010 @08:09PM (#1734066)
This is Sparta.

  class SpartanList(list):
       def foot(self):
          return self[0]


  assert l.foot()
  return l.foot()