[Python-ideas] Boolean value of file object?

Steven D'Aprano steve at pearwood.info
Sun Jan 8 03:06:51 CET 2012

Mike Meyer wrote:
> 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?

Is there any reason it should?

There's nothing false-like about a closed file object. Truthy and falsy 
objects should map to "something" vs "nothing" or "non-empty" vs "empty", not 
"some arbitrary flag that might be useful sometimes".


More information about the Python-ideas mailing list