This is an automatically generated e-mail. To reply, visit: http://reviewboard-openlmi.rhcloud.com/r/461/ |
On June 18th, 2013, noon UTC, Stephen Gallagher wrote:
In my opinion, it would be preferable to implement get_property_value() method for standard objects. The "pythonic" way of handling this is just as it currently is: object.property contains the value. Returning the dictionary would be a bad idea, as for complex objects this may result in a huge waste of memory for the common case. If you want a handy dictionary like that, I'd recommend making it a separate function from object.properties() like object.properties_dict() with a note in the pydoc that it may result in significant memory overhead. To sum up: I suggest adding: .get_property_val(property_name) that can internally use getattr() to retrieve the value, hiding it from the public interface Optionally, if it is useful in some situations, we can add .properties_dict() which will return a full dictionary of all properties, at the expense of memory. If you implement both of these, please do *not* implement get_property_val() using properties_dict(), as this would be inefficient.
This sounds reasonable.
- Peter
On June 18th, 2013, 1:10 p.m. UTC, Peter Hatina wrote:
Review request for OpenLMI Developers.
By Peter Hatina.
Updated June 18, 2013, 1:10 p.m.
Repository:
openlmi-tools
Description
Diffs
|