What is a helper function?

Recommended Answers

All 2 Replies

I think you might mean this:

# access count using a bookie or helper function
# (code from G-Do)

def bookie(func):
    """helper function"""
    func.count += 1

def f3():
    bookie(f3)
    # your code goes here

f3.count = 0

for k in range(10):
    f3()

print "Function f3() has been accessed", f3.count,"times"

"""
my output -->
Function f3() has been accessed 10 times
"""

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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.