3
Contributors
2
Replies
4
Views
9 Years
Discussion Span
Last Post by shadwickman
0

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
"""
0

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.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.