Of course you are right. I already changed that in my real code. This one here was just for having as simple code as possible in the mailing list post.
This reminds me of this tweet: http://twitter.com/pht/status/1302494813 I always try to keep an eye on naming stuff, even if it means thinking about it a lot :( Thanks again On Mar 11, 11:58 am, Malcolm Tredinnick <malc...@pointy-stick.com> wrote: > On Wed, 2009-03-11 at 02:25 -0700, johan.u...@student.hpi.uni-potsdam.de > wrote: > > > Thanks a lot. I was just blind eyed yesterday I think. Corrected code > > is: > > > {% for key,value in dictionary.items %} > > <h2>{{key|date:"Y-m-d"}}</h2> > > {% for key,value in value.items %} > > <h3>{{ key.0|date:"H.i" }} - {{ key.1|date:"H.i" }}</ > > h3> > > Speaking as somebody who regularly maintains code written two to three > years earlier in a number of projects, I would seriously think of not > reusing "key" and "value" in both loops. As things get more complicated, > and particularly if you use that as a general pattern in your work, you > will go cross-eyed trying to work out if there are scoping (or > accidental variable hiding) problems. > > Basically, try to write code so that something that looks wrong *is* > wrong. In this, it looks potentially wrong, but turns out to work. That > kind of slight brain speed-bump won't help you spot real errors quickly > in the future. > > Regards, > Malcolm --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---