On Thursday 28 May 2015 15:56, Gary Herron wrote: > On 05/27/2015 10:29 PM, Marko Rauhamaa wrote: >> Ben Finney <ben+pyt...@benfinney.id.au>: >> >>> It seems the existing ‘open’ implementation doesn't allow you to >>> override the type of object returned. >> The question is, can you assign to the builtin namespace. I'm guessing >> you can't. > > Of course you can. > > Python2: > >>> __builtins__.open = "whatever"
Don't use __builtins__ with an "s". That's an implementation of CPython and may not exist in the future, and doesn't exist in other implementations. Instead, you should import __builtin__ with no "s". Confusing? It certainly is, which is why Python 3 renamed __builtin__ to builtins. -- Steve -- https://mail.python.org/mailman/listinfo/python-list