Skip to content
Snippets Groups Projects
Commit 94f088d7 authored by Bob Lantz's avatar Bob Lantz
Browse files

Allow natural sort to accept non-strings.

parent 89fb0819
No related branches found
No related tags found
No related merge requests found
...@@ -448,7 +448,7 @@ def natural( text ): ...@@ -448,7 +448,7 @@ def natural( text ):
def num( s ): def num( s ):
"Convert text segment to int if necessary" "Convert text segment to int if necessary"
return int( s ) if s.isdigit() else s return int( s ) if s.isdigit() else s
return [ num( s ) for s in re.split( r'(\d+)', text ) ] return [ num( s ) for s in re.split( r'(\d+)', str( text ) ) ]
def naturalSeq( t ): def naturalSeq( t ):
"Natural sort key function for sequences" "Natural sort key function for sequences"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment