Open martin2250 opened 5 years ago
Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).
:memo: Please visit https://cla.developers.google.com/ to sign.
Once you've signed (or fixed any issues), please reply here (e.g. I signed it!
) and we'll verify it.
I signed it!
CLAs look good, thanks!
This is not backwards-compatible with Python 2. Please check against file
if available. Some options are mentioned here:
https://stackoverflow.com/questions/25738602/how-to-judge-a-file-type-both-work-in-python-2-and-python-3
Which method do you think is better in this case, using the tuple and try/except or checking hasattr(f, 'fileno')
/ hasattr(f, 'write')
?
I think fileno()
is a good proxy because it supports file-like objects better (like sockets, etc)
Ok, the PR should be good now
As mentioned in #126