2016-12-19 8 views
1

Pythonのdeconstructibleデコレータは何をしますか?私はこのデコレータに他の人のコードを見て遭遇しましたが、私はPythonのドキュメントを検索しましたが、このデコレータが実際に何をしているのか見当たりませんでしたか?Pythonでdeconstructible doとは何ですか?

@deconstructible 
class UserValidator(object): 
    def __call__(self, value): 
     if value: 
      etc 

上記のコードが与えられた場合、このクラスに 'deconstructible'を追加するとどうなりますか?私はそれがジャンゴの一部であることを見つけることができたグーグルを使用することにより

+1

解体()メソッドを追加するdjango.utils.deconstructからdeconstructibleクラスデコレータ。その場合、nooneが伝えることができます – Lex

+1

djangoは使用されていますか? https://docs.djangoproject.com/en/1.10/topics/migrations/ –

+1

[こちら](https://docs.djangoproject.com/ja/1.10/topics/migrations/) –

答えて

1
def deconstructible(*args, **kwargs): 
    """ 
    Class decorator that allow the decorated class to be serialized 
    by the migrations subsystem. 

    Accepts an optional kwarg `path` to specify the import path. 
    """ 
関連する問題