python的元注释

python 的元注释还是很方便的:

@cf.cache_func(name=lambda * args, **kwargs:"blog:top:comments:%s" % args[0].id,
                   expired=60 * 5)
    def get_top_comments(self, n=3):
        from comment.models import Comment
        return Comment.objects.filter(object_id=self.id, category=0).order_by('-add_datetime')[:n]

猜你喜欢

转载自san-yun.iteye.com/blog/1591728