3 ms·
Thanks for taking a look! To answer some of your questions: the goal of this (the concept rather than just this python implementation) is to read keys and valu
by stephenr 7y ago
Thanks for taking a look!
To answer some of your questions: the goal of this (the concept rather than just this python implementation) is to read keys and values out of 'ini' formatted files from shell, by detecting which other languages can run on the machine (so far, python2, python3, php with DBA support, and php without DBA support), but Python's idea of what constitutes a valid 'ini' file is more restrictive than other languages, in that it doesn't allow for values before the first section heading (the parts in square brackets). So that's why it inserts a 'fake' section header and passes the StringIO object rather than just the file itself.
I'll look into argparse - being in the stdlib is a must - the only reason this (or it's counterpart in php) exists is because so far I've found no practical/reliable way to reliably read/write ini files via pure shell. Having to package up extra libs, or require a non-standard lib would defeat the purpose.
I wonder if that's going to be the situation with 'six' - is it a runtime library, or more of a 'build' tool, to transpile from 3 to 2?
I honestly don't remember why I ended up using the RawConfigParser rather than just ConfigParser - maybe one of the options for ConfigParser (e.g. disabling interpolation), wasn't available in earlier 3.x releases. I'll try this again when looking at the above points.
Thanks for your input, it's very much appreciated!
- LockAndLol 7y ago> I wonder if that's going to be the situation with 'six' - is it a runtime library, or more of a 'build' tool, to transpile from 3 to 2? It's a runtime library. [2to3] is in the stdlib and transpiles. > To answer some of your questions: That whole paragraph could be put at the top of the file in a triple-quote. It explains what the file is for pretty nicely. If you end up using argparse it could be in the description :) I'm glad I could help somehow. Have a nice easter! [2to3]: https://docs.python.org/3/library/2to3.html https://docs.python.org/3/library/2to3.html