About 335,000 results
Open links in new tab
  1. 装饰器模式 - 菜鸟教程

    抽象装饰器(Decorator):继承自抽象组件,它包含了一个抽象组件对象,并定义了与抽象组件相同的接口,同时可以通过组合方式持有其他装饰器对象。

  2. 装饰器 - Python教程 - 廖雪峰的官方网站

    现在,假设我们要增强 now() 函数的功能,比如,在函数调用前后自动打印日志,但又不希望修改 now() 函数的定义,这种在代码运行期间动态增加功能的方式,称之为“装饰器”(Decorator)。 …

  3. Decorators in Python - GeeksforGeeks

    Sep 22, 2025 · decorator takes the greet function as an argument. It returns a new function (wrapper) that first prints a message, calls greet () and then prints another message.

  4. Decorator - refactoring.guru

    The Decorator lets you structure your business logic into layers, create a decorator for each layer and compose objects with various combinations of this logic at runtime.

  5. Decorator pattern - Wikipedia

    In object-oriented programming, the decorator pattern is a design pattern that allows behavior to be added to an individual object dynamically, without affecting the behavior of other instances …

  6. Python3基础之: Decorator (修饰器) - 知乎

    换句话说, Decorator (修饰器)就是Python内部提供的一个语法便利,用于更加快捷、方法、直观地实现修饰器模式。 修饰器模式会使用得代码结构比较复杂,而decorator则不存在这个问题。

  7. Python 装饰器:提升代码的简单模式 - Python 速查表

    Aug 16, 2025 · 当你在函数上方看到 @something 时,是否会好奇其中隐藏着什么魔法?我也有过同样的感受。装饰器(Decorators)可能看起来令人生畏,但一旦你理解了基础知识,它们实 …

  8. DECORATOR中文 (简体)翻译:剑桥词典 - Cambridge Dictionary

    She started a business as an interior decorator. 她开了一家自己的室内设计公司。

  9. 深入理解Python中的装饰器(Decorators):从基础到高级应用

    def decorator (func): def wrapper (*args, **kwargs): # 在这里添加额外的功能 print ("Before calling the function")

  10. Primer on Python Decorators

    Dec 14, 2024 · You use the same decorator, @do_twice, to decorate two different functions. This hints at one of the powers of decorators. They add behavior that can apply to many different …