A collection of constructs for Python3
Project description
PowerPy
Powerpy is a collection of small functions and classes for Python3, contains an implementation of common patterns and other simple functions to make your life a bit easier.
Installation
The package can be installed through pip:
$ pip install powerpy
or downloaded from GitHub.
Examples
To implement a simple type checking in your classes:
from powerpy.type_checking import EnsureTypes
class Test(EnsureTypes):
def __init__(self):
self.prop1 = ""
self.prop2 = 123
self.prop3 = None
t=Test()
t.prop1="Hello" # OK
t.prop1=123 # Error
t.prop3 = "World" # OK
t.prop3 = 123 # Ok
Partial application:
from powerpy.currying import Currying
@Currying
def simple_func(param1, param2):
return param1 + param2
s1 = simple_func("Hello")
print(s1("Alice")) # HelloAlice
print(s1("Bob")) # HelloBob
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
powerpy-0.1.1.tar.gz
(6.4 kB
view details)
File details
Details for the file powerpy-0.1.1.tar.gz
.
File metadata
- Download URL: powerpy-0.1.1.tar.gz
- Upload date:
- Size: 6.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 12135d19d545478be436e60ab7639ea11d3402e30cf64febc1fbdf2407b577d5 |
|
MD5 | 5e44bbf204a0ccf6608e0d3a5bb16913 |
|
BLAKE2b-256 | e5d3ad1a74ba941a7209f5558f58c30790e9b1ea4723ffdc59f5e600cf3dd6e5 |