Hi Stefan, > sorry for the late reply. But since no-one else replied, it doesn't seem an > important > topic for the readers.
No harm done. I gathered that much ;-) > > According to https://www.w3.org/TR/xmlschema-2/#integer 1000_000 is not a > valid integer literal. But it is for Python since 3.6. > > > > The magic lxml.objectify type lookup/annotation simple does int(s) and > > interprets > success as "shall be interpreted as int". > > One could argue that - when parsing XML data - this is not the > > right/sane/intuitive choice. Or is it? :-) <x>1000_000</x> is not an > > integer in the > XML world. > > Then we shouldn't make it one. It's unlikely that data gets passed through > XML in > Python syntax. We have the same for "True" and "False", which come out as str, > not bool. And this applies to FloatElement as well, which uses > float() as parser and thus also supports "_" in Py3.6+. > > I'll see what I can come up with. Great. So maybe you want to flex your lxml muscles - otherwise, if you prefer I could probably come up with a PR myself (though not in the next 5 weeks). I'd need to know if keeping existing behaviour is a must due to compatibility reasons (i.e. make the change opt-in) or if breaking current behavior would be ok in this case (maybe with an opt-out). The obvious thing that comes to mind is restricting the incoming literal using some regex, but maybe it's better to rip some toned-down int parsing from CPython? I haven't looked. Best, Holger Landesbank Baden-Wuerttemberg Anstalt des oeffentlichen Rechts Hauptsitze: Stuttgart, Karlsruhe, Mannheim, Mainz HRA 12704 Amtsgericht Stuttgart HRA 4356, HRA 104 440 Amtsgericht Mannheim HRA 40687 Amtsgericht Mainz Die LBBW verarbeitet gemaess Erfordernissen der DSGVO Ihre personenbezogenen Daten. Informationen finden Sie unter https://www.lbbw.de/datenschutz. _______________________________________________ lxml - The Python XML Toolkit mailing list -- lxml@python.org To unsubscribe send an email to lxml-le...@python.org https://mail.python.org/mailman3/lists/lxml.python.org/ Member address: arch...@mail-archive.com