Tinkerbell Glitter
[250103] ๋ฐ์ฝ”๋ ˆ์ดํ„ฐ๋ž€?
Back End ๐Ÿ“ฒ/Python ๐Ÿ’ป
๋ฐ์ฝ”๋ ˆ์ดํ„ฐ๋ž€? โœจ1. ๋ฐ์ฝ”๋ ˆ์ดํ„ฐ ์ •์˜๋ฐ์ฝ”๋ ˆ์ดํ„ฐ๋Š” ๊ธฐ์กด์˜ ํ•จ์ˆ˜๋‚˜ ๋ฉ”์„œ๋“œ์— ๊ธฐ๋Šฅ์„ ์ถ”๊ฐ€ํ•˜๊ฑฐ๋‚˜ ์ˆ˜์ •ํ•  ์ˆ˜ ์žˆ๋Š” ํŒŒ์ด์ฌ์˜ ๊ณ ๊ธ‰ ๊ธฐ๋Šฅ์ด๋‹ค๋‹ค๋ฅธ ํ•จ์ˆ˜๋ฅผ ์ž…๋ ฅ์œผ๋กœ ๋ฐ›์•„ ์‹คํ–‰ ๊ฒฐ๊ณผ๋ฅผ ๋ฐ˜ํ™˜ํ•˜๋Š” ๊ณ ์ฐจ ํ•จ์ˆ˜(Higher-Order Function)์˜ ์ผ์ข…์ž„์ฃผ๋กœ ํ•จ์ˆ˜๋‚˜ ๋ฉ”์„œ๋“œ์˜ ์ „ํ›„์— ์‹คํ–‰๋  ๋กœ์ง์„ ์ถ”๊ฐ€ํ•  ๋•Œ ์‚ฌ์šฉํ•œ๋‹ค2. ๋ฐ์ฝ”๋ ˆ์ดํ„ฐ์˜ ๊ธฐ๋ณธ ๊ตฌ์กฐ๊ธฐ๋ณธ ํ•จ์ˆ˜def my_function(): print("Hello, World!")๋ฐ์ฝ”๋ ˆ์ดํ„ฐ ํ•จ์ˆ˜ ์ •์˜def my_decorator(func): def wrapper(): print("Before the function call") func() # ์›๋ž˜ ํ•จ์ˆ˜ ์‹คํ–‰ print("After the function call") return..