Intermediate Python 18. Decorators 영어 파이썬 코딩영어 смотреть онлайн
웹 문서를 제작할때면, 몇 마디 수사를 해줄 필요가 있을 때 이 decorator function을 쓰게 되면 효율적입니다.
LC training(1:55) - Now since you guys are sending it to me for Christmas maybe you want to wrap the gpu So you might have a new function and we'll say define add wrapping When you wrap something you're wrapping right you're wrapping something So you're gonna pass whatever the item is that you want to wrap into this wrapping function And now we're going to say we're gonna define wrapped underscore item and what this is gonna do is return a wrapped up box of something and then will do dot format string version of whatever the item is So we return that and then now at the that for the actual add wrapping function we're gonna return wrapped item So now what we can do is at new gpu we can wrap it So we can say boom add wrapping and that will decorate our wrapping paper to our new Tesla P100 gpu So we can now run literally new gpu nothing changes We've just added that wrapping with the decorator
Code results -
'''
@app.route('/contact/')
def contact():
return render_template("contact.html")
'''
from functools import wraps #OOP programming application
def add_wrapping_with_style(style):
def add_wrapping(item):
@wraps(item) #won't allow item to get the control newly
def wrapped_item():
return 'a {} wrapped up box of {}'.format(style,str(item()))
return wrapped_item
return add_wrapping
@add_wrapping_with_style('horribly')
@add_wrapping_with_style('beautifully')
def new_gpu():
return 'a new Tesla P100 GPU'
print(new_gpu())
print(new_gpu.__name__) #shows the original function name still on control
'''
from functools import wraps #OOP programming application
def add_wrapping(item):
@wraps(item) #won't allow item to get the control newly
def wrapped_item():
return 'a wrapped up box of {}'.format(str(item()))
return wrapped_item
@add_wrapping
def new_bicycle():
return 'a new bicycle'
print(new_bicycle())
print(new_bicycle.__name__) #shows the original function name still on control
'''
원본 비디오: https://www.youtube.com/watch?v=rPCeCPT-f28&list=PLQVvvaa0QuDfju7ADVp5W1GF9jVhjbX-_&index=19
Что делает видео по-настоящему запоминающимся? Наверное, та самая атмосфера, которая заставляет забыть о времени. Когда вы заходите на RUVIDEO, чтобы посмотреть онлайн «Intermediate Python 18. Decorators 영어 파이썬 코딩영어» бесплатно и без регистрации, вы рассчитываете на нечто большее, чем просто загрузку плеера. И мы это понимаем. Контент такого уровня заслуживает того, чтобы его смотрели в HD 1080, без дрожания картинки и бесконечного буферизации.
Честно говоря, Rutube сегодня — это кладезь уникальных находок, которые часто теряются в общем шуме. Мы же вытаскиваем на поверхность самое интересное. Будь то динамичный экшн, глубокий разбор темы от любимого автора или просто уютное видео для настроения — всё это доступно здесь бесплатно и без лишних формальностей. Никаких «заполните анкету, чтобы продолжить». Только вы, ваш экран и качественный поток.
Если вас зацепило это видео, не забудьте взглянуть на похожие материалы в блоке справа. Мы откалибровали наши алгоритмы так, чтобы они подбирали контент не просто «по тегам», а по настроению и смыслу. Ведь в конечном итоге, онлайн-кинотеатр — это не склад файлов, а место, где каждый вечер можно найти свою историю. Приятного вам отдыха на RUVIDEO!
Видео взято из открытых источников Rutube. Если вы правообладатель, обратитесь к первоисточнику.