'Passing arguments to internal methods troght arguments or attributes?
I have a class with a method that call to a private method, and this one, also call to a private method. All of this methods are in the same class.
I don´t now which is the best way to send data to this private methods, if including this parameters as arguments of the method or if using attributes of the class:
For example, ¿which approach is better?
def MyClass():
_number: int = 0
def _multiply_by_two(self) -> None:
self._number = self._number * 2
return None
def _sum_one(self) -> None:
number += 1
return None
def method(self, number: int) -> int:
self._number = number
number = self._sum_one()
return number
def MyClass():
def _multiply_by_two(self, number: int) -> int:
number = number * 2
return number
def _sum_one(self, number: int) -> int:
number += 1
number = self._multiply_by_two(number)
return number
def method(self, number: int):
return self._sum_one(number)
Solution 1:[1]
If you check the Search.list method you will notice that it does not have any way of limiting the data that is returned.
You will need to remove these locally.
It may be worth adding a feature request to the issue forumn
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | DaImTo |
