[Python-Dev] Structural cleanups to the main CPython repo

"Martin v. Löwis" martin at v.loewis.de
Tue May 28 18:47:47 CEST 2013

Am 28.05.13 18:20, schrieb Antoine Pitrou:
> Le Tue, 28 May 2013 23:07:37 +1000,
> Nick Coghlan <ncoghlan at gmail.com> a écrit :
>> It was deliberate - a big part of PEP 432 is making sure that all the
>> interpreter state lives *in* the interpreter state (as part of the
>> config struct). 
> It sounds a bit exagerated. We have encoders and decoders in the same
> (C) modules, compressors and decompressors ditto. Why not keep
> initialization and finalization in the same source file too?

I can sympathize with the motivation. Unlike encoders and decoders,
it is *very* tempting to put interpreter state into global variables.
With encoders and decoders, it's clear that globals won't work if you
have multiple of them. With interpreter state, it's either singletons
in the first place, or the globals can be swapped out when switching

By splitting initialization and finalization into distinct translation
units, you make it much more difficult to introduce new "hidden"


More information about the Python-Dev mailing list