Argument name should be lowercase

MRAB python at mrabarnett.plus.com
Fri Nov 11 10:03:32 EST 2022


On 2022-11-11 08:54, dn wrote:
[snip]
> 
> The module's function definition is:
> 
> def build_product_prices_dictionary( WORKBOOK_DEFINITIONS:dict )->dict:
> ...
>       price_array = xl.iget_array(
>           file_name=WORKBOOK_DEFINITIONS[ "file_name" ],
>           ...
> 
> (the function def is flagged, as above)
> 
> 
> A quick scan of PEP-008 failed to yield anything relevant. Why is this
> frowned upon as poor Python, or a matter of style?
> 
> Yes, a dict is mutable, but the upper-case denoting a constant indicates
> that none of its values are to be changed by the programmer.
> 
> As far as the function is concerned, the dict and its contents are
> constants.
> (but the dict can't be treated as a global ENV[IRONMENT] object, because
> it has to cross into the module's namespace)
> 
[snip]
I think the problem is that the dict _is_ mutable, so it's not a 
constant; it's read-only, which is not the same thing.


More information about the Python-list mailing list