[Python-ideas] os.path.isbinary

David Mertz mertz at gnosis.cx
Thu Aug 1 22:05:49 CEST 2013


On Thu, Aug 1, 2013 at 2:47 PM, MRAB <python at mrabarnett.plus.com> wrote:
>> Something like:
>>
>>    if fh.read(512).isprintable():
>>        do_the_ascii_stuff(fh)
>>    else:
>>        do_the_bin_stuff(fh)
>>
> Except that:
>
>>>> "\n".isprintable()
> False

Doesn't that seem like a bug:

-----
Help on method_descriptor:

isprintable(...)
    S.isprintable() -> bool

    Return True if all characters in S are considered
    printable in repr() or S is empty, False otherwise.
-----

In what sense is "\n" "not printable in repr()"?!

-- 
Keeping medicines from the bloodstreams of the sick; food
from the bellies of the hungry; books from the hands of the
uneducated; technology from the underdeveloped; and putting
advocates of freedom in prisons.  Intellectual property is
to the 21st century what the slave trade was to the 16th.


More information about the Python-ideas mailing list