I have lately been trying to conform to the Python style guide ... Which I believe is a change for the better! There is however one element that it doesn't cover in enough detail for me; the naming convention for functions.
I am writing some code where I have defined a function with the word "to" in it, for example:
def spamtoeggs(arg):
...
I find this hard to read, and would like to know the correct way to write this. I would tend to use the following:
def spam2eggs(arg):
...
Over:
def spam_to_eggs(arg):
...
Note that I interpreted the style guides use of "words" in functions to mean both letters and numbers, and this may have been my downfall...
I have been unable to find an answer to my question online (this SO post comes close), and it if does exist I apologise for duplicating it.
So in short, I am asking are numbers interchangeable for letters within function names?
From the style guide, as you said yourself:
Function Names
Function names should be lowercase, with words separated by underscores as necessary to improve readability.
Including numbers in the identifier is not intrinsically an issue unless they are the start of the identifier. But if you are adhering to the style guide, it is really quite clear. If you are less worried about sticking to the style guide, feel free to use the numbers instead, but... that is not sticking to the style guide, which seems to be your criteria.