On the code I'm viewing, I saw a class like this:

class User(ModelBase):
    """# User: docstring"""

    COMBAT_RANK_KEY_PREFIX = 'combat_rank'
    LEVEL_RANK_KEY_PREFIX = 'level_rank'
    EQUIPMENT_RANK_KEY_PREFIX = 'equipment_rank'
    WORLD_REGAIN_RANK_KEY_PREFIX = 'world_regain_rank'
    COMMANDER_RANK_KEY_PREFIX = 'commander_rank'
    LIKE_RANK_KEY_PREFIX = 'like_rank'

    # Rest part of the class is omitted here

There are other many class constant name like this in the project.
I consult PEP8 and saw no regulations for class constant.
Which only mentions golabl constant can use name like GLOBAL_CONSTANT.

But I still don't feel right to write a "class constant" like this,
but as they were wrote by my senior colleagues, I'm not sure if it's right or not.

So, is this kind of naming OK according to PEPs and Common rules?

Related posts

Recent Viewed