What's the advantage of a trailing underscore in Python naming?

后端 未结 3 1251
渐次进展
渐次进展 2021-01-17 21:06

I am used to naming Python arguments in this way:

my_argument=\'foo\'

what\'s the advantage if I do this instead:

my_argum         


        
3条回答
  •  臣服心动
    2021-01-17 21:18

    Exactly what it gives in the PEP: it allows you to use something that would otherwise be a Python keyword.

    as_
    with_
    for_
    in_
    

提交回复
热议问题