[Python-ideas] Boolean value of file object? (original) (raw)
Mike Meyer mwm at mired.org
Sun Jan 8 02:07:13 CET 2012
- Previous message: [Python-ideas] Sampling Profiler for Python
- Next message: [Python-ideas] Boolean value of file object?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Just an off-the-wall thought.
Is there any reason a file object's boolean value shouldn't be false once it's been closed? This would allow replacing "if f and f.closed:" (to make sure you have a file and it's open) with just "if f:". Is there some use case where you want to verify that an object is a file object instead of None (or another false value), and don't care if it's closed?
My own thought is that this is a case where status quo wins, but thought someone else might think the idea has more merit.
<mike-- Mike Meyer <mwm at mired.org> http://www.mired.org/ Independent Software developer/SCM consultant, email for more information.
O< ascii ribbon campaign - stop html mail - www.asciiribbon.org
- Previous message: [Python-ideas] Sampling Profiler for Python
- Next message: [Python-ideas] Boolean value of file object?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]