|Version 6 (modified by marko, 22 months ago) (diff)|
CamelCase to underscore_separated
Names of methods, functions, (object) attributes and keyword attributes of functions should all be underscore_separated. Abbreviations should also be in lower case. For example, we should rename AUCWilcoxon to auc_wilcoxon (and not AUC_wilcoxon).
For now, all C++ code is accessible both with CamelCase and underscore separated (detailed description). Python code should be converted with name deprecation decorators (see the page for an example).
Do forget to update the refactoring rules.
Output of models
Output of learning models. Learning models (classifiers, regressors) need to have __str__ defined. If it needs a parameter, also add a to_string method, but __str__ should still return something. For example
data = Orange.data.Table("titanic") c = Orange.classification.tree.TreeLearner(data) print c #prints out the model print c.to_string(max_depth=1) #with some special formatting
The most typical one should be plot(), but if there are multiple different plots, prefix them with plot_, for example plot_dendrogram.
TODO: what should be default output?
Data set naming
In documentation, do not use table. Name of the data set is preferred (but just data is also acceptable), so write:
iris = Orange.data.Table("iris")
In code, use data.
Import just Orange and use full paths. Avoid exceptions. Never import *.