about types.new_class and module
Jimmy Girardet
ijkl at netc.fr
Mon Mar 4 14:51:39 EST 2019
Thank you for the clarification.
I thought everything was bounded to anything.
Shouldn't the name be changed from `types.A` to `unbound.A` to be less
confusing ?
Le 04/03/2019 à 20:31, MRAB a écrit :
>>
> 'new_class' creates a new class with the given name and returns a
> reference to it.
>
> The class doesn't 'live' anywhere.
>
> Although you might /think/ that an object lives in a certain
> namespace, it's just that there's a name there that's bound to the
> object.
>
> You can, in fact, create 2 classes with the same name.
>
> >>> import types
> >>> t1 = types.new_class('A')
> >>> t2 = types.new_class('A')
> >>> t1 is t2
> False
More information about the Python-list
mailing list