• Raymond Hettinger's avatar
    Cleanup and improve the regex tokenizer example. (GH-10426) · b83942c7
    Raymond Hettinger yazdı
    
    
    1) Convert weird field name "typ" to the more standard "type".
    2) For the NUMBER type, convert the value to an int() or float().
    3) Simplify ``group(kind)`` to the shorter and faster ``group()`` call.
    4) Simplify logic go a single if-elif chain to make this easier to extend.
    5) Reorder the tests to match the order the tokens are specified.
       This isn't necessary for correctness but does make the example
       easier to follow.
    6) Move the "column" calculation before the if-elif chain so that
       users have the option of using this value in error messages.
    b83942c7
Adı
Son kayıt (commit)
Son güncelleme
.azure-pipelines Loading commit data...
.github Loading commit data...
Doc Loading commit data...
Grammar Loading commit data...
Include Loading commit data...
Lib Loading commit data...
Mac Loading commit data...
Misc Loading commit data...
Modules Loading commit data...
Objects Loading commit data...
PC Loading commit data...
PCbuild Loading commit data...
Parser Loading commit data...
Programs Loading commit data...
Python Loading commit data...
Tools Loading commit data...
m4 Loading commit data...
.gitattributes Loading commit data...
.gitignore Loading commit data...
.travis.yml Loading commit data...
CODE_OF_CONDUCT.md Loading commit data...
LICENSE Loading commit data...
Makefile.pre.in Loading commit data...
README.rst Loading commit data...
aclocal.m4 Loading commit data...
config.guess Loading commit data...
config.sub Loading commit data...
configure Loading commit data...
configure.ac Loading commit data...
install-sh Loading commit data...
pyconfig.h.in Loading commit data...
setup.py Loading commit data...