Accessing overridden __builtin__s?

Fredrik Lundh fredrik at pythonware.com
Tue Mar 14 06:55:58 EST 2006


Steven D'Aprano wrote:

>> So, if I do:
>>
>> f = SpecialFile.open(name, mode)
>>
>> I get infinite recursion.
>
> I see you are already using an open method. So let me see if I have this
> right: you have a function open, plus an open method? Why?

SpecialFile is a module.  please read the posts you reply to, and please cut out
the "holier than thou" design advice.

overriding builtins is perfectly okay, if it makes sense for the target application.

just remember to use __builtin__ (a module) instead of __builtins__ (a cpython
implementation hack) if you need to access the original builtins.

</F> 






More information about the Python-list mailing list