2007/8/21, Alex Gutteridge <alexg / kuicr.kyoto-u.ac.jp>:
> Sorry for the duplicate! Robert is too fast for me.

It's always good to see more solutions.  I like the conciseness of
your solution. But I think this should rather be a class method
because you would not do the test on an open stream. Dunno which of
the solutions is more realistic.  Might be fun to let both approaches
test a large number of files and compare their results (probably also
with output from "file"). :-)

Btw, you should get rid of the ternary operator - it's totally
superfluous because there is no point in converting a boolean value
into a boolean value. :-)

Kind regards

robert