En Mon, 21 May 2007 07:39:09 -0300, Unknown <[EMAIL PROTECTED]> escribió:
> "Ant" <[EMAIL PROTECTED]> schreef in bericht > news:[EMAIL PROTECTED] > >> Herman has shown you *how* to do static methods in Python, but >> typically they are not used. Since Python has first class functions, >> and they can be defined at the module level, there is no need to use >> static methods. > > As an experienced developer I'm rather new to Python, so please forgive > me any non-Pythonic babbling. >> From a language point you're probably right, but from a design point I'd > like to have methods that are clearly associated with a class as methods > of that class, even if they don't use any class or instance related data. In that case you might want to revise the design, perhaps you carry some preconceptions about how things should be, that are not directly applicable here. (I'm not saying this is related to your specific problem because I don't know exactly what you want, but in general, a lot of design patterns *implementations* are not directly applicable to Python). Modules are objects too - they're a good example of singletons. If you want to create a class containing only static methods: use a module instead. If you want to create a class having a single instance (a singleton), most of the time you can use a module instead. Functions don't *have* to be methods in a class, and the resulting design may still be a good design from an OO point of view. -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list