On 01/19/2015 01:13 PM, Andreas Kahnert wrote:
> 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 storing the data
> afterwards, to another function. The other function was implemented by
> another colleague, he was aware that he should not modify the second
> list for not corrupting the data to be safed. So he appended the data
> components to the first list zipped it to an dict and called the logging
> function. The result was that every log entry contained all data from
> previous calls and the server loked down very quick. It took them a day
> to debug this.

There is nothing in this anecdote that is specific to Django settings,
or even to Django. The appropriate lesson to be learned from it is
general to Python: no function that takes mutable objects as parameters
should ever mutate those objects (unless that side-effect is its
intended purpose, and that fact is clearly advertised in its
contract/documentation/docstring). Hopefully the second colleague in
your anecdote learned that lesson.

I don't see a reason here to prefer tuples over lists in settings.

Carl

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To post to this group, send email to django-developers@googlegroups.com.
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/54BD6B86.8010906%40oddbird.net.
For more options, visit https://groups.google.com/d/optout.

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to