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 py3

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page