A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2015-February/138410.html below:

[Python-Dev] Prefixes and namespaces

[Python-Dev] Prefixes and namespaces [Python-Dev] Prefixes and namespacesSerhiy Storchaka storchaka at gmail.com
Sat Feb 21 20:28:21 CET 2015
/* Namespaces are one honking great idea -- let's do more of those! */

There are two ways to avoid name conflicts: prefixes and namespaces. 
Programming languages that lacks namespaces (such as C) need to use 
prefixes. For example: PROTOCOL_SSLv2, PROTOCOL_SSLv3, PROTOCOL_SSLv23. 
Python used the same prefixed names when reflect C constants to module 
level Python globals. But when convert integer constants to IntEnum, is 
it needed to preserve common prefix? Or may be we can drop it, because 
enum class name plays its role?

class Protocol(IntEnum):
     PROTOCOL_SSLv2 = ...
     PROTOCOL_SSLv3 = ...
     PROTOCOL_SSLv23 = ...

or

class Protocol(IntEnum):
     SSLv2 = ...
     SSLv3 = ...
     SSLv23 = ...

? Protocol.PROTOCOL_SSLv2 or Protocol.SSLv2?

More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4