copy.deepcopy() doesn't (for class objects): any thoughts?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • bartonc
    Recognized Expert Expert
    • Sep 2006
    • 6478

    copy.deepcopy() doesn't (for class objects): any thoughts?

    I was playing around with the Simple Metaclassing thread and found something odd:[CODE=python]
    >>> class aClass:
    ... classVar1 = 'hello'
    ... def __init__(self, arg1):
    ... self.instVar1 = arg1
    ...
    >>> anInstance = aClass('world')
    >>> import copy
    >>> bClass = copy.deepcopy(a nInstance.__cla ss__)
    >>> bClass
    <class __builtin__.aCl ass at 0x02FA7240>
    >>> aClass
    <class __builtin__.aCl ass at 0x02FA7240>
    >>> bClass = copy.deepcopy(a Class)
    >>> bClass
    <class __builtin__.aCl ass at 0x02FA7240>[/CODE]
Working...