On 07/19/2018 04:47 PM, Jeff Law wrote: > On 07/18/2018 03:28 PM, Segher Boessenkool wrote: >> On Wed, Jul 18, 2018 at 11:51:36AM +0200, Richard Biener wrote: >>> We already conditionally require Perl for building for some targets so I >>> wonder >>> if using perl would be better ... >> >> At least perl is GPL (Python is not). >> >> >> What would the advantage of using Python be? I haven't heard any yet. >> Awk may be a bit clunky but at least it is easily readable for anyone. > I've found python *far* easier to read than awk. And you can actually > run a debugger on your python code to see what it's doing. > Jeff >
Yes, using Python is mainly because of object-oriented programming paradigm. It's handy to have encapsulation of functionality in methods, one can do unit-testing of parts of the script. Currently AWK scripts are mix of input/output transformation and various emission of printf('#error..') sanity checks. In general the script is not easily readable and contains multiple global arrays that simulate encapsulation in classes. Martin