This product is not supported for your selected
Datadog site. (
).
メタデータ
ID: python-best-practices/avoid-string-concat
言語: Python
重大度: 警告
カテゴリー: パフォーマンス
説明
複数の文字列の連結は効率的ではなく、コードが読みにくく理解しにくくなります。
複数の文字列を連結する代わりに、f-文字列またはフォーマット文字列を使用します。
詳細はこちら
非準拠コードの例
"my" + awesome + "string"
plop = "super" + "awesome" + "text"
準拠コードの例
"my {0} string".format(awesome)
f"my {awesome} string"
plop = "superawesometext"
function(
tags = (
user_tags
+ s.get("tags", [])
+ [
f"schedule_id:{s['_id']}",
f"schedule_name:{s['schedule_name']}",
f"git_ref:{schedule_git_ref}",
]
)
)