Hi Łukasz, Sorry for getting back to you now. Thanks Russell for the comments. As Russell says, it's more of a conceptual choice. My first implementation of this API was using tuples for the same reason you said above. I think ImmutableList is a good compromise between list and tuple. It overrides a tuple (so it should be performant) and is still conceptually a list. Is this clear? please let me know if you want me to explain further our decision on this.
Daniel On Monday, August 4, 2014 4:54:45 PM UTC+2, Łukasz Rekucki wrote: > > On 4 August 2014 16:14, Daniel Pyrathon <[email protected] <javascript:>> > wrote: > > Hi All, > > > > This has been resolved by using the ImmutableList datastructure > > > > > https://github.com/PirosB3/django/blob/soc2014_meta_refactor_upgrade_flags_get_field_tree/django/db/models/options.py#L629 > > > > > But why? What's the benefit over using a tuple? ImmutableList is not > even a list, because it inherits from tuple. > > The only other use of this data structure I could find is in upload > handlers and the rationale is that the field suddenly changes from > mutable to immutable. I don't think your case is the same, as fields > are always immutable. > > Also, if fields() is immutable, then so should concrete_fields(), etc. > > > > > > On Monday, August 4, 2014 2:44:38 PM UTC+2, Collin Anderson wrote: > >> > >> if we do really need a list, could we gain some performance by caching > >> tuples and converting them to lists instead of caching lists? > > > > -- > > You received this message because you are subscribed to the Google > Groups > > "Django developers" group. > > To unsubscribe from this group and stop receiving emails from it, send > an > > email to [email protected] <javascript:>. > > To post to this group, send email to [email protected] > <javascript:>. > > Visit this group at http://groups.google.com/group/django-developers. > > To view this discussion on the web visit > > > https://groups.google.com/d/msgid/django-developers/f4795467-24c7-4a61-af78-1a5b1a16299d%40googlegroups.com. > > > > > > For more options, visit https://groups.google.com/d/optout. > > > -- > Łukasz Rekucki > -- You received this message because you are subscribed to the Google Groups "Django developers" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/django-developers. To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/4a1a4b6e-87c5-4554-b47a-2d7dbdae6a64%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
