lcm-proj / lcm

Lightweight Communications and Marshalling
GNU Lesser General Public License v2.1
980 stars 388 forks source link

Add `get_hash()` to generated python classes #340

Closed hoxell closed 3 years ago

hoxell commented 3 years ago

In response to #339

I considered making it a function, get_hash(), a member variable, hash, or a property, hash. In the end I settled for a property since it is more elegant than the function and, in contrast to a member variable, it's read-only.

ashuang commented 3 years ago

What happens if a struct has a user-defined field named "hash" ?

hoxell commented 3 years ago

Right, should've thought of that! 🤦🏻 I suppose a function would make for a cleaner implementation in the end. Will push an update soon.