diff options
author | Frechdachs <Frechdachs@users.noreply.github.com> | 2016-02-19 08:30:53 +0100 |
---|---|---|
committer | Frechdachs <Frechdachs@users.noreply.github.com> | 2016-02-19 08:30:53 +0100 |
commit | ac30a66ed493d03b5358fda3945aae0ca2b5b7c9 (patch) | |
tree | 522ef49544962c446e78d865fbfa180db2e961e6 | |
parent | c42fe539ab50ce1c3f783b4d0b74ae0f99d5ab73 (diff) | |
download | python-mpv-ac30a66ed493d03b5358fda3945aae0ca2b5b7c9.tar.gz python-mpv-ac30a66ed493d03b5358fda3945aae0ca2b5b7c9.tar.bz2 python-mpv-ac30a66ed493d03b5358fda3945aae0ca2b5b7c9.zip |
Implement '==' and '!=' for ynbool
'ynbool(True) == "yes"', 'ynbool(True) == True' and 'ynbool(True) == ynbool(True)' were not working.
-rw-r--r-- | mpv.py | 3 |
1 files changed, 3 insertions, 0 deletions
@@ -259,6 +259,9 @@ class ynbool: def __repr__(self): return str(self.val) + def __eq__(self, other): + return str(self) == other or bool(self) == other + def _ensure_encoding(possibly_bytes): return possibly_bytes.decode() if type(possibly_bytes) is bytes else possibly_bytes |