[_] Python Question
Matt Hamilton
matth at netsight.co.uk
Thu Dec 17 16:50:56 GMT 2009
On 17 Dec 2009, at 16:35, Rick Edwards wrote: > 2009/12/17 Matt Hamilton matth at netsight.co.uk > >> >> If the case is likely that bar will be in attributes you could do do >> the 'do it, then ask forgiveness' route: >> >> for foo,bar in attribute_data: >> try: >> attributes[bar].append(foo) >> except KeyError: >> attributes[bar] = [foo,] >> > > Tsk, using exception handling to control logical flow like this, > shame on > you! http://wiki.sheep.art.pl/Ask%20for%20Forgiveness -Matt -- Matt Hamilton matth at netsight.co.uk Netsight Internet Solutions, Ltd. Understand. Develop. Deliver http://www.netsight.co.uk +44 (0)117 9090901 Web Design | Zope/Plone Development & Consulting | Co-location | Hosting