PHP and Python static methods in objects, two different worlds...?
<p>i'm php coder, trying to get into python world, and it's very hard for me.</p>

<p>Biggest enjoy of static methods in php is automatic builder of instance. No need to declare object, if you needed it once, in every file (or with different constructor params , in one line)</p>

<pre><code>&lt;?php
class Foo { 
    function __constructor__(){
        $this-&gt;var = 'blah';
    }
   public static function aStaticMethod() {
       return $this-&gt;var;
   }
}

echo Foo::aStaticMethod();
?&gt;
</code></pre>

<p>we can call constructor from static method don't we? and we can access everything in class as it would be simple method ... we can even have STATIC CONSTRUCTOR in php class and call it like so: Object::construct()->myMethod(); (to pass different params every time)</p>

<p>but not in python???? @staticmethod makes method in class a simple function that doesn't see totally anything ?? </p>

<pre><code>class socket(object):

def __init__(self):
    self.oclass = otherclass()
    print 'test' # does this constructor called at all when calling static method??                

@staticmethod
def ping():
    return self.oclass.send('PING') # i can't access anything!!!


print Anidb.ping()
</code></pre>

<p>I can't access anything from that god damned static method, it's like a standalone function or something like this..??</p>

<p>Maybe I'm using the wrong decorator? Maybe there's something like php offers with static methods in python? </p>

<p>1) Please tell why static methods is isolated
2) Please tell me how to make the same behavior like php static methods have.
3) Please tell me alternative practical use of this, if php static methods behavior is a bad thing</p>

<p>P.s. the goal of all this to write totally less code as much as possible.
P.p.s Heavy commenting of sample code is appreciated </p>

<p>Thank you. </p>
