Style questions

David Di Biase dave.dibiase at gmail.com
Thu Oct 23 20:04:54 EDT 2008


I have a few simple questions regarding python style standards. I have a
class contained in a module...I'm wondering if I should perform any imports
that are relevant to the class within the constructor of the class or at the
top of the module page.

Also if I'm creating a docstring for the class I should list all my public
methods, should I just list them or should I just summarise what they do?
ie:

    """Displays a graphical game of variant of Connect4.
       Supports two players on a 6x7 game board.

       Public methods:
       __init__()
       clear_screen()
       draw_header()
       draw_board()
       play()
       prompt_for_move()

    """

Last question, sometimes I have a simple function with no keyword arguments
and returns none. According to the styleguide we are to include return None
at the end of the function regardless, so should I also explicitly state
that the function returns this in the one line description? ie:

"""Clears the screen of all content and returns none.  """

I'm sure I'll have more simple ones. This is painstaking :-/

Dave
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20081023/b7367536/attachment.html>


More information about the Python-list mailing list