A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2006-March/062295.html below:

[Python-Dev] Making staticmethod objects callable?

[Python-Dev] Making staticmethod objects callable? [Python-Dev] Making staticmethod objects callable?Armin Rigo arigo at tunes.org
Sun Mar 12 16:32:36 CET 2006
Hi Nicolas,

On Thu, Mar 02, 2006 at 01:55:03AM -0500, Nicolas Fleury wrote:
> (...)  A use case is not hard to 
> imagine, especially a private static method called only to build a class 
> attribute.

Uh.  I do this all the time, and the answer is simply: don't make that a
staticmethod.  Staticmethods are for the rare case where you need
dynamic class-based dispatch but don't have an instance around.

    class A:
        def _myinitializer():
            do strange stuff here
        _myinitializer()
        del _myinitializer   # optional


A bientot,

Armin
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4