About 122,000 results
Open links in new tab
  1. class - Classes vs. Functions - Stack Overflow

    May 22, 2016 · Never create classes. Always use functions. Edit: Research has repeatedly shown that Classes are an outdated method of programming. Nearly every research paper on the …

  2. python - Why do some functions have underscores - Stack Overflow

    May 24, 2024 · For example, __file__ indicates the location of Python file, __eq__ is executed when a == b expression is executed. A user of course can make a custom special method, …

  3. When should I be using classes in Python? - Stack Overflow

    Oct 12, 2015 · Classes are the pillar of Object Oriented Programming. OOP is highly concerned with code organization, reusability, and encapsulation. First, a disclaimer: OOP is partially in …

  4. Defining and Calling a Function within a Python Class

    Aug 6, 2018 · There’s no way for Python to tell that you wanted one of them to be a local function and the other one to be a method. They’re both defined exactly the same way. And really, …

  5. python - How can I call a function within a class? - Stack Overflow

    In the following example, greet() method is defined in both Parent and Child classes and if you want to call Parent's greet(), the prescribed way is via super(), i.e. super().greet(). It's also …

  6. How much slower python classes are compared to their equivalent …

    When I started learning Python, I created a few applications just using functions and procedural code. However, now I know classes and realized that the code can be much readable (and …

  7. Difference between Module and Class in Python - Stack Overflow

    Aug 24, 2022 · So a module in python is simply a way to organize the code, and it contains either python classes or just functions. If you need those classes or functions in your project, you just …

  8. python - When should I use a class and when should I use a …

    Jul 4, 2012 · Python isn't like that. It's perfectly OK - in fact recommended - to define functions standalone, and related functions can be grouped together in modules. As others have stated, …

  9. Python declaration order: classes or functions first?

    Feb 6, 2015 · You can decorate classes with functions. Then the decorator function must be defined before the class. OTOH, you can decorate functions with classes. Then the decorator …

  10. python - Call Class Method From Another Class - Stack Overflow

    Apr 17, 2022 · We define 2 classes, CurrentValue and AddValue We define 3 methods in the first class One init in order to give to the instance variable self.value an initial value A set_val …

Refresh