Message254642
My real application (not this example code that also 'breaks') is a battery monitor that starts at boot time and only exits when the battery is near death.
So there is effectively a while(batlevelgood) loop that polls the battery level and doesn't exit until near battery death.
I only encounters this while debugging and having to kill (ctrl-c) the script, having no chance to clean up properly.
Admittedly I'm not very experienced in Python but I am an experienced programmer. I will look up context mgr protocol, but this was certainly odd behavior. It isn't every day that the name of a function not even called changes observed program behavior.
Terry
> On Nov 13, 2015, at 1:42 PM, R. David Murray <report@bugs.python.org> wrote:
>
>
> R. David Murray added the comment:
>
> Best practice, by the way, is to be explicit about the scope of any resource and clean it up before program end...this is often done by using the context manager protocol.
>
> ----------
>
> _______________________________________
> Python tracker <report@bugs.python.org>
> <http://bugs.python.org/issue25619>
> _______________________________________ |
|
Date |
User |
Action |
Args |
2015-11-14 04:24:29 | Terry Garyet | set | recipients:
+ Terry Garyet, r.david.murray |
2015-11-14 04:24:29 | Terry Garyet | link | issue25619 messages |
2015-11-14 04:24:29 | Terry Garyet | create | |
|