8000 Protocol Buffer Basics: Python refers to __metaclass__ but there is none of that in the code snippet · Issue #256 · protocolbuffers/protocolbuffers.github.io · GitHub
[go: up one dir, main page]

Skip to content

Protocol Buffer Basics: Python refers to __metaclass__ but there is none of that in the code snippet #256

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
chwarr opened this issue May 24, 2025 · 0 comments

Comments

@chwarr
Copy link
chwarr commented May 24, 2025

Looking at the rendered output of the Python Tutorial today, I see the following paragraph, which still references __metaclass__. I think some more cleanup in needed, but I'm not sure what...

The important line in each class is __metaclass__ = reflection.GeneratedProtocolMessageType. While the details of how Python metaclasses work is beyond the scope of this tutorial, you can think of them as like a template for creating classes. At load time, the GeneratedProtocolMessageType metaclass uses the specified descriptors to create all the Python methods you need to work with each message type and adds them to the relevant classes.

It looks like some cleanup was done in response to #124 in commit 654b896, but there are still some lingering references to __metaclass__ that makes the documentation confusing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant
0