More information about the Underscore mailing list

[_] Python Question

Rick Edwards rick.edwards at gmail.com
Thu Dec 17 16:35:09 GMT 2009

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!

:-p