Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why are some Python exceptions lower-case? [closed]

In Python, exceptions are classes and cased as such. For example: OSError.

However, there are some exceptions, such as those in the socket module, that are named in lower-case. For example: socket.timeout, socket.error.

Why is this?

like image 219
BadHeuristics Avatar asked Jan 06 '20 18:01

BadHeuristics


1 Answers

According to the docs,

exception socket.error A deprecated alias of OSError.

Changed in version 3.3: Following PEP 3151, this class was made an alias of OSError.

PEP 3151 says

while standard exception types live in the root namespace, they are visually distinguished by the fact that they use the CamelCase convention, while almost all other builtins use lowercase naming (except True, False, None, Ellipsis and NotImplemented)

like image 155
Vishnudev Avatar answered Sep 30 '22 06:09

Vishnudev