Re: New Idea: A safe keyword to execute the following statement in a failsafe mode.

That's what I think it should be for. I know safe open(...) isn't a really good example for this, but I had just used that for demonstration purposes. Instead what I am saying is that sometimes we just don't care even if an statement raises exception. Like the first example in which I am sending an log, which isn't important. And in any case, the original try except keywords will still be there. Also I read the similar idea you mentioned, and I guess that is also a good way to implement it. We can replace *safe telegram_log("...")* with one liner: *telegram_log("...") except: None* After all, python is known for one liners and this would be an another great one liner if implemented.

On Sun, May 23, 2021 at 06:52:38PM +0530, Shivam Saini wrote:
After all, python is known for one liners and this would be an another great one liner if implemented.
Python isn't known for one-liners. You might be thinking of Perl. Being known for one-liners is a bad thing. It means that your language is famous for being written in an obfuscated, hard to read, hard to maintain, style. -- Steve

On 2021-05-24 at 01:34:29 +1000, Steven D'Aprano <steve@pearwood.info> wrote:
I agree.
Being known for one-liners can (*can*, not must) mean that my language has the right features, abstractions, and APIs for common use cases and task(s) at hand. Most programs are composed of multiple one-liners. ;-) Any program can be one line long if I put all the details into a library function. That said, a [standard] library that contains everything is not a good goal.

23.05.21 16:22, Shivam Saini пише:
After all, python is known for one liners
It is not Python that is known for one liners. Python syntax is rather opposed to one liners. It encourages and sometimes forces a user to write well-indented code.

On Sunday, May 23, 2021, 02:23:05 PM GMT+1, Shivam Saini <shivamsn97@gmail.com> wrote:
Like the first example in which I am sending an log, which isn't important.
If the log is not important, then why are you sending it?

On Sun, May 23, 2021 at 06:52:38PM +0530, Shivam Saini wrote:
After all, python is known for one liners and this would be an another great one liner if implemented.
Python isn't known for one-liners. You might be thinking of Perl. Being known for one-liners is a bad thing. It means that your language is famous for being written in an obfuscated, hard to read, hard to maintain, style. -- Steve

On 2021-05-24 at 01:34:29 +1000, Steven D'Aprano <steve@pearwood.info> wrote:
I agree.
Being known for one-liners can (*can*, not must) mean that my language has the right features, abstractions, and APIs for common use cases and task(s) at hand. Most programs are composed of multiple one-liners. ;-) Any program can be one line long if I put all the details into a library function. That said, a [standard] library that contains everything is not a good goal.

23.05.21 16:22, Shivam Saini пише:
After all, python is known for one liners
It is not Python that is known for one liners. Python syntax is rather opposed to one liners. It encourages and sometimes forces a user to write well-indented code.

On Sunday, May 23, 2021, 02:23:05 PM GMT+1, Shivam Saini <shivamsn97@gmail.com> wrote:
Like the first example in which I am sending an log, which isn't important.
If the log is not important, then why are you sending it?
participants (5)
-
2QdxY4RzWzUUiLuE@potatochowder.com
-
Irit Katriel
-
Serhiy Storchaka
-
Shivam Saini
-
Steven D'Aprano