[Python-Dev] Re: native code compiler? (or, OCaml vs. Python)
holger krekel
pyth@devel.trillke.net
Mon, 3 Feb 2003 23:20:51 +0100
Guido van Rossum wrote:
> > > (We could make random.__dict__ read-only, like the new-style class
> > > __dict__, if you worry about other ways of stuffing unexpected
> > > variables inside it.
> >
> > do you mean specifically random.__dict__ or any modules dict?
>
> Any module's dict.
>
> > If the latter there would be quite some breakage. It is at least
> > used for monkey patching modules to make them "unittestable" which
> > is a valid use case IMO.
>
> Why would this be done by patching the module's __dict__ rather than
> assigning to attributes of the module?
I shortcircuited that with a module's readonly __dict__ you couldn't
do a setattr on the module anymore. Which is not neccessarily so.
thanks,
holger