os.environ.copy()['COPY_HUH'] = "not really"

Jeff Epler jepler at unpythonic.net
Wed May 1 08:53:47 EDT 2002


On Tue, Apr 30, 2002 at 06:42:31PM -0300, Gustavo Niemeyer wrote:
> >>> copy = os.environ.copy()
> >>> print copy.__class__
> os._Environ
> 
> It's not a real dictionary, but an os._Environ class. Copying it
> creates instances of the same class, and that class' behavior is
> to insert the item in the environment. I belive this should be
> avoided in this case, returning a true dictionary from copy(). I'll
> send a patch to SourceForge, if you haven't done so yet.

I was tempted to send a patch to SF, but I was worried that there was
some "good" reason for this feature.  Maybe it's just an accident
waiting to be fixed after all.  If you have a patch prepared, by all
means submit it.

Jeff





More information about the Python-list mailing list