| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
|
This look interesting. I like the general idea for sure. Given proto's use of default zero values I wonder if it's more useful to know:
This PR seems to implement 1 unless I'm mistaken. Thoughts? To elaborate, you can see that a Python list will return to False after you explicitly "set" it by removing the item: >>> test = []
>>> bool(test)
False
>>> test.append(1)
>>> bool(test)
True
>>> test.pop()
1
>>> bool(test)
FalseI think the proto equivalent is setting the int32 to 0 since that should mean it never gets sent over the wire since it's the zero value for the type. |
Sorry, something went wrong.
|
Am I mistaken in thinking that returning self._serialized_on_wire would achieve this? |
Sorry, something went wrong.
|
I should have this working as a collection would now, so if a value is set to anything and then has its value set to its default it will return False |
Sorry, something went wrong.
|
@Gobot1234 I think we can merge this in principal, but it's significant an API feature that it should really be documented. Would you mind? |
Sorry, something went wrong.
|
Ah yes of course. |
Sorry, something went wrong.
|
Sorry just realised I haven't added it to the Sphinx special members directive yet |
Sorry, something went wrong.
* Implement Message.__bool__ with similar semantics to a collection, such that any value being set on the message (i.e. having a non-default value) make the Message value truthy . Co-authored-by: nat <n@natn.me>
| Back | FazBrowse Home | New Git URL |
Carries on from #138, I messed up the git tree.