Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> 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/06b8f1615b09099fae5c5...



Learn something new every day. I hadn't thought to check, just figured it was reserved since iPython used it fine.

Thanks for the correction.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: