honey-team / ufpy

Ufpy (Useful Python) - package for Python with some useful features
https://honey-team.github.io/ufpy-website
MIT License
3 stars 3 forks source link

Add support for several keys, values, indexes in `UDict.get()` #45

Open bleudev opened 2 months ago

bleudev commented 2 months ago

Example:

UDict.get(key=['first', 'second']) # ['value for first key', 'value for second key']
UDict.get(index=[1, 3])
# also support for slice
UDict.get(index=slice(1, 9, 2))

UDict.get(value=['first value', 'second value']

It's very easy to create:

get(...):
    ...
    r = []
    if isinstance(key, (list, tuple)):
        for i in key:
            r.append(self.get(key=i))
    ... # (for another parameters)