[Python-Dev] configparser: should optionxform be idempotent?

Serhiy Storchaka storchaka at gmail.com
Thu Mar 7 11:40:12 EST 2019


07.03.19 11:18, Inada Naoki пише:
> So what should we do about optionxform?
> 
> a)  Document "optionxform must be idempotent".
> 
> b) Ensure all APIs calls optionxform exactly once, and document
>     "When you get option name from section objects, it is already
>      optionxform-ed.  You can not reuse the option name if
>      optionxform is not idempotent, because optionxform will be
>      applied to the name again."
> 
> I prefer (a) to (b) because it's simple and easy solution.

I am not expert of configparser, but I prefer (a). The purpose of 
introducing optionxform was to make lowercasing optional.

https://github.com/python/cpython/commit/9e480adf9b3520ea3deb322fd1214f53a2293a0d



More information about the Python-Dev mailing list