常量常用包,包括三种常量实现方式, 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
Release history Release notifications | RSS feed
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 details)
Built Distribution
File details
Details for the file zconst-1.0.0.tar.gz
.
File metadata
- Download URL: zconst-1.0.0.tar.gz
- Upload date:
- Size: 2.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.19.1 setuptools/40.4.3 requests-toolbelt/0.8.0 tqdm/4.26.0 CPython/3.6.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d448ff9f7db31ab89be2b9bc0a8b2d10870faa075dd6f2ff530554b71f72a50d |
|
MD5 | 36f3f1a94d5d0aff7c0be80cc6b09373 |
|
BLAKE2b-256 | 9b6b29d42ace48c46bcd859468c5b341b147be7ed8e1f570befd3af78012ad7e |
File details
Details for the file zconst-1.0.0-py3-none-any.whl
.
File metadata
- Download URL: zconst-1.0.0-py3-none-any.whl
- Upload date:
- Size: 3.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.19.1 setuptools/40.4.3 requests-toolbelt/0.8.0 tqdm/4.26.0 CPython/3.6.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c2350ac73118335cf8d1e91192d21dbf4a8f236b99e1480853d35a033ac18ec4 |
|
MD5 | ab655560a18b1e0aa6aed0223b32813d |
|
BLAKE2b-256 | c0468a375837b2996d30518401c534f124ef6eca28a608836db0f2e816f8db5b |