472,331 Members | 1,584 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,331 software developers and data experts.

Re: Style questions

David,

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

http://hg.softcircuit.com.au/index.w...rcuits/core.py

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?
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()

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

cheers
James

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

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

35
by: wired | last post by:
Hi, I've just taught myself C++, so I haven't learnt much about style or the like from any single source, and I'm quite styleless as a result....
3
by: Csaba2000 | last post by:
I have set onmousedown to change the cursor, but this setting is ignored (IE 5.5; NN 6.1 on Win 2K Pro) until the mouse is either moved or the...
16
by: Harlan Messinger | last post by:
1. CSS has five generic font family specifiers: serif, sans-serif, cursive, fantasy, monospace. IE lets the users select a default proportional font...
3
by: Kalle Anke | last post by:
I'm confused by the concepts of old-style vs new-style classes, I've read most of the documents I found about this but it doesn't "click". Probably...
54
by: Sander | last post by:
1. I was having a discussion with somebody and I think it's just religious. We are developing some software and he was looking through my code. I...
1
by: Dgates | last post by:
I'm learning ASP.NET, C# and VB.NET, and hoping to get some feedback from more experienced programmers on a few issues regarding efficient,...
18
by: pocmatos | last post by:
Hi all, While I was programming 5 minutes ago a recurring issue came up and this time I'd like to hear some opinions on style. Although they are...
8
by: Gary Wessle | last post by:
Hi while I am reading this C++ book, I noticed the iterator is being used to loop through a container, say a vector. I am used to use...
8
by: Ganesh Muthuvelu | last post by:
Hello, I am a ASPX page where I have defined the style for the head element. ****************** <head runat="server" > <style type="text/css">...
8
by: JT | last post by:
Hi, I have done a fair amount of style editing inline in ASP. I'm now using VS 2005 with a standard web project (not Web Application Project). ...
0
by: tammygombez | last post by:
Hey fellow JavaFX developers, I'm currently working on a project that involves using a ComboBox in JavaFX, and I've run into a bit of an issue....
0
by: tammygombez | last post by:
Hey everyone! I've been researching gaming laptops lately, and I must say, they can get pretty expensive. However, I've come across some great...
0
by: concettolabs | last post by:
In today's business world, businesses are increasingly turning to PowerApps to develop custom business applications. PowerApps is a powerful tool...
0
by: Kemmylinns12 | last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and...
0
by: CD Tom | last post by:
This happens in runtime 2013 and 2016. When a report is run and then closed a toolbar shows up and the only way to get it to go away is to right...
0
by: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge...
0
jalbright99669
by: jalbright99669 | last post by:
Am having a bit of a time with URL Rewrite. I need to incorporate http to https redirect with a reverse proxy. I have the URL Rewrite rules made...
0
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was...
0
by: Matthew3360 | last post by:
Hi there. I have been struggling to find out how to use a variable as my location in my header redirect function. Here is my code. ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.