Python’s dynamic nature allows such behavior, and in very limited circumstances, using hasattr() and getattr() is valid. In most cases, however, they just cause obfuscation and introduce bugs. Although these advanced language features might perfectly solve a problem for an expert who knows how to leverage them, power features are often more difficult to understand and are not very widely used.
To be clearer, what's best, in order, is what can be apparent at:
1. Coding time
2. Compile time
3. Testing time
4. Runtime
Reflection makes things unapparent for 1-3

