Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

 
 
Thread Tools Display Modes
Prev Previous Post in Thread   Next Post in Thread Next
Old Jan 24th, 2007, 10:00 PM   #1
MR.T
Newbie
 
MR.T's Avatar
 
Join Date: Feb 2006
Location: USA,Michigan
Posts: 22
Rep Power: 0 MR.T is on a distinguished road
Some general programming questions in python

I have a few general programming questions. But since there isn't a general programming section, and I'm using python, I figured I'd post them here.

First off, say my program is a game. The user is asked to and selects defend. In order to defend, a variable is changed to true. Which is of course, a single line of code. Does it make difference performance or design wise, if that line is in the input function that asked the player to defend? or if it's in its very own defend function?

Now on to classes. I understand how classes are used for inheritance, polymorphisms and so on. What I never understood is, are they suppose to be used for organization also? Even if a function or something, doesn't really need to be in a class, should it be?
Also, should I put my variables that are used by multiple function, inside a class that they are at least somewhat related to, so I can use there scope to change them, instead of making them global? Would that be more efficient?

And lastly, should comments that are related to something like a variable be placed beside it or above it? And for multi-line comments, should I use triple quotes, or a # sign at the begging of each line?
__________________
"Gee, Brain, what do you want to do tonight?" "The same thing we do every night, Pinky: Try to take over the world!"
MR.T is offline   Reply With Quote
 

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Python programming game? commodore Python 7 Feb 7th, 2006 6:26 PM
[tutorial] Python for programming beginners coldDeath Python 30 Dec 14th, 2005 11:35 AM
Python - A Programmers Introduction coldDeath Python 17 Aug 19th, 2005 12:41 PM
Emergency: Confusing C Programming assignment questions silvia C 3 Jul 13th, 2005 3:39 AM
n00b questions on Win Programming and MFC astinus C++ 6 Apr 23rd, 2005 10:50 PM




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 11:34 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC