How python custom class differ from any other in-built object like list?
Question: I m not sure my question title is correct but :

My problem is :

When I created a new class called **classA** and i did **deepcopy** to another
name called **classB** and did **equality and identity test** :

Here is my first snippet: Creating class using `type`

    
    
    >>> import copy
    >>> classA = type('X', (object,), {})
    >>> classB = copy.deepcopy(classA)
    >>> classB is classA
    True
    >>> classB == classA
    True
    >>>
    

Second snippet: testing on class creating by using keywords 'class':

    
    
    >>> class X(object): pass
    ...
    >>> import copy
    >>> Y = copy.deepcopy(X)
    >>> Y is X
    True
    >>> Y == X
    True
    >>>
    

Third snippet: And when i do the same testing on list object:

    
    
    >>> import copy
    >>> objA = list()
    >>> objB = copy.deepcopy(objA)
    >>> objB == objA
    True
    >>> objB is objA
    False
    >>>
    

Why the first and remaining two are different ? Could someone please explain
me ?


Answer: It is [documented](http://docs.python.org/2/library/copy.html) behavior:

> This module does not copy types like module, method, stack trace, stack
> frame, file, socket, window, array, or any similar types. It does “copy”
> functions and classes (shallow and deeply), by returning the original object
> unchanged; this is compatible with the way these are treated by the pickle
> module.

As to why it was done that way, presumably it was because people don't have a
lot of need for having multiple identical but distinct classes.

