Course Hive
Search

Welcome

Sign in or create your account

Continue with Google
or
Learn Python DECORATORS in 7 minutes! ๐ŸŽŠ
Play lesson

Python tutorial for beginners ๐Ÿ - Learn Python DECORATORS in 7 minutes! ๐ŸŽŠ

4.0 (0)
8 learners

What you'll learn

This course includes

  • 14.3 hours of video
  • Certificate of completion
  • Access on mobile and TV

Summary

Keywords

Full Transcript

# Decorator = A function that extends the behavior of another function # w/o modifying the base function # Pass the base function as an argument to the decorator def add_sprinkles(func): def wrapper(*args, **kwargs): print("*You add sprinkles ๐ŸŽŠ*") func(*args, **kwargs) return wrapper def add_fudge(func): def wrapper(*args, **kwargs): print("*You add fudge ๐Ÿซ*") func(*args, **kwargs) return wrapper @add_sprinkles @add_fudge def get_ice_cream(flavor): print(f"Here is your {flavor} ice cream ๐Ÿจ") get_ice_cream("vanilla")

Course Hive

Continue this lesson in the app

Install CourseHive on Android or iOS to keep learning while you move.

Related Courses

FAQs

Course Hive
Download CourseHive
Keep learning anywhere