[Python-Dev] deleting setdefaultencoding iin site.py is evil

"Martin v. Löwis" martin at v.loewis.de
Thu Aug 27 09:53:23 CEST 2009

Chris Withers wrote:
> Martin v. Löwis wrote:
>>>> In retrospect, it should have been called sys._setdefaultencoding().
>>>> That sends an extra signal that it's not meant for general use.
>>> Crazy idea: how about mutating it into sys._setdefaultencoding rather
>>> than deleting it?
>> Please don't post crazy ideas unless you really mean them.
>> This specific crazy idea must be rejected; it would break backwards
>> compatibility, for no good reason.
> How is it breaking backwards compatibility?
> - If people were somehow relying on sys.setdefaultencoding to be
> deleted, that's fine, it's still gone
> - If people were somehow relying on sys not having an attribute called
> _setdefaultencoding, or were relying on stuffing an attribute into sys
> called _setdefaultencoding then... well... that seems pretty unlikely ;-)

If people were using the reload trickery, that would break if the
function changed its name.


More information about the Python-Dev mailing list