This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author Terry Garyet
Recipients Terry Garyet, r.david.murray
Date 2015-11-14.04:24:29
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <7F40CFD6-35DA-43F9-80A9-631AA33EF49C@gmail.com>
In-reply-to <1447443768.22.0.817216126735.issue25619@psf.upfronthosting.co.za>
Content
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>
> _______________________________________
History
Date User Action Args
2015-11-14 04:24:29Terry Garyetsetrecipients: + Terry Garyet, r.david.murray
2015-11-14 04:24:29Terry Garyetlinkissue25619 messages
2015-11-14 04:24:29Terry Garyetcreate