zoukankan      html  css  js  c++  java
  • Python 装饰器

    #一、装饰器的作用就是给已经实现的功能再扩展新的功能
    #二、无参数的
     1 # def wohaoshuai1(func):
     2 #     print("wohaoshuai1")
     3 #     return func
     4 #
     5 # @wohaoshuai1
     6 # def wohaoshuai2():
     7 #     print("wohaoshuai2")
     8 #
     9 # # 与上面装饰内容原理相同
    10 # # wohaoshuai2 = wohaoshuai1(wohaoshuai2)
    11 # wohaoshuai2()
    #三、有参数
     1 # def wohaoshuai1(function):
     2 #     def inner(*args,**kwargs):
     3 #         print("wohaoshuai1")
     4 #         return function(*args,**kwargs)
     5 #     print(inner)
     6 #     return inner
     7 #
     8 # @wohaoshuai1
     9 # def wohaoshuai2(name,wohaoshuai,c):
    10 #     print("wohaoshuai2 {0} {1} {2}".format(name,wohaoshuai,c))
    11 #     return 1
    12 #
    13 # print(wohaoshuai2)
    14 # a = wohaoshuai2("aaa","bbb",c=1)
    15 # print(a)
    16 #
    17 # <function wohaoshuai1.<locals>.inner at 0x05536108>
    18 # <function wohaoshuai1.<locals>.inner at 0x05536108>
    19 # wohaoshuai1
    20 # wohaoshuai2 aaa bbb 1
    21 # 1
  • 相关阅读:
    Linux三剑客之sed
    xcodebuild
    mac xcworkspace xcodebuild
    [转]Jenkins Xcode打包ipa
    ios批量打包
    ios打包
    ios 打包
    ios 尺寸
    Launch Screen在iOS7/8中的实现
    如何查看ipa包支持哪些cpu指令集
  • 原文地址:https://www.cnblogs.com/Presley-lpc/p/9218190.html
Copyright © 2011-2022 走看看