[Python-Dev] Module names in Python: was Re: python 2.5alpha and naming schemes (original) (raw)

Dennis Heuer dh at triple-media.com
Fri Apr 21 06:07:50 CEST 2006


There's also a difflib though the module doesn't look like a wrapper for diff. The math module is not called mathlib though. Python is quite inconsistent here. On the one hand it tries to use human-understandable terms and on the other hand it takes the easy approach, which means it falls back to common ways of naming in the C world.

However, the module hashlib is not really a 'hashing library'. The term 'hash' is quite abstract and not really appropriate. The term 'lib' is quite displaced in the python world. 'hashmod' would be more appropriate but also very bad.

The hashing algorithms can be used for very different things. They are mainly just converters. Hashing is only a buzzword-like synonym for 'encoding without the chance for decoding'. Possibly there should be an extra section (main module) called 'converters', which assorts all the en/decoders like punycode, zip, or md5 in submodules. The 'hashlib' submodule could be called 'cryptographic', for example:

converters.cryptographic.sha

This is possibly too long but one should keep this in the back of one's mind because python could profit from some renaming here and there to get closer to its goal to be more human-understandable--and well-sorted.

'math.cryptography' or at least 'math.hash' would work as well.

Dennis

On Thu, 20 Apr 2006 18:00:49 -0700 "Gregory P. Smith" <greg at electricrain.com> wrote:

> Module names like hashlib are not python-like too (too c/lowlevel-like).

what is python-like? hashlib was chosen because it is a library of hash functions and hash() is already taken as a builtin function (otherwise i'd leave off the lib). -g



More information about the Python-Dev mailing list