<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Wed, Apr 13, 2016 at 1:47 PM, Random832 <span dir="ltr"><<a href="mailto:random832@fastmail.com" target="_blank">random832@fastmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On Wed, Apr 13, 2016, at 16:39, Chris Barker wrote:<br>
> so are we worried that __fspath__ will exist and be callable, but  might<br>
> raise an AttributeError somewhere inside itself? if so isn't it broken<br>
> anyway, so should it be ignored?<br>
<br>
</span>Well, if you're going to say "ignore the protocol because it's broken",<br>
where do you stop? What if it raises some other exception? What if it<br>
raises SystemExit?</blockquote><div><br></div><div>this is pretty much always the case with EAFTP coding:</div><div><br></div><div>try:</div><div>    something()</div><div>except SomeError:</div><div>    do_something_else() </div><div><br></div><div>unless SomeError is a custom defined error that you know is never going to get raised anywhere else, then something() could raise SomeError for the reason you expect, or some code deep in the call stack could raise SomeError also, and you wouldn't know that.</div><div><br></div><div>I had a student run into this and it took him a good while to debug it. But that was because the code in something() was pretty darn buggy. If he had tested something() by itself, there would have been no issue finding the problem.</div><div><br></div><div>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.</div><div><br></div><div>-CHB</div><div><br></div><div><br></div><div><br></div><div><br></div></div><div><br></div>-- <br><div class="gmail_signature"><br>Christopher Barker, Ph.D.<br>Oceanographer<br><br>Emergency Response Division<br>NOAA/NOS/OR&R            (206) 526-6959   voice<br>7600 Sand Point Way NE   (206) 526-6329   fax<br>Seattle, WA  98115       (206) 526-6317   main reception<br><br><a href="mailto:Chris.Barker@noaa.gov" target="_blank">Chris.Barker@noaa.gov</a></div>
</div></div>