Why do you want this?
Is there a shortage of newlines in your country? Maybe the Enter key is
broken on your keyboard? *wink*
Writing a proposal without a motivation is not very likely to get very
far. "Put the code on one line" is not an acceptable motivation; *why*
do you want to put it on one line?
A one-line try...except is not more readable or understandable than a
two-line version. It doesn't give us any more programming power or new
functionality. It doesn't even help in the interactive interpreter.
Just write it on two lines. Or better still, four.
"One liners" are not Pythonic and the culture of Python programming does
not consider it a virtue to cram as much code into one line as we can
possibly fit.
Comprehensions were not invented so we can squeeze a for-loop into one
line, we could already do that:
for x in items: print(x)
They were invented as an expression form of for-loops. Many
comprehensions are written over two lines, or more.
--
Steve
_______________________________________________
Python-ideas mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at
https://mail.python.org/archives/list/[email protected]/message/NADLFTTJ7JXBOSQW47QXUETSYVB56BAH/
Code of Conduct: http://python.org/psf/codeofconduct/