On Tue, Oct 4, 2011 at 4:35 AM, Johannes Dollinger
<[email protected]> wrote:
> Thanks for starting this!
> Why did you chose a staticmethod instead of an instancemethod?
because it's applied recursively not just to tree.Node, but to the
children and all members. it would be cleaner as a free function and
an instance method on tree.Node that just calls it.
> While I'm not sold on the method name (perhaps prefix() or shift() or even
> __rshift__() would be clearer), I believe the ability to modify Q objects
> outside of filter()-Expressions is important.
__rshift__() is too C++ for my taste :-) but I see the motivation.
> Just like &, |, and ~, adding a prefix is an operation on Q objects. And the
> API should provide a way to manipulate them fully outside of QuerySets.
>
> As an afterthought: The cleanest solution would probably be an implementation
> in Q.__init__.
> The .push() method would then be unnecessary, as you could write
> Q(foo=Q(...)) instead of Q(..).push('foo').
> And .filter()/.exclude() would just work, as they simply pass their arguments
> through to Q.__init__.
yes, that sounds cleaner. i'm still not sure if that should be on Q
or on tree.Node.
--
Javier
--
You received this message because you are subscribed to the Google Groups
"Django developers" 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/django-developers?hl=en.