Re: Settings: lists or tuples?

2015-01-22 Thread Andreas Kahnert
Hi again, Well, I can acknoledge that your reasons for list (beginner friendly) are as good as my reasons for tuples (seems to be more logical choice for things that are static). To say it in other words, my idea was simply: Use tuples and the programmer will know that these arn't ment to be alt

Re: Settings: lists or tuples?

2015-01-20 Thread Andreas Kahnert
Just for completness: accidential assignment to the settings object itself could be easily prevented with a __setattr__ method on its class, since django yields on various other places about configuration problems it could not be wrong if the programmer gets noted about an illegal assignment. If

Re: Settings: lists or tuples?

2015-01-19 Thread Andreas Kahnert
I advertise that strongly against lists, because we actually had that kind of issue in our company. One colleague created a list with phrases for some verbose logging in the settings.py. In the view function he promoted this list together with the actual data, also a list which is used for stori

Re: Settings: lists or tuples?

2015-01-19 Thread Andreas Kahnert
Interesting, ... so excuse me. The next point also clearifys my PS from above, lists are over-allocated dynamic sized arrays. (this explains why python is such an memory eater as well as why I experienced performance loss when using the mutability of lists extensivly) Am Montag, 19. Januar 201

Re: Settings: lists or tuples?

2015-01-19 Thread Andreas Kahnert
ctly our settings use-case. Of course Python being > Python you can use them however you like but let's not talk about theory in > that case. > > Cheers > > -- > Loïc > > > > On Jan 20, 2015, at 00:15, Andreas Kahnert > wrote: > > > > Well, yep.

Re: Settings: lists or tuples?

2015-01-19 Thread Andreas Kahnert
PS: python should be able to access tuple members faster, because it can be implemented as array instead of double-linked-structs which are necessary mutable lists. But as far as I know it doesn't. -- You received this message because you are subscribed to the Google Groups "Django developers

Re: Settings: lists or tuples?

2015-01-19 Thread Andreas Kahnert
sequence in the pattern: A = ( 1, 2, ) which is perfectly PEP-conformant and makes reodering elements manually also more easy because you can cut'n'paste whole lines. Am Montag, 19. Januar 2015 17:35:44 UTC+1 schrieb Florian Apolloner: > > On Monday, January 19, 2015 at 3:45:18

Re: Settings: lists or tuples?

2015-01-19 Thread Andreas Kahnert
eing a tuple is making it > necessarily more safe than a list - is the above code really much different > to: > > from django.conf import settings > settings.TEMPLATE_DIRS.append('foo') > > On 19 January 2015 at 14:45, Andreas Kahnert > wrote: > >> I'm

Re: Settings: lists or tuples?

2015-01-19 Thread Andreas Kahnert
> > > On Monday, January 19, 2015 at 12:35:10 PM UTC+1, Andreas Kahnert wrote: >> >> I'm strongly against lists. Lists are mutable objects, their components >> can be changed in place. The settings are initialized at server start and >> after that changes on

Re: Settings: lists or tuples?

2015-01-19 Thread Andreas Kahnert
Hi all, I'm strongly against lists. Lists are mutable objects, their components can be changed in place. The settings are initialized at server start and after that changes on them arn't reflected. Therefore all settings should be tuples from my point of view. Using a custom list/tuple class fo