>> If you're running some sort of checker (pylint, pychecker) over this, >> you might get a warning about the "name" line not doing anything. To >> avoid that, you'll sometimes see a variant like this: >> >> try: >> unused = name >> except NameError: >> # variable 'name' is not defined. >> > > Except then PyLint will complain that 'unused' is unused, plus you code no > longer accurately conveys its intent.
Well pychecker ignores variables called "unused" (and _, but that clashes with the gettext usage). I figured pylint did too, but that was only a guess. IMO this code does accurately convey its intent - I have seen this idiom in a lot of Python code. Cheers, Tony _______________________________________________ Users mailing list Users@lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com