Skip to main content

常量常用包,包括三种常量实现方式, 1:基类继承, 2:装饰器, 3:元类metaclass

Project description

常量常用包

包括三种常量实现方式

1.基类继承
from zconst.const_base import const

class my_const(const):
    a = 1
my_const = my_const()

print(my_const.a)
my_const.a = 1
2.装饰器
from zconst.const_decorator import const

@const
class my_const():
    a = 1

print(my_const.a)
my_const.a = 1
3.元类metaclass
from zconst.const_metaclass import const

class my_const(metaclass=const):
    a = 1

print(my_const.a)
my_const.a = 1

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

zconst-1.0.0.tar.gz (2.0 kB view hashes)

Uploaded Source

Built Distribution

zconst-1.0.0-py3-none-any.whl (3.4 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page