https://github.com/dentosal/imbapython
Extending Python 3 by patching built in types
https://github.com/dentosal/imbapython
Last synced: 3 months ago
JSON representation
Extending Python 3 by patching built in types
- Host: GitHub
- URL: https://github.com/dentosal/imbapython
- Owner: Dentosal
- License: mit
- Created: 2016-12-06T23:20:44.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2016-12-07T13:10:38.000Z (over 9 years ago)
- Last Synced: 2025-03-21T09:48:11.997Z (over 1 year ago)
- Language: Python
- Homepage:
- Size: 7.81 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ImbaPython v0.1.0A bit unstable
ImbaPython is a Python extender, using the [forbiddenfruit](https://github.com/clarete/forbiddenfruit) library. The maing goal of this project is to show how good Python could be if it had functional lists and consistent method/function separation. Less legacy, more methods.
This project is heavily influenced by Haskell and Scala, and it is trying to provide similar toolset. While this is only demonstration, I hope that some day we will have programming language like this.
## Installation
First install the [forbiddenfruit](https://github.com/clarete/forbiddenfruit) library:
`pip3 install forbiddenfruit`
Then just copy the [`imba.py`](imba.py) file to your project directory.
## Usage
```python
# Import it
import imba
# Install addtional features
imba.install(["requests", "json"])
# Do whatever you want
# times table
print(
range(1,11)
.map(lambda row: range(1,11)
.map(lambda col: row*col))
.map(lambda row: row.fmt("{:4}")).join("\n")
)
# fetch ip
print("http://httpbin.org/ip".fetch().json["origin"])
# quick and efficient factorial
def factorial(n):
assert n > 0
return range(1, n+1).product()
```