[docs] [issue37598] Don't use _ as a function name in logging documentation cookbook
report at bugs.python.org
Mon Jul 15 17:09:59 EDT 2019
Vinay Sajip <vinay_sajip at yahoo.co.uk> added the comment:
The comment at the end of the "_ = ..." line indicates clearly that it's optional to do that, and I assume that any reader will realise that they can use any suitable variable name rather than "_". There's no particular "recommendation" to use "_" and cookbook recipes are generally regarded as starting points for one's own code, rather than being copied verbatim into production scenarios.
I specifically picked "_", despite knowing its other uses, because:
* One use of "_" is as a function that does some form of translation on a passed string argument - language translation being the most common example - and this recipe is a very loose analogue of that type of usage
* A very brief notation assists readability because once you've looked at the "_" definition, you can use constructions like the one further down in the recipe.
Since "_" wasn't picked at random, I'd rather not change it - if people decide to use this recipe, it would be better for brevity and standardisation if "_" were to be used, IMO.
I don't believe the usage of "_" in interactive interpreter sessions is relevant to this cookbook recipe and shouldn't, in my opinion, cause confusion, any more than where the use of "_" for language translations is being explored in an interactive session.
In summary - please don't waste your time on this, though I appreciate the intent behind your suggestion - thanks.
Python tracker <report at bugs.python.org>
More information about the docs