mutaprim


Namemutaprim JSON
Version 0.1.0 PyPI version JSON
download
home_pagehttps://github.com/matheusvilano/mutaprim.git
SummaryA collection of classes that encapsulate a primitive so it can be modified inside a function.
upload_time2024-07-05 20:48:23
maintainerNone
docs_urlNone
authorMatheus Vilano
requires_python>=3.6
licenseApache Software License (Apache License 2.0)
keywords reference mutable primitive modify pass encapsulation container
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Mutaprim

Mutaprim is very simple package containing a single module: `mutaprim`. The module contain 5 "mutable primitive" types, 
all inheriting from a base class called `MutablePrimitive`:
- `MutableBool`
- `MutableInt`
- `MutableFloat`
- `MutableStr`
- `MutableBytes`

An instance of any `MutablePrimitive` subclass will have the `value` property, as well as equivalent  `get` and `set` 
functions.

Here is a very simple demonstration:

```python
from mutaprim import MutableInt

def increment(integer: MutableInt):
    integer.value += 1

# `__init__` and `__str__`
mutable_int = MutableInt(0)
print(mutable_int)  # 0

# `get` and `set`
mutable_int.set(10)
print(mutable_int.get())  # 10

# `value`
increment(mutable_int)
print(mutable_int.value)  # 11
```

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/matheusvilano/mutaprim.git",
    "name": "mutaprim",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.6",
    "maintainer_email": null,
    "keywords": "reference mutable primitive modify pass encapsulation container",
    "author": "Matheus Vilano",
    "author_email": null,
    "download_url": "https://files.pythonhosted.org/packages/17/23/e8da8c5bc31caf6105cb2da92ed6ed87eca984d35df61ed030ba95fd45f3/mutaprim-0.1.0.tar.gz",
    "platform": null,
    "description": "# Mutaprim\r\n\r\nMutaprim is very simple package containing a single module: `mutaprim`. The module contain 5 \"mutable primitive\" types, \r\nall inheriting from a base class called `MutablePrimitive`:\r\n- `MutableBool`\r\n- `MutableInt`\r\n- `MutableFloat`\r\n- `MutableStr`\r\n- `MutableBytes`\r\n\r\nAn instance of any `MutablePrimitive` subclass will have the `value` property, as well as equivalent  `get` and `set` \r\nfunctions.\r\n\r\nHere is a very simple demonstration:\r\n\r\n```python\r\nfrom mutaprim import MutableInt\r\n\r\ndef increment(integer: MutableInt):\r\n    integer.value += 1\r\n\r\n# `__init__` and `__str__`\r\nmutable_int = MutableInt(0)\r\nprint(mutable_int)  # 0\r\n\r\n# `get` and `set`\r\nmutable_int.set(10)\r\nprint(mutable_int.get())  # 10\r\n\r\n# `value`\r\nincrement(mutable_int)\r\nprint(mutable_int.value)  # 11\r\n```\r\n",
    "bugtrack_url": null,
    "license": "Apache Software License (Apache License 2.0)",
    "summary": "A collection of classes that encapsulate a primitive so it can be modified inside a function.",
    "version": "0.1.0",
    "project_urls": {
        "Author Website": "https://www.matheusvilano.com/",
        "Git Repository": "https://github.com/matheusvilano/mutaprim.git",
        "Homepage": "https://github.com/matheusvilano/mutaprim.git"
    },
    "split_keywords": [
        "reference",
        "mutable",
        "primitive",
        "modify",
        "pass",
        "encapsulation",
        "container"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "1723e8da8c5bc31caf6105cb2da92ed6ed87eca984d35df61ed030ba95fd45f3",
                "md5": "3412ff2b8034c5271dfeee9e3367707e",
                "sha256": "7a62d0bd00034ab8d5b827846cf4e724d0cde095a78a7e208bf7262f81ef2516"
            },
            "downloads": -1,
            "filename": "mutaprim-0.1.0.tar.gz",
            "has_sig": false,
            "md5_digest": "3412ff2b8034c5271dfeee9e3367707e",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6",
            "size": 6072,
            "upload_time": "2024-07-05T20:48:23",
            "upload_time_iso_8601": "2024-07-05T20:48:23.492335Z",
            "url": "https://files.pythonhosted.org/packages/17/23/e8da8c5bc31caf6105cb2da92ed6ed87eca984d35df61ed030ba95fd45f3/mutaprim-0.1.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-07-05 20:48:23",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "matheusvilano",
    "github_project": "mutaprim",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [],
    "lcname": "mutaprim"
}
        
Elapsed time: 0.25928s