MRAB <pyt...@mrabarnett.plus.com> writes: > Have you thought about catching the NameError?
I had not, but that is obvious now you say it. Thanks. Where there isn't a more elegant solution, I'll use that. It might not be elegant, but it's at least clear and expressive of the intent. Jussi Piitulainen <e...@kun.ei.invalid> writes: > Make them an implementation detail: > > plumage = [ > (__foo__, __bar__) for (__foo__, __bar__) in feathers.items() > if __bar__ == "beautiful" ] That still makes the name persist, so doesn't meet the requirements. It also commits the further mistake of using a ‘__dunder__’ name style for something that *isn't* a Python magic attribute. Thanks for the attempt :-) -- \ “Teeth extracted by the latest Methodists.” dentist | `\ advertisement, Hong Kong | _o__) | Ben Finney -- https://mail.python.org/mailman/listinfo/python-list