Programming Forums
User Name Password Register
 

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

Reply
 
Thread Tools Display Modes
Old May 21st, 2005, 12:11 PM   #11
jonaskoelker
Newbie
 
Join Date: May 2005
Location: Denmark
Posts: 13
Rep Power: 0 jonaskoelker is on a distinguished road
Send a message via ICQ to jonaskoelker Send a message via AIM to jonaskoelker Send a message via MSN to jonaskoelker Send a message via Yahoo to jonaskoelker
why not just:

import sys

#some code
if foo == 'ja':
    print 'stuff'
    sys.exit(0)
#some more code

or even better yet, put it all in a function:
def main():
  (your code)
  if var == 'ja':
     print 'stuff'
     return
  (more code)

if __name__ == '__main__': main()
__________________
now go away or I shall taunt you a second time :D
jonaskoelker is offline   Reply With Quote
Old Jun 23rd, 2005, 5:53 PM   #12
Cerulean
Professional Programmer
 
Cerulean's Avatar
 
Join Date: Apr 2005
Location: London, England
Posts: 459
Rep Power: 4 Cerulean is on a distinguished road
Because breaking flow is less consistent and requires fractionally more thinking. Seeing "if...else" == flow, and flow == good.
Cerulean is offline   Reply With Quote
Reply

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




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

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