[Tutor] iteration is overwriting the previous set value

bob bgailer at alum.rpi.edu
Thu Oct 20 02:56:12 CEST 2005


At 04:16 PM 10/19/2005, Jonas Melian wrote:
>def _pre_save(self):
>     for field in [self.name, self.native_name]:
>         if not field.istitle():
>             #print field.title()
>             field = field.title()

And FWIW there is no benefit in using "if not field.istitle():" since it 
calculates the title value anyway you might just as well assign it without 
checking. 



More information about the Tutor mailing list