A small Python utility library including Clamped and other functions.
Project description
PyUtilx
PyUtilx — a lightweight Python library with useful utilities and extended variable types.
Designed for convenience and less routine in logical operations.
Features
-
Clamped — a numeric type with value limits (
min,max) and an optional looping mode (loop=True).
Supports all major operators (+,-,*,/,%,**) and safely handles boundary overflows. -
to_base() — converts numbers between numeral systems (up to base 36).
Example:to_base("ZZ", 36, 10)→1295. -
nearest() / closest() / nrst() — finds the closest value from a list.
-
clamp() — clamps a number between two bounds.
-
reverse() — reverses a string or number (sign preserved).
-
sign() — returns the sign of a number:
1,-1or0.
Example
from pyutilx import Clamped, to_base, reverse
x = Clamped(5, 0, 10)
x += 8
print(x) # 10
y = Clamped(9, 0, 10, loop=True)
y += 3
print(y) # 1
print(to_base("ZZ", 36, 10)) # 1295
print(reverse(-123)) # -321
Why PyUtilx?
PyUtilx isn’t just a collection of random utilities — it’s an attempt to expand Python with missing data types
and simple yet powerful tools that make your code cleaner and more logical.
Clamped is just the beginning.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pyutilix-0.1.2.tar.gz.
File metadata
- Download URL: pyutilix-0.1.2.tar.gz
- Upload date:
- Size: 2.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c0ca68dd7c89747fcbde698abec2a03fe0e7fdc2c4080fa0b33b9b56d4cb0306
|
|
| MD5 |
15430d121a4dfd3f4dcda6866e9557c5
|
|
| BLAKE2b-256 |
3d8bd7d8a2d09acd00fe7a99556bd87468df6b4b6b081105f616046af7c159fe
|
File details
Details for the file pyutilix-0.1.2-py3-none-any.whl.
File metadata
- Download URL: pyutilix-0.1.2-py3-none-any.whl
- Upload date:
- Size: 2.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c8dd5e326ed246632a48a1b6261879f61027a70b1d731bccea715cfb03fa36fe
|
|
| MD5 |
01d6182a12c5d462fbee3e9953519f09
|
|
| BLAKE2b-256 |
502e53b046daf4df29f8a770c59deae03dc1a0585c3cd1fc3288fdcae70b0dad
|