#7400: Element does not copy its __dict__ when copied, ElementWrapper does not
copy the wrapped values when copied
----------------------+-----------------------------------------------------
Reporter: hivert | Owner: hivert
Type: defect | Status: needs_review
Priority: major | Milestone: sage-4.3.1
Component: misc | Keywords: copy, ElementWrapper
Work_issues: | Author: Florent Hivert
Upstream: N/A | Reviewer: Nicolas M. ThiƩry
Merged: |
----------------------+-----------------------------------------------------
Comment(by hivert):
Replying to [comment:12 nthiery]:
> > > Is there a reason not to use {{{super(Element, self).__copy__()}}}
in Element.__copy__?
> > A very good one:
> > {{{
> > AttributeError: 'super' object has no attribute '__copy__'
> > }}}
>
> :-)
>
> Oops, I meant: copy(super(Element, self)). Btw: does
copy(super(Element,self)) work for ElementWrapper? I think I vaguely
prefer it if it works.
If you look at the way copy works, you'll realize that there is no chance
that this works... And indeed:
{{{
File "/usr/local/sage/sage-4.2/devel/sage-
combinat/sage/structure/element.pyx", line 322:
sage: blo.__dict__ is bla.__dict__
Expected:
False
Got:
True
}}}
Any more suggestion you don't want to try by yourself ;-)
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/7400#comment:13>
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.