Hi, folks.

I'm implementing an algorithm and must pass many arguments to the init function 
in a module that does the configuration. Then, those parameters will be used in 
many functions, including passing them to functions in other modules. I was 
wondering what the best way of doing that in Nim is.

For instance, the code below is how it's commonly done in Python. Since it's a 
class, the methods can access those attributes, meaning I won't have to pass 
them as arguments. In Nim, should I create all those "self" attributes as 
globals?
    
    
    def __init__(
            self,
            loss,
            *,
            learning_rate,
            max_iter,
            max_leaf_nodes,
            max_depth,
            min_samples_leaf,
            l2_regularization,
            max_features,
            max_bins,
            categorical_features,
            monotonic_cst,
            interaction_cst,
            warm_start,
            early_stopping,
            scoring,
            validation_fraction,
            n_iter_no_change,
            tol,
            verbose,
            random_state,
        ):
            self.loss = loss
            self.learning_rate = learning_rate
            self.max_iter = max_iter
            self.max_leaf_nodes = max_leaf_nodes
            self.max_depth = max_depth
            self.min_samples_leaf = min_samples_leaf
            self.l2_regularization = l2_regularization
            self.max_features = max_features
            self.max_bins = max_bins
            self.monotonic_cst = monotonic_cst
            self.interaction_cst = interaction_cst
            self.categorical_features = categorical_features
            self.warm_start = warm_start
            self.early_stopping = early_stopping
            self.scoring = scoring
            self.validation_fraction = validation_fraction
            self.n_iter_no_change = n_iter_no_change
            self.tol = tol
            self.verbose = verbose
            self.random_state = random_state
    
    
    Run

Thanks. 

Reply via email to