Let me play the devil's advocate here. I agree that the equivalent Perl code would be much easier to read, but why are you using introspection in this context? Shouldn't dicts (similar to Perl hashes) be used when you want access by arbitrary string key?