I will compile the regexp in a variable called DIGITS_OR_NONDIGITS. I will use list compression. I used a loop before, as there were originally more code in the loop.
About the memory usage: It is approximately same as before. The only difference is, that we are storing keys for the strings instead of the strings themself. What is key?: It is a list of string keys and integers. If you compare them, it will compare the elements. Example: strings: sort([u'Item 2', u'Item 1b'], key=get_natural_key) keys: sort([[u'item ', 2], [u'item ', 1, u' b']]) u'item ' == u'item ' 1 < 2 So, key is a item per song, which provides __gt__(), __lt__(), and __eq__() methods for a correct sorting order. -- https://code.launchpad.net/~m2j/openlp/bug-1094342/+merge/156292 Your team OpenLP Core is subscribed to branch lp:openlp. _______________________________________________ Mailing list: https://launchpad.net/~openlp-core Post to : [email protected] Unsubscribe : https://launchpad.net/~openlp-core More help : https://help.launchpad.net/ListHelp

