Overriding the >> builtin

Xavier Ho contact at xavierho.com
Fri Dec 11 07:07:36 EST 2009


On Fri, Dec 11, 2009 at 12:05 PM, Kevin Ar18 <kevinar18 at hotmail.com> wrote:

>  I am aware of the fact that you can somehow replace the __builtins__ in
> Python.  There is a library here that modifies the >> binary builtins:
> http://github.com/aht/stream.py/blob/master/stream.py
>
> Question: Is there anywhere that explains in detail how to modify the
> builtins in Python like this library did?
>

I did some google and I didn't find anything useful, either. The unofficial
doc on effbot.org gives "See __add__", which is fair enough.

I believe you're after __rshift__ [that is >>], __lshift__ [which is <<], as
starters. There are also __rrshift__ and __rlshift__, but not as useful.

What did you need this anyway? Just curious.

Cheers,
Xav
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20091211/d0c7b032/attachment-0001.html>


More information about the Python-list mailing list