A collection of MetaClasses for Python.
Project description
pyTooling
A collection of classes, meta-classes and decorators for Python.
Classes
Exceptions
- An exception base-class to derive more powerful exceptions.
ExceptionBase
- Common exception classes:
EnvironmentException
PlatformNotSupportedException
NotConfiguredException
Decorators
-
export
Add a class defined in a module to the__all__
array of a module.Example
@export class MyClass: pass
Metaclasses
Singleton
Allow only a single instance of a class.
⇒ See documentation of pyTooling.SingletonOverloading
Allow method overloading in Python classes. Dispatch method calls based on method signatures (type annotations).
⇒ See documentation of pyTooling.Overloading
Common Classes
CallBy
Auxilary classes to implement call by reference.
Python does not allow a user to distinguish between call-by-value and call-by-reference parameter passing. Python's standard types are passed by-value to a function or method. Instances of a class are passed by-reference (pointer) to a function or method.
By implementing a wrapper-class CallByRefParam
, any type's value can be
passed by-reference. In addition, derived classes can offer additional methods
and operators for standard types like int
or bool
.
Example
# define a call-by-reference parameter for integer values
myInt = CallByRefIntParam()
# a function using a call-by-reference parameter
def func(param : CallByRefIntParam):
param <<= 3
# call the function and pass the wrapper object
func(myInt)
print(myInt.value)
Versioning
Version
Representation of a version number.
Contributors
- Patrick Lehmann (Maintainer)
- and more...
License
This Python package (source code) licensed under Apache License 2.0.
The accompanying documentation is licensed under Creative Commons - Attribution 4.0 (CC-BY 4.0).
SPDX-License-Identifier: Apache-2.0
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
Built Distribution
Hashes for pyTooling-1.4.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 91591119a207f8925998e8e2126b8889063ecd660275e71d788817a216036e3d |
|
MD5 | b45e8bb7929d517fd8653747ea35a6f2 |
|
BLAKE2b-256 | 1677eb553b0e696fc8b6680f0c3c457d9aa75f6f5e3c06b84ef3ec548bb0c6a1 |