Changing docs for C to Python

Starting from almost every code or function or anything related to programming is given for C language. Some code is understandable and is okay. But in sections like “Optimizing your application” the code is in C which is really not useful at all.

Is there any place, I can get them for Python?

The different language bindings typically provide their own version of the GNOME APIs in a format that is consistent with what developers for those languages would expect. You can find that for Python at the PyGObject API Reference.

There is also an excellent GTK tutorial as well.

Note that these are linked to from the link you provide above if you click on “API references” then scroll down to the “Python” section under " Language Bindings".


No no, Im not talking about API reference. Like has almost all of its guidelines for C language. But I want them in Python. Possible?

No, definitely not, because of the nature of the content. That page’s introduction reads:

This article contains several guidelines and suggestions for programmers working in and with the GNOME stack. This is intended for programmers to know about the development processes, conventions and philosophies behind GNOME applications and the stack of libraries supporting them.

…The GNOME libraries and applications themselves are written in C. (Or, traditionally they were. Now they’re written in a mix of languages, including a fair bit of JavaScript and Lua, but still relatively little Python. The only two gnome* modules in my Fedora 31 machine’s /usr/{lib,lib64}/python3.7/site-packages/ are gnomemusic and gnome_abrt.)

So, while there are language bindings that export GNOME APIs to other languages, that doesn’t mean the GNOME coding guidelines apply to those languages, or that the GNOME developers would be a particularly good source of Python coding advice.

Coding advice for GNOME’s Python APIs would require someone to write it, specifically in the context of that language, and such a document would end up having almost no discernible relationship to the one written (quite a long time ago) by and for the core GNOME C-language developers.

But, really, it’ll be far more productive to take good Python coding advice (there’s plenty out there, starting with the style guidance found in the venerable PEP8 itself) and apply it to writing Python code that works with the GNOME Python APIs, than it would be to translate GNOME-centric C coding advice into (inevitably poorer) Python coding advice.


Thanks for that. So may be I think I can help in writing Python version !:smiley: What are the steps involved in submitting these?

Unlike C, Python already has a formal set of style guidelines, as @FeRDNYC said. When writing Python code, even when using GNOME-related modules, you should follow that.

You can use linters like pylint, pyflakes, pep8, or flakes8 to ensure that your code is appropriately styled.

Python modules and applications should follow the Python best practices; the various programming guides on are mostly there for C developers because C does not have that kind of documentation to begin with—unlike most, newer, high level languages.

In any case, if you want to propose changes or additions to the developer documentation, you can file an issue in the gnome-devel-docs project.

1 Like

You can use linters like pylint, pyflakes, pep8, or flakes8 to ensure that your code is appropriately styled.

Note that pep8 was renamed to pycodestyle a few years ago. While older versions are still available under the old name, it’s better not to use them.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.