I am new to Python. I got Python sample code from a software vendor who expanded their programming API with boost.python, so we can name them in Python. I am confused by some segments, for example:
settings = zoo.AddAnimalSettings(carni_bird_list) settings.Name = 'birds' settings.Type = settings.Type.enum.Bird settings.water_min = 1, units.Litre settings.food_min = 10, units.Gram
All variable names are replaced with all these funny things, just to explain the general idea.
So, the problem is in the third line. How can we set the variable settings.Type with its additional property settings.Type.enum.Bird , where enum.Bird I assume that this is some kind of enumerator of different species of animals, which is a sub-property of settings.Type ?
I tried to do some kind of test to add one line from the following 5 lines to see if there is enum.Bird :
settings.Type = settings.Type.enum.Bird
and it works fine. So, for this instance of settings this sub Type property is not overwritten by its additional enum.Bird property, it still knows that enum.Bird is its sub-property.
Can you advise if I need to implement this line in Python, how can I do this?
I assume this would be pretty interesting knowledge for people learning Python, so I asked this question here for discussion. I am trying to think in C ++, but I did not understand this.
source share