Open mrmiguez opened 5 years ago
Some pymods.Record functions that return sorted lists of NamedTuples including lxml elements cause comparison error when there is a repeated element.
Given the structure:
<name> <namePart>Cash</namePart> </name> <name> <namePart>Cash</namePart> </name>
pymods will create the tuples: Name('Cash', '', '', '', '', '', lxml.Element pointer A) Name('Cash', '', '', '', '', '', lxml.Element pointer B)
Name('Cash', '', '', '', '', '', lxml.Element pointer A)
Name('Cash', '', '', '', '', '', lxml.Element pointer B)
The only unique tuple element for sorting is the element pointer, but comparisons between lxml.Elements is not allowed:
TypeError: '<' not supported between instances of 'lxml.etree._Element' and 'lxml.etree._Element'
Really there's no reason for any pymods.Record function or property to return a sorted list. Removing the sort()'s would easily fix this.
sort()
Some pymods.Record functions that return sorted lists of NamedTuples including lxml elements cause comparison error when there is a repeated element.
Given the structure:
pymods will create the tuples:
Name('Cash', '', '', '', '', '', lxml.Element pointer A)
Name('Cash', '', '', '', '', '', lxml.Element pointer B)
The only unique tuple element for sorting is the element pointer, but comparisons between lxml.Elements is not allowed:
TypeError: '<' not supported between instances of 'lxml.etree._Element' and 'lxml.etree._Element'
Really there's no reason for any pymods.Record function or property to return a sorted list. Removing the
sort()
's would easily fix this.