O 25/09/20 ás 08:41, Chris Angelico escribiu:

On Fri, Sep 25, 2020 at 4:25 PM Sergio Fenoll <ser...@fenoll.be> wrote:
What I had in mind was that an IDE could use this information to show
autocomplete options when writing except blocks. The other day I was
writing some code like this:

import requests

try:

      requests.get('https://python.org')

except WhateverExceptionTheRequestsLibraryRaises:

      pass

It would have to not only look at get(), but everything that it calls.
Either that, or you're back to the Java thing of "catch it or declare
it", and we've seen from Java that that's a bad idea.

ChrisA
I don't really understand why those are the only options. The way I see it,
whomever implements get() can just have a list of expected Exceptions and as
a caller you just handle those (now with the added ease that you don't need to look them up out-of-bounds, they're already in your IDE!) and if an unexpected exception happens, well you handle it the same way you do it now (i.e. either not
at all, with a bare except, or something along those lines).
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/AZ6FLPAYPWBYBI65EGCPCO3B2KBOZGBM/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to