naming methods in python (std lib)

Steven D'Aprano steve+comp.lang.python at pearwood.info
Sat Jun 30 08:20:22 EDT 2018


On Sat, 30 Jun 2018 15:27:35 +0400, Abdur-Rahmaan Janhangeer wrote:

> normally, naming methods in python is given by
> 
> method_name
> 
> but i see some cases where this is not followed in the std lib
> 
> ex :  dict.fromkeys
> 
> should it not have been
> 
> from_keys?

Python is about 25 years old (1993 I think it was first released) and not 
all the names follow the same convention.

Sometimes that's because the names pre-date the convention. Sometimes its 
because the name follows some other convention, e.g. most of the "is" 
names look like isinstance, issubclass, string.islower etc rather than 
is_instance, is_subclass, is_lower.


-- 
Steven D'Aprano
"Ever since I learned about confirmation bias, I've been seeing
it everywhere." -- Jon Ronson




More information about the Python-list mailing list