osdir.com


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


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