1. So I want to know if it is expected behaviour?
Yes, this was the chosen behaviour.
2. What are the reasons for it?
It's one of the two main behaviours you may want, even if your specific case it is not. It can be used to unserialize enums from a text file. This is the principle behind the text/to pair of functions, and this was copied by the repr of Python.
Bye, bearophile
