I might be missing something obvious here, but I decided to experiment with writing a program that involves a class, so I'm somewhat new to this in Python.
Anyway, what is the best way to create a function (A) within a class that another function (B) can use? Function A is not something that an instance will ever call, so I figure it's a choice between static or class methods, but I don't know which one, or if this is even the right approach. Specifically, I am writing a class that defines methods that wrap string arguments inside HTML elements, and ultimately creates and HTML page. I know there are probably a ton of programs like this already, but this is just to give me something to do with Python. So I have a generate() method that will create the final HTML file once you are done creating elements. First it will create a string with the proper DTD, then it will append the <head> element and the <body> element, wrapped in the <html> element. Rather than have the generate() function do all the work, I thought I could write two utility functions to generate the head and body elements. These would simply wrap the element names around some pre-defined text (for the head) and around all the other elements (for the body). So I'm wondering, how would I define these two functions? They would be called from the generate method solely for the purpose of creating the head and body blocks. Thanks! -- http://mail.python.org/mailman/listinfo/python-list