Stack Exchange network consists of 183 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.
Ok I just understood your version now. You use only one array, store the hex elements from the middle and store the final from the start reusing the full array at the end. I like it very much, thanks!
oh wow. I didn't wanted to use append to avoid multiple allocations, but the cap trick is nice! but how is yours so much faster than mine? what are those allocations in my version? I explicitly wanted to avoid those, that's whhy I made a byte slice and not string concatenation
Awesome review, thank you! Yes, check_config() is different. I didn't even thought of making config dict-like. I introduced a method config.set_param() and config.get_param() but it's not really better than setattr and getattr. Space typo :)
Wow, I did not even thought about separating the token definitions! I already separated the lexer, because at the first time I was doing parsing also, so even the parser logic was in the __init__ :) but this should clear things out even more! Thanks.