Skip to content

Commit

Permalink
Merge pull request mouredev#4364 from cyberdidac/main
Browse files Browse the repository at this point in the history
mouredev#24 - Python
  • Loading branch information
Roswell468 authored Jun 17, 2024
2 parents 99b49fd + 96d4133 commit e4e0465
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions Roadmap/24 - DECORADORES/python/cyberdidac.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
def count_calls(func):
def wrapper():
wrapper.count += 1
print(f"La función {func.__name__} ha sido llamada {wrapper.count} veces")
return func()

wrapper.count = 0
return wrapper


@count_calls
def say_hello():
print("Hola!")


def main():
say_hello()
say_hello()


if __name__ == '__main__':
main()

0 comments on commit e4e0465

Please sign in to comment.