#7400: ElementWrapper does not copy the wrapped values when copied
----------------------+-----------------------------------------------------
   Reporter:  hivert  |       Owner:  hivert              
       Type:  defect  |      Status:  needs_work          
   Priority:  major   |   Milestone:  sage-4.3            
  Component:  misc    |    Keywords:  copy, ElementWrapper
Work_issues:          |      Author:  Florent Hivert      
   Upstream:  N/A     |    Reviewer:                      
     Merged:          |  
----------------------+-----------------------------------------------------
Changes (by nthiery):

  * status:  needs_review => needs_work
  * upstream:  => N/A


Comment:

 Replying to [comment:3 hivert]:
 > The new version should do the job ! Please review.
 >
 > Florent

 Up to two small comments below, this is looking good:

 The implementation of copy can probably be simplified a bit by using
 "super":
 {{{
 sage: class bla(SageObject):
 ....:     pass
 ....:
 sage: x = bla(); x.a = []; y = copy(x)
 sage: id(x), id(y), id(x.a), id(y.a)
 (204820300, 205533580, 208011212, 208011212)
 sage: class bla(SageObject):
    def __copy__(self):
        res = copy(super(bla, self))
        res.a = copy(self.a)
        return res
 ....: ....: ....: ....: ....:
 sage: x = bla(); x.a = []; y = copy(x)
 sage: id(x), id(y), id(x.a), id(y.a)
 (204866636, 204866156, 205535372, 204820300)
 }}}

 In the ElementWrapperTester: __repr__ => _repr_

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/7400#comment:4>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica, 
and MATLAB

--

You received this message because you are subscribed to the Google Groups 
"sage-trac" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sage-trac?hl=en.


Reply via email to