Hello. I read this is a good place to give some suggestions for features in
python. If not, please let me know.
This is an example of a code I normally use in my everyday work:
import logging
try:
with open('sample_data/READM.md') as f:
print (len(f.read()))
except FileNotFoundError:
loggi
Chris Angelico wrote:
> On Thu, 13 Jun 2024 at 10:58, wrote:
> >
> > Chris,
> >
> > You seem to have perceived an insult that I remain unaware of.
>
> If you're not aware that you're saying this, then don't say it.
>
Er, um, that really makes no sense! :-)
How can one not say something that on
Paul Rubin writes:
> HenHanna writes:
>> is there another (simple) way to write this?
>
> Yes, but please consider doing these easy exercises yourself instead of
> fobbing them onto other people.
Hen's probably just an experimental GPT. You, with your limited
resources, can never train it.
I'd
> On 13 Jun 2024, at 11:01, Yair Eshel via Python-list
> wrote:
>
> I read this is a good place to give some suggestions for features in
> python.
Best place these days is to raise an idea on https://discuss.python.org/
Beware that this idea has come up in the past and was rejected.
Barry
Hey, everyone!
I believe the original question has been answered, and tempers seem to be flaring in sub-threads, so let's call this
thread done and move on to other interesting topics.
Thank you for your support!
--
~Ethan~
Moderator
--
https://mail.python.org/mailman/listinfo/python-list
Yair Eshel wrote at 2024-6-13 13:01 +0300:
> ...
>I would like to suggest an alternative syntax, that will, in a sense, apply
>the best of both worlds:
>
>import logging
>with open('sample_data/README.md') as f:
> print (len(f.read()))
>except FileNotFoundError:
> logging.error("File not")
Are y
On 13Jun2024 19:44, dieter.mau...@online.de wrote:
Why not use:
```
try:
with open()...
...
except FileNotFoundError:
...
```
This is exactly what the OP was expressing dissatisfaction with.
I'm -1 on the idea myself - not every combination of things needs
additional syntactic support,
Cameron, I'm not really sure I got your point. I've used the "file not
found" exception as an example for a behavior typical on context managers.
This could be a failure to connect to DB, or threads. It also applies to
any kind of possible exception, whether cased by the context manager itself
or t