On Tuesday 01 June 2010 11:43:30 henning.schroe...@gmail.com wrote: > On May 30, 7:24 am, Waldemar Kornewald <wkornew...@gmail.com> wrote: > > Maybe I missed something, but why don't you use __new__ instead > > of copying the instance? > > Here is an example where I used __new__ for class based views in my > project: > http://djangosnippets.org/snippets/2046/ > No __call__ or as_view is needed with this approach. > I can easily replace a function with a class without changing the > url configuration.
This is an interesting approach. The only downside I can think of at the moment is that implementing __new__() like that really violates expectations - Python programmers have a fairly strong expectation that if you do 'x = SomeClass()', where SomeClass is defined as a class, then x will be an instance of SomeClass. Luke -- "Oh, look. I appear to be lying at the bottom of a very deep, dark hole. That seems a familiar concept. What does it remind me of? Ah, I remember. Life." (Marvin the paranoid android) Luke Plant || http://lukeplant.me.uk/ -- You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, send email to django-develop...@googlegroups.com. To unsubscribe from this group, send email to django-developers+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-developers?hl=en.