#15368: Regression in Context
-------------------------------------------+--------------------------------
               Reporter:  cyberdelia       |         Owner:  SmileyChris       
                 Status:  new              |     Milestone:  1.3               
              Component:  Template system  |       Version:  1.2               
             Resolution:                   |      Keywords:  blocker regression
           Triage Stage:  Accepted         |     Has patch:  1                 
    Needs documentation:  0                |   Needs tests:  1                 
Patch needs improvement:  0                |  
-------------------------------------------+--------------------------------

Comment (by lukeplant):

 Replying to [comment:8 SmileyChris]:
 > luke: elsewhere in core the `__copy__` method had been used, so I was
 just following precidence. I'm also fine with an explicit `.copy()` or
 `.clone()` method.

 Sure, I think it just happens that in this case it is simpler not to
 implement `__copy__()`.

 However, there is a way to implement `__copy__()` and still avoid the need
 for calling constructors - like this:

 {{{
 #!python
 class NoInitArgs(object): pass

 class MyClass(object):
    def __copy__(self):
        duplicate = NoInitArgs()
        duplicate.__class__ = self.__class__
        duplicate.__dict__ = self.__dict__.copy()
        return duplicate
 }}}

-- 
Ticket URL: <http://code.djangoproject.com/ticket/15368#comment:9>
Django <http://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.

Reply via email to