One module per C API prefix, no C API prefixes in function names.

Issue #16 wontfix
Eric Toombs created an issue

From the FAQ: The low-level APIs for SDL2, SDL2_mixer, SDL2_ttf, ... shall represent a clean wrapping around the original C API calls. Thus, if you have to search for documentation or want to make a Python to C conversion (or C to Python), most of the code cleanly maps to the original API naming and layout and you do not have to think about whether you had to use SDL_ or TTF_ or whatever as prefix or suffix.

I'll tell you what is "clean". One module per C API prefix, just like every other python wrapper around a C API ever made. Think about it. SDL_ goes in an sdl module, TTF_ goes in a ttf module, and so on. The original C API calls can be found just as easily by searching for the function without the prefix. If two calls have the same name, except for the prefix, then just click on the one in your search results that has the prefix that goes with the module name. Function calls aren't just given a prefix for no reason after all. They are related to one another and should be put in the same module.

As for python-to-C conversion. If you really want to do a python-to-C conversion, there are so many syntax and usage differences that you're probably going to have to rewrite it anyway. The function names will be the least of your concern.

Take Cairo, for example. Every Cairo C API call is prefixed with cairo_. The python interface is a clean mapping right to the C API, and they did it without prefixing every one of their python function names with cairo_, to keep things "clean". They just put them all in a module to avoid name collisions, took off the prefixes, and were done with it.

Comments (4)

  1. Marcus von Appen repo owner

    The past and experience with other attempts turned out to be somewhat different from the questions and requests I received. People were confused, did not find the proper documentation, etc.

    For the time being, I'd like to keep it as is. If others share your opinion, please vote for this issue, so that it is considered later on.

  2. anatoly techtonik

    I like the explicit prefixing of C API. It makes clear when function is ctypes based (dangerous) or a convenience wrapper (safe).

  3. Marcus von Appen repo owner

    No votes so far. It's unlikely that I'll change the behaviour, due to a lack of interest from people.

  4. Log in to comment