[Tutor] Proxies/Interceptors for file-like objects

Kent Johnson kent37 at tds.net
Thu Feb 19 12:46:26 CET 2009


On Thu, Feb 19, 2009 at 6:03 AM, Lie Ryan <lie.1296 at gmail.com> wrote:

> If you replace sys.stdin with your own file object, you don't need to
> define all of the file object interface, just the one that generates an
> error if not defined (i.e. the ones that you use).

Yes, probably just defining read() and readline() are enough, you
might be able to leave __getattr__() out of your wrapper class.

Kent


More information about the Tutor mailing list