From: Serge N. <Ser...@fr...> - 2009-04-20 12:10:33
|
Hi, everybody. Thanks for the info on "is not" and "!=". If you think the problem is solved, I can commit the changes in 3.1 and trunk There is no bug report for that and we could forget. Peter Landgren a écrit : > Den Monday 20 April 2009 09.41.34 skrev Kees Bakker: > > > On Sunday 19 April 2009, Serge Noiraud wrote: > > > > > > 3 : There is a problem with the following statement: > > > > > > > > > > > > if letter is not last_letter: > > > > > > > I think the "if" was the problem at line 1528. > > > Why ? I don't know. > > > My problem was between the firt letter of Noiraud and noiraud. > > > Theorically, with the upper method applied to the first character, > > > "N".upper() and "n".upper() are the same. > > > but "if letter is not last_letter:" doesn't work in this case. > > > I replace "is not" by "!=" and it works ! > > > > > > If someone can explain that ! > > > > This is basic Python. I'll have to lookup the section in the manual. In > > general you have to understand that "is not" is really very different from > > "!=". > > > > There has been a tendency to replace "!=" by "is not" to improve the speed > > of Gramps. But that optimization has to be done with great care. Not only > > is it sometimes wrong (as shown above), but many times it has no influence > > on the speed of Gramps. > Yes, > The "!= " tests if the values are unequal while > "is not" tests if the involved objects are the same, i. e. refer to the > same memory address. > > /Peter |