copperwire/SIMS

Variable cannot be number

Closed this issue · 2 comments

filename = ["Data_files/depth_profile/151118h.dp_rpc_asc"
            ,"Data_files/depth_profile/151112s.dp_rpc_asc"]
test = interactive_plotting(filename)
test.data_generation()
test.151112s_As-dep

Does not work since a variable cannot start with a number.

The correct method to grab the variable is by
getattr(test, "151112s_as-dep")

Which checks all attributes of the instance of the class against the string. All available attributes of the class can be seen by vars(test)

Granted, this isn't intuitive but allows for an arbitrary variable name.

Thank you!