Google Python Style Guideargument on the first line. Yes: # Aligned with opening delimiter foo = long_function_name(var_one, var_two, var_three, var_four) 17 # Aligned with opening delimiter in a dictionary foo = { long_dictionary_key: value2, ... } # 4-space hanging indent; nothing on first line foo = long_function_name( var_one, var_two, var_three, var_four) # 4-space hanging indent in a dictionary foo = { long_dictionary_key: long_dictionary_value forbidden foo = long_function_name(var_one, var_two, var_three, var_four) # 2-space hanging indent forbidden foo = long_function_name( var_one, var_two, var_three, var_four) # No hanging indent in a dictionary0 码力 | 30 页 | 94.81 KB | 1 年前3
Google C++ Style Guideif any values are not handled). If the default case should never execute, simply assert: switch (var) { case 0: { // 2 space indent ... // 4 space indent break; } case 1: { ... break; } default: { assert(false); readable. return (some_long_condition && another_condition); return (value); // You wouldn't write var = (value); return(result); // return is not a function! Variable and Array Initialization Your choice explicit MyClass(int var); ~MyClass() {} void SomeFunction(); 76 void SomeFunctionThatDoesNothing() { } void set_some_var(int var) { some_var_ = var; } int some_var() const { return some_var_; } private:0 码力 | 83 页 | 238.71 KB | 1 年前3
Google's R Style Guide|| TRUE %in% is.na(y)) { stop(" Arguments x and y must not have missing values.") } covariance <- var(x, y) if (verbose) cat("Covariance = ", round(covariance, 4), ".\n", sep = "") return(covariance) }0 码力 | 8 页 | 47.42 KB | 1 年前3
共 3 条
- 1













