Re: QuerySet subclass based on namedtuple()
I implemented it in a gist https://gist.github.com/876324 -- You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, send email to django-developers@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.
Re: QuerySet subclass based on namedtuple()
Hi Alexander, On 03/15/2011 03:30 AM, Alexander Schepanovski wrote: > It would be nice to have a QuerySet subclass based on namedtuple(). > namedtuples takes less memory than dicts (from ValuesQuerySet), much > more convenient and induce more readable code than tuples > (ValuesListQuerySet). > > Namedtuples use same dot notation as model instances. So the same > simple enough code can operate on both. You can easily upgrade/ > downgrade your queryset when needed. This is an interesting idea. I think it falls into the category of things that can be implemented outside core as a reusable library to prove its usefulness before being considered as a core change. Carl -- You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, send email to django-developers@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.
QuerySet subclass based on namedtuple()
It would be nice to have a QuerySet subclass based on namedtuple(). namedtuples takes less memory than dicts (from ValuesQuerySet), much more convenient and induce more readable code than tuples (ValuesListQuerySet). Namedtuples use same dot notation as model instances. So the same simple enough code can operate on both. You can easily upgrade/ downgrade your queryset when needed. I know namedtuples come only in python 2.6. We can provide a fallback or just don't support this for older pythons. -- You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, send email to django-developers@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.