vardict - dict with variables
Project description
vardict
Introduction
With vardict, it is possible to build up a dicionnary based on variable names and their value. For instance,
first_name = "John"
last_name = "Smith"
name = vardict(first_name, last_name)
Now, name will be dict(first_name='John', last_name='Smith').
In the same call, additional keywords can be added:
name = vardict(first_name, last_name, age=21, nationality="FR")
Now, name will be dict(first_name='John', last_name='Smith', age=21, nationality='FR').
This functionality is handy for calling functions with (many) keyword arguments, e.g. with salabim:
for x in range(1001,100):
for y in range(701, 100):
text = f'{x}-{y}'
sim.Animatext(**vardict(x, y, text, angle=45)) # instead of sim.Animatext(**vardict(x=x, y=y, text=text, angle=45))
Note that only variables are allowed, so no literals or expressions.
Usage
Importing can be done with
import vardict
or
from vardict import vardict
Installation
Just install with pip install vardict.
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 vardict-1.0.3.tar.gz.
File metadata
- Download URL: vardict-1.0.3.tar.gz
- Upload date:
- Size: 3.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
542b1095801b303f961612cff25dec523157598c96d937baf1144ffd949b7761
|
|
| MD5 |
5eaf6302e5f98b39887c09b2996086f9
|
|
| BLAKE2b-256 |
0719cdd3a6bad7ebae6adbc155ada54fd5bcc6d842d673d7b7d021e5d6dfc2e3
|
File details
Details for the file vardict-1.0.3-py3-none-any.whl.
File metadata
- Download URL: vardict-1.0.3-py3-none-any.whl
- Upload date:
- Size: 3.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5675dfca2bd7745ec1c9dc1a6b2c31a6b2347ef64c7290cbfca5b63e4bdd61e8
|
|
| MD5 |
cd5a10f78287adf65bcfe26cbfc32e87
|
|
| BLAKE2b-256 |
aff75e8680feb6f1c0af4c5f43b7d8f3003b74048e8fdf84ebbe01b03a4f174a
|