Something like this:
> \>\>\> class Movement:
> ... def __eq__(self, x):
> ... return type(x) is Movement
> ...
> \>\>\> dummy = Movement()
> \>\>\> # suppose `bar` is a list of every recorded action in a game
> \>\>\> if dummy in bar:
> ... if dummy is in bar: # check if the dummy value is in the actions
> ... raise TypeError("cannot put dummy value in actions log")
_______________________________________________
Python-ideas mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at
https://mail.python.org/archives/list/[email protected]/message/TGWTHLQQMZPEZKKDB7O2V3LDWF5MWTPD/
Code of Conduct: http://python.org/psf/codeofconduct/
- [Python-ideas] `is in`/`not is in` operators Jeremiah Vivian
- [Python-ideas] Re: `is in`/`not is in` operators Chris Angelico
- [Python-ideas] Re: `is in`/`not is in` operators Jeremiah Vivian
- [Python-ideas] Re: `is in`/`not is in` opera... Chris Angelico
- [Python-ideas] Re: `is in`/`not is in` o... Jeremiah Vivian
- [Python-ideas] Re: `is in`/`not is ... Alexandre Brault
- [Python-ideas] Re: `is in`/`not is in` operators Steven D'Aprano
- [Python-ideas] Re: `is in`/`not is in` operators Jeremiah Vivian
- [Python-ideas] Re: `is in`/`not is in` opera... Jeremiah Vivian
- [Python-ideas] Re: `is in`/`not is in` operators Chris Angelico
- [Python-ideas] Re: `is in`/`not is in` opera... Jeremiah Vivian
- [Python-ideas] Re: `is in`/`not is in` o... Chris Angelico
- [Python-ideas] Re: `is in`/`not is ... Jeremiah Vivian
