https://github.com/jacopodl/powerpy
A collection of constructs for Python3 :snake::briefcase:
https://github.com/jacopodl/powerpy
awesome library patterns python-library python3
Last synced: 11 months ago
JSON representation
A collection of constructs for Python3 :snake::briefcase:
- Host: GitHub
- URL: https://github.com/jacopodl/powerpy
- Owner: jacopodl
- License: mit
- Created: 2018-04-23T18:31:42.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2018-06-19T10:38:16.000Z (almost 8 years ago)
- Last Synced: 2024-10-05T16:49:15.891Z (over 1 year ago)
- Topics: awesome, library, patterns, python-library, python3
- Language: Python
- Homepage:
- Size: 34.2 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README

# 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](https://github.com/jacopodl/powerpy).
## Examples
To implement a simple type checking in your classes:
```python
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:
```python
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
```