Skip to main content
Yanked

This release has been yanked by its maintainers, and will be ignored by installers, except when explicitly specified.
Consider using release 2.5.1 instead.
Reason given by maintainers: Failed

let3

Assign variables wherever, whenever you want.

Overview

let3 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 let3).

Quick Start

Once you’ve installed, you can really quickly verified that it works with just this:

>>> 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:

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

They may have actually meant:

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:

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:

To install run:

python -m pip install --upgrade let3

Development

Prerequisites:

  • Development is strictly based on nox. To install it run:

    python -m pip install --upgrade nox

Visit Development page.

Installation from sources:

clone the sources:

git clone https://github.com/karpierz/let3 let3

and run:

python -m pip install ./let3

or on development mode:

python -m pip install --editable ./let3

License

Copyright (c) 2016-2026 Adam Karpierz
Copyright (c) 2016 Taylor Marks
Licensed under the MIT License
Please refer to the accompanying LICENSE file.

Authors

Sponsoring

If you would like to sponsor the development of this project, your contribution is greatly appreciated.
As I am now retired, any support helps me dedicate more time to maintaining and improving this work.

Donate

Metadata

Release files for let3 2.5.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for let3 2.5.0
File Size Uploaded
let3-2.5.0.tar.gz 15.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for let3 2.5.0
File Interpreter ABI Platform
let3-2.5.0-py3-none-any.whl Python 3 none any Details

Total release size: 20.7 kB

Release files / let3-2.5.0.tar.gz

Download URL let3-2.5.0.tar.gz
Size 15.0 kB
Tags Source
SHA-256 checksum
How to use checksums
dd62e0845aa3da48f9510abdc111bde78476f4d26d8afcbea63a0fa6329dafda
BLAKE2b-256 checksum
How to use checksums
33f44dbd9121fe9ee1568bd232e9e9166751979fd5a164a71e00e4703e4117a2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.8

Release files / let3-2.5.0-py3-none-any.whl

Download URL let3-2.5.0-py3-none-any.whl
Size 5.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
721b0993ec9186f121d959063c69f3fa0b5b455c4d2056591c0bdaa7106ff0a8
BLAKE2b-256 checksum
How to use checksums
733934f04590dcbc89c46fcad579dc37293b1589e604d0fccedad3a13896abb1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.8

Release history Release notifications | RSS feed

2.5.1

2 release files

This release

2.5.0 This release

2 release files

2.4.5

2 release files

2.4.4

2 release files

2.4.3

2 release files

2.4.2

2 release files

2.4.0

2 release files

2.3.0

2 release files

2.2.0

2 release files

2.1.1

2 release files

2.1.0

2 release files

2.0.11

2 release files

2.0.8

2 release files

2.0.6

2 release files

2.0.5

2 release files

2.0.4

2 release files

2.0.2

2 release files

2.0.1

2 release files

2.0.0

2 release files

1.4.0

2 release files

1.2.3

2 release files

1.2.2

2 release files

1.2.1

2 release files

1.2.0

2 release files

1.1.7

2 release files

1.1.5

2 release files

1.1.4

2 release files

1.1.3

2 release files

1.1.2

2 release files

1.1.1

2 release files

1.1.0

2 release files

1.0.25

2 release files

1.0.20

2 release files

1.0.19

2 release files

1.0.17

2 release files

1.0.16

2 release files

1.0.15

1 release file

1.0.14

1 release file

1.0.13

1 release file

1.0.12

1 release file

1.0.11

1 release file

1.0.10

1 release file

1.0.9

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page