should a module export a function named `exit()`?
Question: I'm currently working on a module that wraps a C-library (let's call it `foo`)

The C-library has its functions prefixed by `foo_` to avoid nameclashes with
other libraries:

    
    
    int foo_dothis(int x, int y);
    void foo_dothat(struct foo_struct_*s);
    

In python, the `foo_` prefix makes little sense, as we have namespaces for
that kind of things.

    
    
    import foo
    foo.dothis(42)
    

The C-library also has functions for initializing/deinitializing the entire
library:

    
    
    int foo_init(void);
    void foo_exit(void);
    

Now i'm wondering whether I should strip the `foo_` prefix for those as well,
in order to prevent confusion with the built-in `exit()`:

    
    
    from foo import *
    exit()
    

I guess it is OK, as

  * being consistent is important
  * `exit()` is easier to remember than `foo_exit()`
  * `foo.exit()` is prettier than `foo.foo_exit()`
  * people are generally discouraged to use `exit()` in production code (and should only use it in the interpreter)
  * importing all symbols from a module asks for trouble anyhow

So what is the common approach to that (best-practice,...)


Answer: Since the role of `foo_exit()` is to uninitialise the library, and this is
kind of the inverse of `foo_init()`, you could simply use name `foo.uninit()`
for the Python function. This will avoid name clashes and confusion with the
builtin `exit()`, and its purpose should be obvious to users of the module.

