Status: Accepted
Owner: ----
Labels: Target-2.5.5 Type-Enhancement Priority-High

New issue 678 by pekka.klarck: Enable exposing only some of the functions in a module as keywords with Python's `__all__` attribute
http://code.google.com/p/robotframework/issues/detail?id=678

Currently all functions/methods not starting with an underscore exposed as keywords when a module is used as a library. This can cause problems such as in issue 677. Prefixing all the helpers with an underscore isn't a very nice general solution because you can easily forget to do that.

In my opinion the easiest solution for this problem is making it possible to list what functions actually are keywords. If you use this feature, no helper can ever be accidentally exposed as a keyword. A drawback is that you need to remember list also all new keywords, but forgetting that is easy to spot because the new keywords won't work otherwise. By default all functions would be keywords just as it's done now.

We could use some special `ROBOT_XXX` attribute for this purpose, but Python already has `__all__` which we even use with variable files. Honoring `__all__` also when creating keywords is, in my opinion, logical and also nicely solves the underlying problem.

Reply via email to