{"action":"created","issue":{"url":"https://api.github.com/repos/isaacg1/pyth/issues/106","labels_url":"https://api.github.com/repos/isaacg1/pyth/issues/106/labels{/name}","comments_url":"https://api.github.com/repos/isaacg1/pyth/issues/106/comments","events_url":"https://api.github.com/repos/isaacg1/pyth/issues/106/events","html_url":"https://github.com/isaacg1/pyth/pull/106","id":76532710,"number":106,"title":"Added Operator Chaining","user":{"login":"Maltysen","id":10355450,"avatar_url":"https://avatars.githubusercontent.com/u/10355450?v=3","gravatar_id":"","url":"https://api.github.com/users/Maltysen","html_url":"https://github.com/Maltysen","followers_url":"https://api.github.com/users/Maltysen/followers","following_url":"https://api.github.com/users/Maltysen/following{/other_user}","gists_url":"https://api.github.com/users/Maltysen/gists{/gist_id}","starred_url":"https://api.github.com/users/Maltysen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Maltysen/subscriptions","organizations_url":"https://api.github.com/users/Maltysen/orgs","repos_url":"https://api.github.com/users/Maltysen/repos","events_url":"https://api.github.com/users/Maltysen/events{/privacy}","received_events_url":"https://api.github.com/users/Maltysen/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-05-15T00:07:46Z","updated_at":"2015-05-15T01:30:09Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/isaacg1/pyth/pulls/106","html_url":"https://github.com/isaacg1/pyth/pull/106","diff_url":"https://github.com/isaacg1/pyth/pull/106.diff","patch_url":"https://github.com/isaacg1/pyth/pull/106.patch"},"body":"One of the best features of Python is [operator chaining](https://docs.python.org/2/reference/expressions.html#not-in). This was obviously missing in Pyth since we evaluate each operator individually. This is my attempt to fix this. Instead of the operator comparisons returning a Boolean, I instead made them return a custom `OpChain` object which contains the chain to expand as a string. When it needs to be used as a boolean, the overloaded `__bool__` method evaluates the chain. The `__str__` method also returns `\"True\"` or `\"False\"`, making it virtually indistinguishable from a boolean.\r\n\r\nThere is probably a bug with this somewhere, so tell me if you catch one. I have written this for `==`, `!=`, `<`, and `>` so far."},"comment":{"url":"https://api.github.com/repos/isaacg1/pyth/issues/comments/102217151","html_url":"https://github.com/isaacg1/pyth/pull/106#issuecomment-102217151","issue_url":"https://api.github.com/repos/isaacg1/pyth/issues/106","id":102217151,"user":{"login":"Maltysen","id":10355450,"avatar_url":"https://avatars.githubusercontent.com/u/10355450?v=3","gravatar_id":"","url":"https://api.github.com/users/Maltysen","html_url":"https://github.com/Maltysen","followers_url":"https://api.github.com/users/Maltysen/followers","following_url":"https://api.github.com/users/Maltysen/following{/other_user}","gists_url":"https://api.github.com/users/Maltysen/gists{/gist_id}","starred_url":"https://api.github.com/users/Maltysen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Maltysen/subscriptions","organizations_url":"https://api.github.com/users/Maltysen/orgs","repos_url":"https://api.github.com/users/Maltysen/repos","events_url":"https://api.github.com/users/Maltysen/events{/privacy}","received_events_url":"https://api.github.com/users/Maltysen/received_events","type":"User","site_admin":false},"created_at":"2015-05-15T01:30:09Z","updated_at":"2015-05-15T01:30:09Z","body":"Oh yeah I forgot about `__repr__`. Just had to replace `__str__` with repr, now it works.\r\n\r\nAnd yes it can be added to sets. `{[qTT` returns `{True}`\r\n\r\nI also added `>=` which I forgot last time."}}