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.

Files for zconst, version 1.0.0
Filename, size File type Python version Upload date Hashes
Filename, size zconst-1.0.0-py3-none-any.whl (3.4 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size zconst-1.0.0.tar.gz (2.0 kB) File type Source Python version None Upload date Hashes View

Supported by

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