Python's "only one way to do it" philosophy isn't good?

Lenard Lindstrom len-l at
Tue Jul 3 07:23:11 CEST 2007

Douglas Alan wrote:
> Lenard Lindstrom <len-l at> writes:

>>> Or are you suggesting that early in __main__.main(), when I wish to
>>> debug something, I do something like:
>>> = __builtins__.file = MyFile
>>> ?
>>> I suppose that would work.
>> No, I would never suggest replacing a builtin like that. Even
>> replacing a definite hook like __import__ is risky, should more than
>> one package try and do it in a program.
> That misinterpretation of your idea would only be reasonable while
> actually debugging, not for standard execution.  Standard rules of
> coding elegance don't apply while debugging, so I think the
> misinterpretation might be a reasonable alternative.  Still I think
> I'd just prefer to stick to the status quo in this regard.

I totally missed the "when I wish to debug something". Skimming when I 
should be reading.

Lenard Lindstrom
<len-l at>

More information about the Python-list mailing list