Asp Forum
Home
|
Login
|
Register
|
Search
Forums
>
comp.lang.python
Re: Interest check in some delicious syntactic sugar for "except:pass"
Dave Angel
3/3/2010 10:41:00 AM
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.
>
> I appreciate any feedback, including frank statements that you'd
> rather not trifle with such nonsense.
>
> ~Oren
>
> [1]
http://www.google.com/codesearch?q...
\spass&hl=en
> [2]
http://www.google.com/codesearch?hl=en&lr=&q=silence...
>
>
I presume you know that there's a feature freeze on for Python. So such
an idea wouldn't be considered for at least a couple of years. But that
shouldn't inhibit such discussions.
I wonder if you're intending that silence: denotes a block in which all
exceptions would be ignored. And that any calls made from there that
threw exceptions would also be ignored.
If so, it's a bad idea. Only if you could qualify it to a particular
exception list might it be reasonable. As it stands, it's just as bad
as the bare try/except that you were already given. Do you really want
to ignore syntax errors, skip bad data, and ignore missing files, and
generally plow down whatever execution path happens to result?
Just my opinion.
DaveA
Servizio di avviso nuovi messaggi
Ricevi direttamente nella tua mail i nuovi messaggi per
Re: Interest check in some delicious syntactic sugar for "except:pass"
Inserendo la tua e-mail nella casella sotto, riceverai un avviso tramite posta elettronica ogni volta che il motore di ricerca troverà un nuovo messaggio per te
Il servizio è completamente GRATUITO!
x
Login to ForumsZone
Login with Google
Login with E-Mail & Password