Open guettli opened 9 years ago
Hey there, thanks for your feedback. I'm going to look into this; the Python documentation says it returns a file object which means f
is possibly clear enough. I think the object that you get back is a bit higher level than a file descriptor (as used at operating system level) but I could be wrong here.
@svisser my concerns are not the technical details. It is "best practice". I see "fd" very often. And I personally think that one letter variables are not clean code. I just wanted to tell you this.
I checked the python source ...
===> find /usr/lib/python2.7/ -name '*.py'|xargs grep 'with open' | sed -nre 's/^.*as (.*):.*$/\1/p'| sort | uniq -c | sort -rn
113 f
22 fp
16 fd
... the result is not what I guessed before. The single character f
is very common.
Hi,
thank you for these hints.
Here is some feedback:
I think it is much better to use "fd" and not "f" if you store a file descriptor :-)