Python constants declaration

Viewed 28012

if I declare a const class which are contains variables:

for example

class const:
    MASTER_CLIENT_CONNECTED = 0
    CLIENT_CONNECTED = 1        
    GET_SERVER_QUEUE = 9998    
    ERROR = 9999

is there any way to reach this variable(constants) without creating a new class.

like this:

import const
const.MASTER_CLIENT_CONNECTED 

or

import const
if(i==MASTER_CLIENT_CONNECTED):
3 Answers
Related