On Sat, Jan 25, 2014 at 3:31 AM, Asaf Las <(E-Mail Removed)> wrote:
> Hi
>
> Is there way to get list of instances of particular
> class through class itself? via metaclass or any other method?
Not automatically, but you can make a class that keeps track of its
instances with a weak reference system.
> Another question - if class is object is it possible
> to delete it? If it is possible then how instances
> of that class will behave?
It's possible to unbind the name, but every instance retains a
reference to its class, so the class itself won't disappear until
there are no instances left of it.
ChrisA
> Hi
>
> Is there way to get list of instances of particular
> class through class itself? via metaclass or any other method?
Not automatically, but you can make a class that keeps track of its
instances with a weak reference system.
> Another question - if class is object is it possible
> to delete it? If it is possible then how instances
> of that class will behave?
It's possible to unbind the name, but every instance retains a
reference to its class, so the class itself won't disappear until
there are no instances left of it.
ChrisA
Aucun commentaire:
Enregistrer un commentaire