You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on May 31, 2025. It is now read-only.
$ python
Python 2.7.11 (default, Jan 22 2016, 08:29:18)
[GCC 4.2.1 Compatible Apple LLVM 7.0.2 (clang-700.1.81)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from std_msgs.msg import Int8
>>> foo = Int8()
>>> foo.data = 1
>>> hash(foo)
275653405
>>> foo.data = 2
>>> hash(foo)
275653405 # Should be different!
>>> bar = Int8()
>>> bar.data = 1
>>> hash(bar)
275876165 # Should be the same as the first one!
The default hash method supplied with object is based on identity rather than fields, hence the above behaviour.
Instead, generated messages should supply a __hash__ function which hashes the data, possibly as simple as just passing the message's string representation to hash.