Ulrich Eckhardt <ulrich.eckha...@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. > > Suggestions?
Why bother checking types at all? def foo(file_or_string): try: data = file_or_string.read() except AttributeError: data = file_or_string ... use data ... -- Duncan Booth http://kupuguy.blogspot.com -- http://mail.python.org/mailman/listinfo/python-list