(original) (raw)
On Apr 13, 2016 20:06, Chris Barker wrote:
\>
\> In this case, I don't know that we need to be tolerant of buggy \_\_fspathname\_\_() implementations -- they should be tested outside these checks, and not be buggy. So a buggy implementation may raise and may be ignored, depending on what Exception the bug triggers -- big deal. The only time it would matter is when the implementer is debugging the implementation.
\>
\> -CHB
Yes but you can often, and can in this case, restrict the contents of the try block to a single operation - a name access, an attribute, a subscript - and that sharply limits the risk of such a thing happening. Sure, the object's \_\_getattr(ibute)\_\_ could still fail from something deep inside it missing a different attribute, but that's it.