This is very simple question
Nicolas Lehuen
nicolas.lehuen at thecrmcompany.com
Thu Apr 22 10:53:55 EDT 2004
> > return result.reverse() # if you really want it reversed
>
> I agree that divmod() improves the algorithm, and thank
> you for pointing that out.
>
> I'm reasonably certain that the return value of reverse()
> is not what you believe it to be.
> --
>
> Cameron Laird <claird at phaseit.net>
> Business: http://www.Phaseit.net
Ooops indeed, reverse() always returns None, because the reverse is made in place. I did test the program without the reverse, so I missed this mistake. Thanks !
BTW, I've been bitten by this behaviour a lot since I've switched to Python a year ago (coming from C++ and Java)... I would feel much better if reverse(), sort() and so on returned the list itself ; but then maybe other people would think the reversing/sorting etc. would not be done in place...
Regards,
Nicolas
More information about the Python-list
mailing list