CustomOperators-0.4
توضیحات
Custom operator implementation in Python
| ویژگی | مقدار |
|---|---|
| سیستم عامل | - |
| نام فایل | CustomOperators-0.4 |
| نام | CustomOperators |
| نسخه کتابخانه | 0.4 |
| نگهدارنده | [] |
| ایمیل نگهدارنده | [] |
| نویسنده | Qkrisi |
| ایمیل نویسنده | qruczkristof@gmail.com |
| آدرس صفحه اصلی | https://github.com/qkrisi/python-custom-operators |
| آدرس اینترنتی | https://pypi.org/project/CustomOperators/ |
| مجوز | MIT |
CustomOperators
===============
This module allows you to use operators specified by you.
Setup
-----
To install the module, run: ``sudo pip3 install CustomOperators``
Usage
-----
To import the module, use
.. code:: py
import CustomOperators
To create an operator, use the ``CustomOperators.Operator`` decorator
Examples:
**2 operands:**
.. code:: py
import CustomOperators
@CustomOperators.Operator("§")
def Power(left, right):
return left**right
**1 operand:**
.. code:: py
import customOperators
@CustomOperators.Operator("!")
def Negate(base):
return not base
To run a script that uses the new operators, import it with
``CustomOperators.ImportModule``
Example:
.. code:: py
#Module.py
def run():
print(4§5)
.. code:: py
#__main__.py
import CustomOperators
@CustomOperators.Operator("§")
def Power(left, right):
return left**right
CustomOperators.ImportModule("Module")
Module.run() #Output: 1024
**For more information about usage (operator overloading, operator
rules), check out the** `wiki
page <https://github.com/Qkrisi/python-custom-operators/wiki>`__
نحوه نصب
نصب پکیج whl CustomOperators-0.4:
pip install CustomOperators-0.4.whl
نصب پکیج tar.gz CustomOperators-0.4:
pip install CustomOperators-0.4.tar.gz