Naming conventions for functions and methods

Arnaud Delobelle arnodel at
Tue Jul 8 20:31:26 CEST 2014

On 8 July 2014 15:59, <python at> wrote:
> Looking for your opinions on how you name your functions and methods. Example: I have a function that hashes a file. I could name this function hash_file() or file_hash(). The 1st naming convention sounds more natural, the 2nd naming convention allows one to group related functions together by the object being acted on. PEP-8 doesn't appear to offer guidance in this area. Thoughts? Malcolm

If you want to group related functions together, I would suggest
putting them in a module, e.g. 'fileutils'.  I'd still go for hashfile
for the function name though.


More information about the Python-list mailing list