> > 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.
>
> https://github.com/lxml/lxml/commit/83e6c031994d553b74991501c6cd85e3517fadd
> 8

Works great! Nice touch with the fuzzy tester ;-).

Some super-simple "benchmarking" indicates there's no noticeable slowdown:

# we're on 4.6.2 so far, haven't bothered to update to latest 4.6.3 release
0 $ (PYTHONPATH=$PYTAF_HOME/2020-Q3-V2/lib/python3.6/site-packages/ python3 -c 
'from lxml import etree, objectify; print(etree.__version__); root = 
objectify.XML("<root><x>1000000</x><y>1000_000</y></root>"); 
print(objectify.dump(root))')
4.6.2
root = None [ObjectifiedElement]
    x = 1000000 [IntElement]
    y = 1000000 [IntElement]
0 $ (PYTHONPATH=$PYTAF_HOME/2020-Q3-V2/lib/python3.6/site-packages/ python3 -m 
timeit -r 5 -n 1000000 --setup 'from lxml import etree, objectify' 'root = 
objectify.XML("<root><x>1000000</x><y>1000_000</y></root>")')
1000000 loops, best of 5: 17.5 usec per loop

# current gh version (version number still 4.6.3, from latest release)
0 $ (PYTHONPATH=build/lib.linux-x86_64-3.6/ python3 -c 'from lxml import etree, 
objectify; print(etree.__version__); root = 
objectify.XML("<root><x>1000000</x><y>1000_000</y></root>"); 
print(objectify.dump(root))')
4.6.3
root = None [ObjectifiedElement]
    x = 1000000 [IntElement]
    y = '1000_000' [StringElement]
0 $ (PYTHONPATH=build/lib.linux-x86_64-3.6/ python3 -m timeit -r 5 -n 1000000 
--setup 'from lxml import etree, objectify' 'root = 
objectify.XML("<root><x>1000000</x><y>1000_000</y></root>")')
1000000 loops, best of 5: 17.1 usec per loop

(No it's not faster, this is just a lucky timeit run - but it's absolutely in 
the same ballpark as before)

Thanks a lot!

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

Reply via email to