943,740 Members | Top Members by Rank

Ad:
  • Python Discussion Thread
  • Marked Solved
  • Views: 1587
  • Python RSS
Oct 27th, 2008
0

HElper function

Expand Post »
What is a helper function?
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
dem10 is offline Offline
11 posts
since Oct 2008
Oct 27th, 2008
0

Re: HElper function

I think you might mean this:
python Syntax (Toggle Plain Text)
  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. """
Moderator
Reputation Points: 1333
Solved Threads: 1403
DaniWeb's Hypocrite
vegaseat is offline Offline
5,792 posts
since Oct 2004
Oct 28th, 2008
0

Re: HElper function

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.
Reputation Points: 186
Solved Threads: 77
Posting Pro in Training
shadwickman is offline Offline
495 posts
since Jul 2007

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Python Forum Timeline: What's wrong with this Boa code ?
Next Thread in Python Forum Timeline: Problems with Vista and wxPython





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC