J
J
Joseph Goodman2020-10-22 10:51:02
Python
Joseph Goodman, 2020-10-22 10:51:02

Why can't I declare class methods in different cells?

Good day.
In this question, you do not need to think about the essence of the code. It annoys me that the methods declared outside the cell where the class is declared are no longer considered its methods.
For example, the train method shown in the screenshot will no longer apply to NaiveBayesClassifier objects, since it is declared in another cell.
It seems to me that then part of the convenience of the so-called python "laptops" is lost.
Is it possible to configure this nuance?
5f91395364534335700510.png

Answer the question

In order to leave comments, you need to log in

1 answer(s)
Z
zexer, 2020-10-22
@lolaevv

You can't set it up, you don't need to set it up - as this is outright stupidity. I don’t even want to go into technical details in order to explain from a technical point of view that this is stupid.
Python laptops (they are not only Python ones, if anything) are not made for this.
Their convenience lies not in writing each method in a separate cell, but in the fact that they allow you to conduct DATA ANALYSIS in a way that is possible nowhere else.
I built a table -> I described my conclusions in text, if I wanted to, I numbered it through markdown, made some kind of style, built a graph in the next cell, and it's all very simple, easy and intuitive.
Such a laptop is then easy to read, easy to analyze graphs and read comments on these graphs.
What you are trying to do is not convenience and not about laptops at all.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question