[Python-ideas] Add "goto fail" to Python?

Westley Martínez anikom15 at gmail.com
Fri Mar 7 02:03:58 CET 2014


Spaghetti?

Seriously though, I don't see how this is any different than a regular goto.
What's forcing users to use this only for errors?  I understand that error-
handling is what goto is most useful for in C, but if Python already has a
simple and robust method for handling errors, what is goto going to add?

> -----Original Message-----
> From: Python-ideas [mailto:python-ideas-bounces+anikom15=gmail.com at python.org]
> On Behalf Of Yann Kaiser
> Sent: Thursday, March 06, 2014 1:42 PM
> To: Georg Brandl
> Cc: python-ideas
> Subject: Re: [Python-ideas] Add "goto fail" to Python?
> 
> What does this add that we can't do with control flow tools such as
> try..finally or context managers?
> 
> On 6 March 2014 22:36, Georg Brandl <g.brandl at gmx.net> wrote:
> > Am 06.03.2014 11:11, schrieb Nick Coghlan:
> >>
> >> On 6 Mar 2014 13:55, "Sturla Molden"
> >> <sturla.molden at gmail.com
> >> <mailto:sturla.molden at gmail.com>> wrote:
> >>>
> >>> "goto fail" is a well-known error handling mechanism in open source
> software,
> >> widely reputed for its robusteness:
> >>>
> >>>
> >> http://opensource.apple.com/source/Security/Security-
> 55471/libsecurity_ssl/lib/sslKeyExchange.c
> >>>
> >>>
> >>
> https://www.gitorious.org/gnutls/gnutls/source/6aa26f78150ccbdf0aec1878a41c17c
> 41d358a3b:lib/x509/verify.c
> >>>
> >>> I believe Python needs to add support for this superior paradigm.
> >>
> >> Unfortunately, we can't throw stones about those, since we currently have
> >> hostname matching off by default and expect developers to turn it on.
> >
> > And on another level, we use the same error handling method in C code
> > (which is not bad per se of course).  The literal code "goto fail;" actually
> > occurs about 200 times in the CPython sources :)
> >
> > Aaand... we also don't have a policy to always use braces...
> >
> > Georg
> >
> > _______________________________________________
> > Python-ideas mailing list
> > Python-ideas at python.org
> > https://mail.python.org/mailman/listinfo/python-ideas
> > Code of Conduct: http://python.org/psf/codeofconduct/
> _______________________________________________
> Python-ideas mailing list
> Python-ideas at python.org
> https://mail.python.org/mailman/listinfo/python-ideas
> Code of Conduct: http://python.org/psf/codeofconduct/



More information about the Python-ideas mailing list