On 2 Jun 2010, at 22:31, Luke Plant wrote:

> 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.

Yeah, this idea came up at the sprints, but it's a little too magic for my 
tastes.

Ben

-- 
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.

Reply via email to