protocolbuffers / protocolbuffers/protobuf
Formally document and support python-protobuf-attribute-setting-by-keyword-argument-to-constructor
Open
@anandolee is already working on this.
Since May 5, 2026.
documentation
enhancement
keep open
python
- Dominant language
- C++
- Stars
- 72k
- Forks
- 16.3k
- Avg merge
- 1d 17h
- Merged PRs (30d)
- 140
Description
For years I've favored writing code shaped like
my_message = my_module_pb2.MyMessage(my_first_attribute=3, my_second_attribute=4)
rather than
my_message = my_module_pb2.MyMessage()
my_message.my_first_attribute = 3
my_message.my_second_attribute = 4
. Are these construction semantics documented anywhere? Could they be, along with the similar semantics of
my_message.repeated_sub_message.add(up='↑', down='↓')
rather than
my_sub_message = my_message.repeated_sub_message.add()
my_sub_message.up = '↑'
my_sub_message.down = '↓'
?
Would this page be the right place for such documentation?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.