Re: There should be one-- and preferably only one --obvious way to do it
Lie Ryan writes: > There are lots of reason why bare-except is bad, one being is that it > makes it way too easy to ignore errors that you don't actually want to > silence; and given that bare-excepts would prevent Ctrl+C (Interrupt) > from working. Sorry, but IMHO we shouldn't make syntax sugar for bad > practices. Right. Another way I've seen this expressed is “It should be easy to do the right thing, and awkward to do the wrong thing”. -- \ “Everyone is entitled to their own opinions, but they are not | `\entitled to their own facts.” —US Senator Pat Moynihan | _o__) | Ben Finney -- http://mail.python.org/mailman/listinfo/python-list
Re: There should be one-- and preferably only one --obvious way to do it (was "Interest check in some delicious syntactic sugar for "except:pass"")
On 03/03/2010 08:27 PM, Oren Elrad wrote: > Howdy all, longtime appreciative user, first time mailer-inner. > > I'm wondering if there is any support (tepid better than none) for the > following syntactic sugar: > > silence: > . block > > -> > > try: > .block > except: > .pass > > The logic here is that there are a ton of "except: pass" statements[1] > floating around in code that do not need to be there. Meanwhile, the > potential keyword 'silence' does not appear to be in significant use > as a variable[2], or an alternative keyword might be imagined > ('quiet', 'hush', 'stfu') but I somewhat like the verbiness of > 'silence' since that is precisely what it does to the block (that is, > you have to inflect it as a verb, not a noun -- you are telling the > block to be silent). Finally, since this is the purest form of > syntactic sugar, I cannot fathom any parsing, interpreting or other > complications that would arise. Given that python HATE bare-except (and `pass`-block bare except is even worse) and given python's idiosyncrasies "There should be one-- and preferably only one --obvious way to do it", "Errors should never pass silently"; the chance for `silence` keyword is precisely zero. > I appreciate any feedback, including frank statements that you'd > rather not trifle with such nonsense. There are lots of reason why bare-except is bad, one being is that it makes it way too easy to ignore errors that you don't actually want to silence; and given that bare-excepts would prevent Ctrl+C (Interrupt) from working. Sorry, but IMHO we shouldn't make syntax sugar for bad practices. -- http://mail.python.org/mailman/listinfo/python-list
Re: "Only one obvious way..."
On 2006-05-08 02:51:22 -0400, [EMAIL PROTECTED] said: > The phrase "only one obvious way..." is nearly the most absurd > marketing bullshit I have ever heard; topped only by "it fits your > brain". Why are so many clearly intelligent and apparently > self-respecting hard-core software engineers repeating this kind of > claptrap? Really should read "only one obvious way to people with a similar background and little creativity" or "it fits your brain if you've mostly programmed in algol syntax languages and alternative ideas make said brain hurt." trimmed to c.l.python and c.l.lisp -- http://mail.python.org/mailman/listinfo/python-list
Re: "Only one obvious way..."
>If I ever _DO_ find a language that *DOES* mercilessly refactor in pursuit > of the ideal "only one obvious way", I may well jump ship, since my faith in > Python's adherence to this principle which I cherish so intensely has > been so badly broken ... The phrase "only one obvious way..." is nearly the most absurd marketing bullshit I have ever heard; topped only by "it fits your brain". Why are so many clearly intelligent and apparently self-respecting hard-core software engineers repeating this kind of claptrap? It sounds more like a religious cult than a programming language community. If one of my students answered the question: "Why use X for Y?" with "X fits your brain." or "There's only one obvious way to do Y in X." I'd laugh out loud before failing them. -- http://mail.python.org/mailman/listinfo/python-list