/
ilya.petrash
/
SimplePyScripts
Обзор
Документация
Войти
/
ilya.petrash
/
SimplePyScripts
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
str__plus_vs_percent_vs_format_vs_fstring.py
30 строк
632 B
gil9red
Refactoring. Using black code style
18 июн 2023, 16:36
18 июн 2023, 16:36
8be02f3
Код
Авторство
О чём код?
#!/usr/bin/env python3 # -*- coding: utf-8 -*- __author__ = "ipetrash" from timeit import timeit foo = "FooBar" test_globals = dict(foo=foo) t = timeit('name = "Thread #" + foo', globals=test_globals) print(f"Total time: {t:.3f} sec") t = timeit('name = "Thread #%s" % foo', globals=test_globals) print(f"Total time: {t:.3f} sec") t = timeit('name = "Thread #{}".format(foo)', globals=test_globals) print(f"Total time: {t:.3f} sec") t = timeit('name = f"Thread {foo}"', globals=test_globals) print(f"Total time: {t:.3f} sec") """ Total time: 0.077 sec Total time: 0.179 sec Total time: 0.244 sec Total time: 0.081 sec """