If both are empty, None
will be returned.
If both have a value, first value will be returned
pip install questionable
from questionable import qq
def your_func(your_args=...):
# your code
...
return qq(<your value>,<default value>) # `<your value>` will be returned
- Values can be:
int
float
str
None
bool
list
tuple
set
instead of doing:
class NotYoutubeLink(Exception):
def __str__(self):
text = super().__str__()
if text: return text
return "This link is not from youtube! :bonk:"
you will be able todo:
from questionable import qq
class NotYoutubeLink(Exception):
def __str__(self):
return qq(super().__str__(),"This link is not from youtube! :bonk:")
see test.py to better understand what would happen in other cases. But in short: both aren't empty -> first will be returned both are empty -> None will be returned first isn't empty -> first will be returned second isn't empty -> second will be returned
PixelSymbols
is_empty
This project is licensed under the MIT License - see the LICENSE file for details