Notice: While JavaScript is not essential for this website, your interaction with the content will be limited. Please turn JavaScript on for the full experience.
...staticmethod", x, y foo = staticmethod(foo) C.foo(1, 2) c = C() c.foo(1, 2) Both the call C.foo(1, 2) and the call c.foo(1, 2) call foo() with two arguments, and print "staticmethod 1 2". No "self" is declared in the definition of foo(), and no instance is required in the call. If an instance is used, it is only used to find the class that defines the static method. This works for classic and new classes! The line "foo = staticmethod(foo)" in the class statement is the c...
...staticmethod", x, y foo = staticmethod(foo) C.foo(1, 2) c = C() c.foo(1, 2) Both the call C.foo(1, 2) and the call c.foo(1, 2) call foo() with two arguments, and print "staticmethod 1 2". No "self" is declared in the definition of foo(), and no instance is required in the call. If an instance is used, it is only used to find the class that defines the static method. This works for classic and new classes! The line "foo = staticmethod(foo)" in the class sta...
...staticmethod def foo(bar): (The PEP needs to be updated to reflect the current state) When importing a module M raises an exception, Python no longer leaves M in sys.modules. Before 2.4a2 it did, and a subsequent import of M would succeed, picking up a module object from sys.modules reflecting as much of the initialization of M as completed before the exception was raised. Subsequent imports got no indication that M was in a partially- initialized state, and the importers could get into arbit...
...staticmethod and super types participate in garbage collection. Before this change, it was possible for leaks to occur in functions with non-global free variables that used these types. Extension modules the socket module has a new exception, socket.timeout, to allow timeouts to be handled separately from other socket errors. SF bug 751276: cPickle has fixed to propagate exceptions raised in user code. In earlier versions, cPickle caught and ignored any exception when it performed operation...
If you didn't find what you need, try your search in the Python language documentation.