Question about math.pi is mutable

Ian Kelly ian.g.kelly at gmail.com
Sun Nov 8 14:51:03 EST 2015


On Nov 8, 2015 12:01 PM, "BartC" <bc at freeuk.com> wrote:
>
> But then, you say that additional attributes, potentially millions of
different ones, can be invented at runtime. Although I don't see how it can
remove names that are part of the source code: if "A.B" is in the file,
then surely "A" and "B" always have to be present in some table or other.

Gratuitous example:

def factory(name):
    class inner:
        # stuff
    inner.__name__ = name
    return inner

One = factory('One')
Two = factory('Two')

# factory is no longer needed, so remove it from globals.
del factory



More information about the Python-list mailing list