On Wed, Feb 24, 2016 at 1:08 AM, ast <nom...@invalid.com> wrote:
> Hi
>
> Since a class is an object, I ask myself how to define rigorously what a
> class is.
>
> classes are instances from type, but not all, since
> a class may be an instance of a metaclass

All metaclasses are subclasses of type, so all classes are instances of type.

> A class is always callable

It doesn't strictly have to be. You could override the __call__ method
in the metaclass to raise a TypeError if you don't want the class to
be callable. I don't know of a use case for this, though.

> Suppose I provide to you an object and that I
> ask to you to tell me if it is a class or not. How
> would you proceed ?

import inspect
inspect.isclass(x)
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to