isinstance(.., file) for Python 3
duncan.booth at invalid.invalid
Thu Nov 8 14:58:11 CET 2012
Ulrich Eckhardt <ulrich.eckhardt at dominolaser.com> wrote:
> If possible, I'm looking for a solution that works for Pythons 2 and 3,
> since I'm not fully through the conversion yet and have clients that
> might use the older snake for some time before shedding their skin.
Why bother checking types at all?
data = file_or_string.read()
data = file_or_string
... use data ...
Duncan Booth http://kupuguy.blogspot.com
More information about the Python-list