... | ... | @@ -294,7 +294,6 @@ Modern C++11 and newer provide the `std::transform` method. Combined with |
|
|
> using std::string;
|
|
|
> using std::vector;
|
|
|
>
|
|
|
>
|
|
|
> int main(int argc, char** argv)
|
|
|
> {
|
|
|
> vector<string> some_terms {"Hello", "world", "with", "for", "while", "int"};
|
... | ... | @@ -343,7 +342,7 @@ data structure. |
|
|
|
|
|
Python provides the `with` statement (construct). This allows the setup and
|
|
|
teardown involved in using resources (e.g., files, sockets, and database
|
|
|
connections) to handled elsewhere.
|
|
|
connections) to be handled elsewhere.
|
|
|
|
|
|
This has two main benefits:
|
|
|
|
... | ... | @@ -404,7 +403,7 @@ operations*. [Python includes batteries](https://www.python.org/dev/peps/pep-020 |
|
|
| Advanced command line arguments | `import argparse` |
|
|
|
|
|
|
|
|
|
# Libraries & pip
|
|
|
## Third-Party Libraries & pip
|
|
|
|
|
|
When external libraries are required, the Python `pip` utility and a
|
|
|
`requirements.txt` can be used for all dependency and configuration management.
|
... | ... | @@ -444,7 +443,7 @@ The last line (i.e., `Point = Tuple[float, float]` is a type alias. |
|
|
|
|
|
*I am a stickler for type hints and function/method documentation. Anytime
|
|
|
code is written... **it must be documented** at the API level. While Python
|
|
|
type hints do no necessarily gain us a performance benefit, type hints
|
|
|
type hints do not necessarily gain us a performance benefit, type hints
|
|
|
increase readability. Type hints are an important part of documentation.*
|
|
|
|
|
|
|
... | ... | |