Posts: 4,560
Threads: 1,464
Joined: Sep 2016
you can detect if x is a float like:
if isinstance(x,float):
...
so how do you detect if x is a file?
Tradition is peer pressure from dead people
What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Posts: 4,560
Threads: 1,464
Joined: Sep 2016
i want to check if what is passed to a function in stdout= is a file or file descriptor. for file descriptor, checking for int is good enough. but assuming whatever is not int is a file i think is not good enough ... something might
succeed with something else. i want an explicit test. right now i am checking
if 'fileno' in stdout
. i want this to work in the widest range of python versions as possible but at least 2.6-2.7 and 3.3-.
Tradition is peer pressure from dead people
What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Posts: 4,560
Threads: 1,464
Joined: Sep 2016
(Feb-11-2017, 03:54 AM)micseydel Wrote: I also don't understand what you mean about file descriptors. That sounds like C-talk. In Python, it's an object, not a numeric.
as in os.pipe() ... how i connect 2 or more processes together in a command pipeline.
Tradition is peer pressure from dead people
What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.