[Python-ideas] Implicit submodule imports
Guido van Rossum
guido at python.org
Fri Sep 26 19:49:56 CEST 2014
On Fri, Sep 26, 2014 at 10:43 AM, <random832 at fastmail.us> wrote:
> On Fri, Sep 26, 2014, at 00:24, Guido van Rossum wrote:
> > There is no custom allocation for modules, and even for float I don't see
> > how switching types back and forth between float and a subclass could
> > corrupt the free list
>
> For float I'd be worried more about the fact that it's supposed to be
> immutable. It would be entirely reasonable for an implementation to make
> all floats with the same value the same object (as cpython does do for
> ints in a certain range), and what happens if you change its type then?
> And even if it doesn't do so, it does for literals with the same value
> in the same function.
>
> So, realistically, an immutable type (especially an immutable type which
> has literals or another interning mechanism) needs to forbid __class__
> from being assigned.
>
That's also a good one, but probably not exactly what the code we're
discussing is protecting against -- the same issue could happen with
immutable values implemented in pure Python. It's likely though that the
HEAPTYPE flag is a proxy for a variety of invariants maintained for the
built-in base types, and that is what makes it smell like dragon.
--
--Guido van Rossum (python.org/~guido)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20140926/a09daf34/attachment-0001.html>
More information about the Python-ideas
mailing list