I'd like to return a custom file object, say my own subclass. I can easily subclass the file object: from io import TextIOWrapper class MyFile(TextIOWrapper): pass but how do I tell open() to use MyFile? Answers for Python 3, thanks. -- Steven