A pure Python library for numeric type checking and validation
Project description
The Number
This library provides a set of pure Python functions for checking and validating numeric types, including complex numbers. It's designed to work without any external dependencies, making it easy to integrate into any Python project. I have used LLM for this entire README.md.
Features
- Check if a value is a numeric type (integer, float, or complex)
- Determine if a number is finite
- Validate if a value is a "number" (finite numeric type)
- Supports both real and complex numbers
- Pure Python implementation (no external dependencies)
Functions
isInteger(obj: complex) -> bool
Checks if the input is a numeric type (int, float, or complex).
isFinite(obj: complex) -> bool
Determines if the input is a finite number. For complex numbers, both real and imaginary parts must be finite.
isNumber(obj: complex) -> bool
Checks if the input is a finite numeric type.
Usage
from the_number import isInteger, isFinite, isNumber
# Examples
print(isInteger(5)) # True
print(isInteger(3.14)) # True
print(isInteger(2+3j)) # True
print(isInteger("5")) # False
print(isFinite(10)) # True
print(isFinite(float('inf'))) # False
print(isFinite(1+2j)) # True
print(isFinite(1+float('inf')*1j)) # False
print(isNumber(42)) # True
print(isNumber(3.14159)) # True
print(isNumber(2+3j)) # True
print(isNumber(float('nan'))) # False
Installation
>>> pip install the_number
>>> ...
That's all.
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
License
This project is licensed under the MIT License - see the LICENSE file for details.
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 the_number-0.1.0.tar.gz.
File metadata
- Download URL: the_number-0.1.0.tar.gz
- Upload date:
- Size: 2.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4bcea8f8885714f56bedc8f9a3448c7d25af9b8339d2f50bae9dd80b7e4686a8
|
|
| MD5 |
77694cad81151c1e7d8dfb6693a02401
|
|
| BLAKE2b-256 |
76762bbf19a9e604de2b6045c1f7bb03099412ec99a9a2ba424a81ff2acf4578
|
File details
Details for the file the_number-0.1.0-py3-none-any.whl.
File metadata
- Download URL: the_number-0.1.0-py3-none-any.whl
- Upload date:
- Size: 2.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
48658120e2c1b2839828e8b267807c72580768b09664fc54c0d0b29877d55fab
|
|
| MD5 |
0e181c1cbccc9de2a1414ec143994d92
|
|
| BLAKE2b-256 |
5c911466a140376f595704fc5ab9a80e92f04ba9c9c36026c9733e2512e877b2
|