Created
June 5, 2015 10:19
-
-
Save awesomebytes/04a616c6c7c45dab79e3 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def msg_to_list(message): | |
| """ | |
| Given a message, e.g.: Vector3(x=0.0, y=0.0, z=0.0) | |
| returns the list of it's slots, e.g.: [0.0, 0.0, 0.0] | |
| :param message: some message that we want it's slots into a list | |
| :return: the slots as a list | |
| """ | |
| output_list = [] | |
| for slot in message.__slots__: | |
| output_list.append(message.__getattribute__(slot)) | |
| return output_list |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment