3 ms·
> exit is not a keyword, but it is reserved so that you can get this message. `exit` is not reserved. It's a callable implemented in pure Python [1] injected
by luhn 5y ago
> exit is not a keyword, but it is reserved so that you can get this message.
`exit` is not reserved. It's a callable implemented in pure Python [1] injected into the local scope when in interactive mode. There's no special functionality associated with it—The error message is implemented using the standard `__repr__` behavior. You are free to override the value of `exit` if you so choose.
"Special cases aren't special enough to break the rules."
[1] https://github.com/python/cpython/blob/06b8f1615b09099fae5c5393334b8716a4144d20/Lib/_sitebuiltins.py#L13 https://github.com/python/cpython/blob/06b8f1615b09099fae5c5...
- easton 5y agoLearn something new every day. I hadn't thought to check, just figured it was reserved since iPython used it fine. Thanks for the correction.