Python Language OOP: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
Line 10: Line 10:


<syntaxhighlight lang='py'>
<syntaxhighlight lang='py'>
class MyClass():
class MyClass:
   def __init__(self):
   def __init__(self):
     pass
     pass
</syntaxhighlight>
The class may be declared with parentheses, but the IDE static checks find those as "redundant":
<syntaxhighlight lang='py'>
class MyClass():
  ...
</syntaxhighlight>
</syntaxhighlight>



Revision as of 20:28, 15 March 2022

External

Internal

Overview

Attributes and methods.

Class

class MyClass:
  def __init__(self):
    pass

The class may be declared with parentheses, but the IDE static checks find those as "redundant":

class MyClass():
  ...

Initialization

Inheritance

Overriding

Polymorphism

.