Proposed PEP: Treating Builtins as Constants in the Standard

Peter Hansen peter at engcorp.com
Mon Apr 19 08:09:56 EDT 2004


Yermat wrote:

> Raymond Hettinger wrote:
>> PEP: 329
>> Title: Treating Builtins as Constants in the Standard Library
>> Author: Raymond Hettinger <python at rcn.com>
>>
>> Abstract
>> ========
>>
>> This proposal is to add a private function for treating builtin
>> references as constants and to apply that function throughout
>> the standard library.
> 
> Is it really a good thing to do it manually?
> Shouldn't be done automatically by a simple analyser?

Not requiring that it be done manually, or at least not providing
a simple means of disabling it, would prevent some kinds of
automated testing.  The most easily demonstrated one is where
the builtin open/file calls are replaced with a simulated ("mock")
file system which applies to *all* modules, not just a single
module under test.  This functionality is critical to some people
using Python with the Test-Driven Development approach to software.

-Peter



More information about the Python-list mailing list