zoukankan      html  css  js  c++  java
  • [reviewcode] 那些基础comments

    多次提醒我,为变量取个合适的名字, so cute person:
    Not a big deal, but try using variable names better than my_sa

    每个参数一行好么 菇凉?

     def test_share_path_and_user_unicode(self):
                self.assertEquals(user[1].decode('utf-8'), s_perms[ix]['trustee'][u'name'],
                                    'user {0} not found in {1} positon of acl'.format(user[1], ix))
    can you put each argument on its own line for readability and line up the continuation lines after the opening parenthesis?
    

    这样写for ok?

    fileslist = {file_.encode('utf-8') + fn_suffix for file_ in filenames}
    

    不要在代码里用 hard-coded 好么? 用 constant

    user_name = self.testOptions.s_test_users[13][1].decode('utf-8')
    

    判断 是否为 unicode

    isinstance(s, unicode)
    

    判断是否为ascii, 返回true 为english, 返回false 为其他字符

    ss = all(ord(c)<128 for c in s)
    

    取列表后2位,赋值给2个变量
    s_test_users[13][0] zoon
    s_test_users[13][1] username
    s_test_users[13][2] password

    user_name, password = self.testOptions.s_test_users[13][1:]
    

    一些缩写

    LGTM looks good to me 朕知道了 代码已经过 review,可以合并
    w.s. whitespace 我多了个无意义的空白行,我只是想让2个函数分开些,毕竟今天七夕,不想你们挨太近~
    JFYR just for your reference

  • 相关阅读:
    mysql lock
    yii2引入js和css
    Yii 2.x 和1.x区别以及yii2.0安装
    Curl https 访问
    boost::any 用法
    boost单元测试框架
    shared_ptr的线程安全
    nginx php fastcgi安装
    ip相关
    Design Pattern Explained 读书笔记二——设计模式序言
  • 原文地址:https://www.cnblogs.com/vivivi/p/11313987.html
Copyright © 2011-2022 走看看