469,954 Members | 1,708 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,954 developers. It's quick & easy.

Re: Style questions


Here's a "good" example (NB: subjective):


On Fri, Oct 24, 2008 at 10:04 AM, David Di Biase <da**********@gmail.comwrote:
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.
Normally imports are conventionally done at the top of the module.
Within the module's scope.
Some people import the entire module while others
import only bits that they need.
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?

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

Public methods:

Don't write what can be easily dispalyed
with pydoc or some other documentation tool.
The methods are already clearly there.
See my core.py above.
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:
Not generally. Most python developers
know that functions that do not have a return
statement, actually implicitly returns None.

You're documenting for developers (python developers) not users.


-- "Problems are solved by method"
Oct 24 '08 #1
0 780

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

16 posts views Thread by Harlan Messinger | last post: by
3 posts views Thread by Kalle Anke | last post: by
54 posts views Thread by Sander | last post: by
1 post views Thread by Dgates | last post: by
18 posts views Thread by pocmatos | last post: by
8 posts views Thread by Gary Wessle | last post: by
8 posts views Thread by Ganesh Muthuvelu | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.