let3


Namelet3 JSON
Version 1.1.2 PyPI version JSON
download
home_pageNone
SummaryAssign variables wherever, whenever you want.
upload_time2024-11-05 21:07:07
maintainerAdam Karpierz
docs_urlNone
authorTaylor Marks, Adam Karpierz
requires_python<4.0.0,>=3.9.0
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.9 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|
  | Copyright (c) 2016 Taylor Marks
  | 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**
.. |copyright| replace:: Copyright (c) 2016-2024 Adam Karpierz
.. |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.1.2 (2024-10-30)
------------------
- Setup (dependencies) update.

1.1.1 (2024-10-09)
------------------
- Setup (dependencies) update.

1.1.0 (2024-09-30)
------------------
- Drop support for Python 3.8
- Setup (dependencies) update.

1.0.25 (2024-08-13)
-------------------
- Add support for Python 3.13
- Setup (dependencies) update.

1.0.24 (2024-01-30)
-------------------
- 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": null,
    "name": "let3",
    "maintainer": "Adam Karpierz",
    "docs_url": null,
    "requires_python": "<4.0.0,>=3.9.0",
    "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/ae/e1/8f77faecaabed60d7c7bd18bedbcd1bb7ea25a9b8fab7d24202ffc75632e/let3-1.1.2.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.9 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|\r\n  | Copyright (c) 2016 Taylor Marks\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.. |copyright| replace:: Copyright (c) 2016-2024 Adam Karpierz\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.1.2 (2024-10-30)\r\n------------------\r\n- Setup (dependencies) update.\r\n\r\n1.1.1 (2024-10-09)\r\n------------------\r\n- Setup (dependencies) update.\r\n\r\n1.1.0 (2024-09-30)\r\n------------------\r\n- Drop support for Python 3.8\r\n- Setup (dependencies) update.\r\n\r\n1.0.25 (2024-08-13)\r\n-------------------\r\n- Add support for Python 3.13\r\n- Setup (dependencies) update.\r\n\r\n1.0.24 (2024-01-30)\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.1.2",
    "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": "c4797ec57345d139267858c3097e3ce1c8ce3eef7bb91a13c9b16454f996e14c",
                "md5": "084024c4cafb4785bdd2eceae1f51a25",
                "sha256": "7328d2729d5f20bb87eedf8d78786380351d788a56a2b2de497bac57f9270d68"
            },
            "downloads": -1,
            "filename": "let3-1.1.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "084024c4cafb4785bdd2eceae1f51a25",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4.0.0,>=3.9.0",
            "size": 6281,
            "upload_time": "2024-11-05T21:07:05",
            "upload_time_iso_8601": "2024-11-05T21:07:05.222269Z",
            "url": "https://files.pythonhosted.org/packages/c4/79/7ec57345d139267858c3097e3ce1c8ce3eef7bb91a13c9b16454f996e14c/let3-1.1.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "aee18f77faecaabed60d7c7bd18bedbcd1bb7ea25a9b8fab7d24202ffc75632e",
                "md5": "5c8739e6d99cd7fc097c71b502ef96dd",
                "sha256": "f90fcfa5eddc1f073686e27b5e02c53048015bccee1a705f0ad55f2e7bc62677"
            },
            "downloads": -1,
            "filename": "let3-1.1.2.zip",
            "has_sig": false,
            "md5_digest": "5c8739e6d99cd7fc097c71b502ef96dd",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4.0.0,>=3.9.0",
            "size": 20588,
            "upload_time": "2024-11-05T21:07:07",
            "upload_time_iso_8601": "2024-11-05T21:07:07.045306Z",
            "url": "https://files.pythonhosted.org/packages/ae/e1/8f77faecaabed60d7c7bd18bedbcd1bb7ea25a9b8fab7d24202ffc75632e/let3-1.1.2.zip",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-11-05 21:07:07",
    "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.41420s