Google C++ Style Guide
g. with a cast. This applies not only to implicit conversions, but to C++11’s list initialization syntax: class Foo { explicit Foo(int x, double y); ... }; void Func(Foo f); Func({42, 3.14}); // Error obvious. • Implicit conversions can be a simpler alternative to overloading. • List initialization syntax is a concise and expressive way of initializing objects. • Implicit conversions can hide type-mismatch operations. • Finding the call sites for overloaded operators may requre a search tool that’s aware of C++ syntax, rather than e.g. grep. • If you get the argument type of an overloaded operator wrong, you may get0 码力 | 83 页 | 238.71 KB | 1 年前3Google Python Style Guide
Okay for one-liners. Definition: Conditional expressions are mechanisms that provide a shorter syntax for if statements. For example: x = 1 if cond else 2. Pros: Shorter and more convenient than an Features link Use string methods instead of the string module where possible. Use function call syntax instead of apply. Use list comprehensions and for loops instead of filter and map when the function @staticmethod, for con- verting ordinary methods to class or static methods. However, the decorator syntax allows for user-defined decorators as well. Specifically, for some function my_decorator, this:0 码力 | 30 页 | 94.81 KB | 1 年前3Google's R Style Guide
classed object, the function name (constructor) and class should match (e.g., lm). • kConstantName Syntax Line Length The maximum line length is 80 characters. Indentation When indenting your code, use0 码力 | 8 页 | 47.42 KB | 1 年前3
共 3 条
- 1