(x)
return _reconstruct(x, None, *rv)
Shallow copy operation on arbitrary Python objects.

    See the module's __doc__ string for more info.
Shallow copy operation on arbitrary Python objects.
Shallow copy operation on arbitrary Python objects .
def copy(x):
    """Shallow copy operation on arbitrary Python objects.

    See the module's __doc__ string for more info.
    """

    cls = type(x)

    copier = _copy_dispatch.get(cls)
    if copier:
        return copier(x)

    if issubclass(cls, type):
        # treat it as a regular class:
        return _copy_immutable(x)

    copier = getattr(cls, "__copy__", None)
    if copier is not None:
        return copier(x)

    reductor = dispatch_table.get(cls)
    if reductor is not None:
        rv = reductor(x)
    else:
        reductor = getattr(x, "__reduce_ex__", None)
        if reductor is not None:
            rv = reductor(4)
        else:
            reductor = getattr(x, "__reduce__", None)
            if reductor:
                rv = reductor()
            else:
                raise Error("un(shallow)copyable object of type %s" % cls)

    if isinstance(rv, str):
        return x
    return _reconstruct(x, None, *rv)
def copy ( x ) : cls = type ( x ) copier = _copy_dispatch . get ( cls ) if copier : return copier ( x ) if issubclass ( cls , type ) : # treat it as a regular class: return _copy_immutable ( x ) copier = getattr ( cls , "__copy__" , None ) if copier is not None : return copier ( x ) reductor = dispatch_table . get ( cls ) if reductor is not None : rv = reductor ( x ) else : reductor = getattr ( x , "__reduce_ex__" , None ) if reductor is not None : rv = reductor ( 4 ) else : reductor = getattr ( x , "__reduce__" , None ) if reductor : rv = reductor ( ) else : raise Error ( "un(shallow)copyable object of type %s" % cls ) if isinstance ( rv , str ) : return x return _reconstruct ( x , None , * rv )