mirror of
https://gitflic.ru/project/openide/openide.git
synced 2025-12-16 14:23:28 +07:00
28 lines
643 B
HTML
28 lines
643 B
HTML
<html>
|
|
<body>
|
|
<p>Reports any methods that do not require a class instance creation and can be
|
|
made static.</p>
|
|
<p><b>Example:</b></p>
|
|
<pre><code>
|
|
class MyClass(object):
|
|
def my_method(self, x):
|
|
print(x)
|
|
</code></pre>
|
|
<p>If a <b>Make function from method</b> quick-fix is applied, the code changes to:</p>
|
|
<pre><code>
|
|
def my_method(x):
|
|
print(x)
|
|
|
|
|
|
class MyClass(object):
|
|
pass
|
|
</code></pre>
|
|
<p>If you select the <b>Make method static</b> quick-fix, the <code>@staticmethod</code> decorator is added:</p>
|
|
<pre><code>
|
|
class MyClass(object):
|
|
@staticmethod
|
|
def my_method(x):
|
|
print(x)
|
|
</code></pre>
|
|
</body>
|
|
</html> |