let3


Namelet3 JSON
Version 1.0.23 PyPI version JSON
download
home_page
SummaryAssign variables wherever, whenever you want.
upload_time2024-01-28 14:59:26
maintainerAdam Karpierz
docs_urlNone
authorTaylor Marks, Adam Karpierz
requires_python<4.0.0,>=3.8.1
licenseMIT License ; https://opensource.org/license/mit
keywords let let3 assign assignment var variable conditional if while
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            let3
====

Assign variables wherever, whenever you want.

Overview
========

|package_bold| is a strict fork of Taylor Marks's let_ package with a fix
allowing to work with Python3 or higher and with a little code reformatting
and minor improvements.

`PyPI record`_.

`Documentation`_.

Overview below is a copy from the original let_ website (with only the necessary
changes regarding |package|).

Quick Start
-----------
Once you've installed, you can really quickly verified that it works with just this:

.. code-block:: python

    >>> from let import let
    >>> if let(count = len("Hello World!")):
    ...     print(count)
    12

Documentation
-------------
In C, Java, and many other languages, it's possible to assign variables inside
of if or while condition statements. This is useful in allowing you to concisely
both assign the value, and check whether a condition is met.

This ability doesn't exist in Python, because of the thought that when people
write something like:

.. code-block:: python

    if row = db.fetch_results():
        ...

They may have actually meant:

.. code-block:: python

    if row == db.fetch_results():
        ...

Personally, I have never made this mistake. It seems far more like a theoretical
mistake that could plausibly happen than one that actually happens and warrants
removing features, as was chosen in Python.

Anyways, the let function in this module gives you something very close to that
ability in other languages. A few examples:

.. code-block:: python

    if let(name = longInstanceName.longAttributeName):
        ...

    # Yes, db.fetch_results() should just return a generator. No, it doesn't.
    while let(results = db.fetch_results()):
        ...

    if let(count = len(nameValuePair)) != 1:
        raise Exception(f"Bad amount: {count}")

Installation
============

Prerequisites:

+ Python 3.7 or higher

  * https://www.python.org/

+ pip and setuptools

  * https://pypi.org/project/pip/
  * https://pypi.org/project/setuptools/

To install run:

  .. parsed-literal::

    python -m pip install --upgrade |package|

Development
===========

Prerequisites:

+ Development is strictly based on *tox*. To install it run::

    python -m pip install --upgrade tox

Visit `Development page`_.

Installation from sources:

clone the sources:

  .. parsed-literal::

    git clone |respository| |package|

and run:

  .. parsed-literal::

    python -m pip install ./|package|

or on development mode:

  .. parsed-literal::

    python -m pip install --editable ./|package|

License
=======

  | Copyright (c) 2016 Taylor Marks
  | Copyright (c) 2016-2024 Adam Karpierz
  | Licensed under the MIT License
  | https://opensource.org/license/mit
  | Please refer to the accompanying LICENSE file.

Authors
=======

* Taylor Marks <taylor@marksfam.com>
* Adam Karpierz <adam@karpierz.net>

.. |package| replace:: let3
.. |package_bold| replace:: **let3**
.. |respository| replace:: https://github.com/karpierz/let3.git
.. _Development page: https://github.com/karpierz/let3
.. _PyPI record: https://pypi.org/project/let3/
.. _Documentation: https://let3.readthedocs.io/
.. _let: https://pypi.org/project/let/

Changelog
=========

1.0.23 (2024-01-26)
-------------------
- Setup update (now based on tox >= 4.0).
- Add support for Python 3.12
- Drop support for Python 3.7
- Add support for PyPy 3.9 and 3.10
- Add support for PyPy 3.7 and 3.8
- Copyright year update.
- Tox configuration has been moved to pyproject.toml
- Cleanup.

1.0.21 (2022-10-18)
-------------------
- Tox configuration has been moved to pyproject.toml

1.0.20 (2022-08-22)
-------------------
- Add support for Python 3.10 and 3.11
- Setup update (currently based mainly on pyproject.toml).

1.0.19 (2022-01-10)
-------------------
- Drop support for Python 3.6.
- Copyright year update.
- Setup update.

1.0.17 (2021-10-14)
-------------------
- Setup update.

1.0.16 (2021-07-19)
-------------------
- Bugfix: 'let' works now also on highest (e.g. module) level.
- Setup general update and improvement.

1.0.15 (2020-10-17)
-------------------
- Add support for Python 3.8 and 3.9.
- Drop support for Python 3.5.
- Drop support for Python 2.
- Setup: fix an improper dependencies versions.
- Setup general update and cleanup.
- Fixed docs setup.
- Cleanup.

1.0.10 (2019-05-21)
-------------------
- Update required setuptools version.
- Setup update and improvements.
- This is the latest release that supports Python 2.

1.0.9 (2018-11-08)
------------------
- Drop support for Python 2.6 and 3.0-3.3
- Update required setuptools version.

1.0.8 (2018-05-08)
------------------
- Update required setuptools version.
- Improve and simplify setup and packaging.

1.0.7 (2018-02-26)
------------------
- Improve and simplify setup and packaging.

1.0.6 (2018-01-28)
------------------
- Fix a bug and inconsistencies in tox.ini
- Update of README.rst.

1.0.3 (2018-01-24)
------------------
- Update required Sphinx version.
- Update doc Sphinx configuration files.

1.0.2 (2017-11-18)
------------------
- Setup improvements.
- Other minor improvements.

1.0.1 (2017-01-05)
------------------
- Creating a fork of Taylor Marks's *let* package with a fix allowing
  to work with Python3 or higher.
- Minor improvements.

Changes of the original *let*:

1.0.1 (Feb 25, 2016)
--------------------
- Let now assigns the variables to the global namespace always - never
  the local namespace. The Python interpreter sometimes optimizes variables
  within the local namespace - it's best not to change values behind its
  back, as it leads to very difficult to discover bugs.

1.0.0 (Feb. 7, 2016)
--------------------
- Initial commit

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "let3",
    "maintainer": "Adam Karpierz",
    "docs_url": null,
    "requires_python": "<4.0.0,>=3.8.1",
    "maintainer_email": "adam@karpierz.net",
    "keywords": "let,let3,assign,assignment,var,variable,conditional,if,while",
    "author": "Taylor Marks, Adam Karpierz",
    "author_email": "adam@karpierz.net",
    "download_url": "https://files.pythonhosted.org/packages/19/dc/6dd4ae45a29f34c930145b723bccd96ae9c336fecfd5c61e856b8ad93465/let3-1.0.23.zip",
    "platform": "any",
    "description": "let3\r\n====\r\n\r\nAssign variables wherever, whenever you want.\r\n\r\nOverview\r\n========\r\n\r\n|package_bold| is a strict fork of Taylor Marks's let_ package with a fix\r\nallowing to work with Python3 or higher and with a little code reformatting\r\nand minor improvements.\r\n\r\n`PyPI record`_.\r\n\r\n`Documentation`_.\r\n\r\nOverview below is a copy from the original let_ website (with only the necessary\r\nchanges regarding |package|).\r\n\r\nQuick Start\r\n-----------\r\nOnce you've installed, you can really quickly verified that it works with just this:\r\n\r\n.. code-block:: python\r\n\r\n    >>> from let import let\r\n    >>> if let(count = len(\"Hello World!\")):\r\n    ...     print(count)\r\n    12\r\n\r\nDocumentation\r\n-------------\r\nIn C, Java, and many other languages, it's possible to assign variables inside\r\nof if or while condition statements. This is useful in allowing you to concisely\r\nboth assign the value, and check whether a condition is met.\r\n\r\nThis ability doesn't exist in Python, because of the thought that when people\r\nwrite something like:\r\n\r\n.. code-block:: python\r\n\r\n    if row = db.fetch_results():\r\n        ...\r\n\r\nThey may have actually meant:\r\n\r\n.. code-block:: python\r\n\r\n    if row == db.fetch_results():\r\n        ...\r\n\r\nPersonally, I have never made this mistake. It seems far more like a theoretical\r\nmistake that could plausibly happen than one that actually happens and warrants\r\nremoving features, as was chosen in Python.\r\n\r\nAnyways, the let function in this module gives you something very close to that\r\nability in other languages. A few examples:\r\n\r\n.. code-block:: python\r\n\r\n    if let(name = longInstanceName.longAttributeName):\r\n        ...\r\n\r\n    # Yes, db.fetch_results() should just return a generator. No, it doesn't.\r\n    while let(results = db.fetch_results()):\r\n        ...\r\n\r\n    if let(count = len(nameValuePair)) != 1:\r\n        raise Exception(f\"Bad amount: {count}\")\r\n\r\nInstallation\r\n============\r\n\r\nPrerequisites:\r\n\r\n+ Python 3.7 or higher\r\n\r\n  * https://www.python.org/\r\n\r\n+ pip and setuptools\r\n\r\n  * https://pypi.org/project/pip/\r\n  * https://pypi.org/project/setuptools/\r\n\r\nTo install run:\r\n\r\n  .. parsed-literal::\r\n\r\n    python -m pip install --upgrade |package|\r\n\r\nDevelopment\r\n===========\r\n\r\nPrerequisites:\r\n\r\n+ Development is strictly based on *tox*. To install it run::\r\n\r\n    python -m pip install --upgrade tox\r\n\r\nVisit `Development page`_.\r\n\r\nInstallation from sources:\r\n\r\nclone the sources:\r\n\r\n  .. parsed-literal::\r\n\r\n    git clone |respository| |package|\r\n\r\nand run:\r\n\r\n  .. parsed-literal::\r\n\r\n    python -m pip install ./|package|\r\n\r\nor on development mode:\r\n\r\n  .. parsed-literal::\r\n\r\n    python -m pip install --editable ./|package|\r\n\r\nLicense\r\n=======\r\n\r\n  | Copyright (c) 2016 Taylor Marks\r\n  | Copyright (c) 2016-2024 Adam Karpierz\r\n  | Licensed under the MIT License\r\n  | https://opensource.org/license/mit\r\n  | Please refer to the accompanying LICENSE file.\r\n\r\nAuthors\r\n=======\r\n\r\n* Taylor Marks <taylor@marksfam.com>\r\n* Adam Karpierz <adam@karpierz.net>\r\n\r\n.. |package| replace:: let3\r\n.. |package_bold| replace:: **let3**\r\n.. |respository| replace:: https://github.com/karpierz/let3.git\r\n.. _Development page: https://github.com/karpierz/let3\r\n.. _PyPI record: https://pypi.org/project/let3/\r\n.. _Documentation: https://let3.readthedocs.io/\r\n.. _let: https://pypi.org/project/let/\r\n\r\nChangelog\r\n=========\r\n\r\n1.0.23 (2024-01-26)\r\n-------------------\r\n- Setup update (now based on tox >= 4.0).\r\n- Add support for Python 3.12\r\n- Drop support for Python 3.7\r\n- Add support for PyPy 3.9 and 3.10\r\n- Add support for PyPy 3.7 and 3.8\r\n- Copyright year update.\r\n- Tox configuration has been moved to pyproject.toml\r\n- Cleanup.\r\n\r\n1.0.21 (2022-10-18)\r\n-------------------\r\n- Tox configuration has been moved to pyproject.toml\r\n\r\n1.0.20 (2022-08-22)\r\n-------------------\r\n- Add support for Python 3.10 and 3.11\r\n- Setup update (currently based mainly on pyproject.toml).\r\n\r\n1.0.19 (2022-01-10)\r\n-------------------\r\n- Drop support for Python 3.6.\r\n- Copyright year update.\r\n- Setup update.\r\n\r\n1.0.17 (2021-10-14)\r\n-------------------\r\n- Setup update.\r\n\r\n1.0.16 (2021-07-19)\r\n-------------------\r\n- Bugfix: 'let' works now also on highest (e.g. module) level.\r\n- Setup general update and improvement.\r\n\r\n1.0.15 (2020-10-17)\r\n-------------------\r\n- Add support for Python 3.8 and 3.9.\r\n- Drop support for Python 3.5.\r\n- Drop support for Python 2.\r\n- Setup: fix an improper dependencies versions.\r\n- Setup general update and cleanup.\r\n- Fixed docs setup.\r\n- Cleanup.\r\n\r\n1.0.10 (2019-05-21)\r\n-------------------\r\n- Update required setuptools version.\r\n- Setup update and improvements.\r\n- This is the latest release that supports Python 2.\r\n\r\n1.0.9 (2018-11-08)\r\n------------------\r\n- Drop support for Python 2.6 and 3.0-3.3\r\n- Update required setuptools version.\r\n\r\n1.0.8 (2018-05-08)\r\n------------------\r\n- Update required setuptools version.\r\n- Improve and simplify setup and packaging.\r\n\r\n1.0.7 (2018-02-26)\r\n------------------\r\n- Improve and simplify setup and packaging.\r\n\r\n1.0.6 (2018-01-28)\r\n------------------\r\n- Fix a bug and inconsistencies in tox.ini\r\n- Update of README.rst.\r\n\r\n1.0.3 (2018-01-24)\r\n------------------\r\n- Update required Sphinx version.\r\n- Update doc Sphinx configuration files.\r\n\r\n1.0.2 (2017-11-18)\r\n------------------\r\n- Setup improvements.\r\n- Other minor improvements.\r\n\r\n1.0.1 (2017-01-05)\r\n------------------\r\n- Creating a fork of Taylor Marks's *let* package with a fix allowing\r\n  to work with Python3 or higher.\r\n- Minor improvements.\r\n\r\nChanges of the original *let*:\r\n\r\n1.0.1 (Feb 25, 2016)\r\n--------------------\r\n- Let now assigns the variables to the global namespace always - never\r\n  the local namespace. The Python interpreter sometimes optimizes variables\r\n  within the local namespace - it's best not to change values behind its\r\n  back, as it leads to very difficult to discover bugs.\r\n\r\n1.0.0 (Feb. 7, 2016)\r\n--------------------\r\n- Initial commit\r\n",
    "bugtrack_url": null,
    "license": "MIT License ; https://opensource.org/license/mit",
    "summary": "Assign variables wherever, whenever you want.",
    "version": "1.0.23",
    "project_urls": {
        "Documentation": "https://let3.readthedocs.io/",
        "Download": "https://pypi.org/project/let3/",
        "Homepage": "https://pypi.org/project/let3/",
        "Issues": "https://github.com/karpierz/let3/issues",
        "Source": "https://github.com/karpierz/let3"
    },
    "split_keywords": [
        "let",
        "let3",
        "assign",
        "assignment",
        "var",
        "variable",
        "conditional",
        "if",
        "while"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "ec1f1dd73a12fbc619ef820105ea81e34cf98c8cb8fd7cfd04e30f06cfe6c313",
                "md5": "a4989e58f04ebb306845be50a01312d4",
                "sha256": "0e95b9cd1968fb4b8558ef4c516bc3e71282ba2a8638454002afe3962b11811e"
            },
            "downloads": -1,
            "filename": "let3-1.0.23-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "a4989e58f04ebb306845be50a01312d4",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4.0.0,>=3.8.1",
            "size": 6293,
            "upload_time": "2024-01-28T14:59:24",
            "upload_time_iso_8601": "2024-01-28T14:59:24.822304Z",
            "url": "https://files.pythonhosted.org/packages/ec/1f/1dd73a12fbc619ef820105ea81e34cf98c8cb8fd7cfd04e30f06cfe6c313/let3-1.0.23-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "19dc6dd4ae45a29f34c930145b723bccd96ae9c336fecfd5c61e856b8ad93465",
                "md5": "092e33caa6a88d9e672bde01edb087ba",
                "sha256": "6e73f60a320f5f910e8c1f9077841b5e34f7f2370b6fe2c63ccf52c2e4412937"
            },
            "downloads": -1,
            "filename": "let3-1.0.23.zip",
            "has_sig": false,
            "md5_digest": "092e33caa6a88d9e672bde01edb087ba",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4.0.0,>=3.8.1",
            "size": 20572,
            "upload_time": "2024-01-28T14:59:26",
            "upload_time_iso_8601": "2024-01-28T14:59:26.780537Z",
            "url": "https://files.pythonhosted.org/packages/19/dc/6dd4ae45a29f34c930145b723bccd96ae9c336fecfd5c61e856b8ad93465/let3-1.0.23.zip",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-01-28 14:59:26",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "karpierz",
    "github_project": "let3",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "let3"
}
        
Elapsed time: 0.17308s