utility functions within a class?



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!
.



Relevant Pages

  • Re: Effects of Magic
    ... I've got dialogue in my head and I'm writing it down already. ... because I much prefer the scenes where I've ... better class of first draft as long as I know the setting, ...
    (rec.arts.sf.composition)
  • Re: Clue bats
    ... I could tell myself more complicated stories. ... I can't keep them in my head, so I have to write them down. ... and I enjoy the process of writing very much ... I've been absolutely utterly thoroughly stuck 20K after a missed ...
    (rec.arts.sf.composition)
  • Re: newbie: css in every page in app
    ... Then I needed to add CSS links to each "head" ... within the html tags. ... code your child to add controls to these containers. ... you get control over both the html head and body. ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Converting Perl Web Report to Python
    ... by allowing the user to pass in an SQL query parameter to the sql ...
    (comp.lang.python)
  • Re: Pulse Head
    ... (Thanks a lot, Tek.) ... A fast logic gate or LVDS receiver, ... What's with the html? ...
    (sci.electronics.design)