HElper function

Please support our Python advertiser: Programming Forums - DaniWeb Sister Site
Thread Solved

Join Date: Oct 2008
Posts: 3
Reputation: dem10 is an unknown quantity at this point 
Solved Threads: 0
dem10 dem10 is offline Offline
Newbie Poster

HElper function

 
0
  #1
Oct 27th, 2008
What is a helper function?
Reply With Quote Quick reply to this message  
Join Date: Oct 2004
Posts: 4,126
Reputation: vegaseat is just really nice vegaseat is just really nice vegaseat is just really nice vegaseat is just really nice vegaseat is just really nice 
Solved Threads: 946
Moderator
vegaseat's Avatar
vegaseat vegaseat is offline Offline
DaniWeb's Hypocrite

Re: HElper function

 
0
  #2
Oct 27th, 2008
I think you might mean this:
  1. # access count using a bookie or helper function
  2. # (code from G-Do)
  3.  
  4. def bookie(func):
  5. """helper function"""
  6. func.count += 1
  7.  
  8. def f3():
  9. bookie(f3)
  10. # your code goes here
  11.  
  12. f3.count = 0
  13.  
  14. for k in range(10):
  15. f3()
  16.  
  17. print "Function f3() has been accessed", f3.count,"times"
  18.  
  19. """
  20. my output -->
  21. Function f3() has been accessed 10 times
  22. """
May 'the Google' be with you!
Reply With Quote Quick reply to this message  
Join Date: Jul 2007
Posts: 489
Reputation: shadwickman will become famous soon enough shadwickman will become famous soon enough 
Solved Threads: 76
shadwickman's Avatar
shadwickman shadwickman is offline Offline
Posting Pro in Training

Re: HElper function

 
0
  #3
Oct 28th, 2008
Ah, I didn't know that myself either. Is there more of a general definition of it? I get what the example does, but I'm just curious about the sort of extent/functions that this term can be used to/for.
"Two good old boys in a fire-apple red convertible. Stoned. Ripped. Twisted. Good people."
- Hunter S. Thompson

my photography
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:




Views: 612 | Replies: 2
Thread Tools Search this Thread



Tag cloud for Python
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC