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
With the python-protobuf package installed locally, pydoc shows the existence of a class/static method FromString() which creates a new instance from serialized data ("method" in the docstring doesn't make much sense, but 🤷🏻♂️):
$ pydoc3 google._upb._message.Message|grep -C3 FromString
| Class methods defined here:
|| FromString(...)
| Creates new method instance from given serialized data.
I expect to see the .FromString method in online documentation.
It allows more concise and Pythonic deserialization of Protobuf messages, because it combines instantiating the Message sub-class with calling .ParseFromString() on it:
Version:
main
Operating System: Linux, but irrelevant
Runtime: Python 3.12
The undocumented method in question
With the
python-protobuf
package installed locally,pydoc
shows the existence of a class/static methodFromString()
which creates a new instance from serialized data ("method" in the docstring doesn't make much sense, but 🤷🏻♂️):The C source of this method is found at:
protobuf/python/message.c
Lines 1525 to 1542 in 9668016
What does the documentation currently show?
The
.ParseFromString
and.MergeFromString
methods are well-documented and widely seen in real-world Python protobuf code.The
.FromString
static/class method is BASICALLY UNDOCUMENTED:What should the documentation show?
I expect to see the
.FromString
method in online documentation.It allows more concise and Pythonic deserialization of Protobuf messages, because it combines instantiating the
Message
sub-class with calling.ParseFromString()
on it:The text was updated successfully, but these errors were encountered: