Skip to content

Commit d2ab44a

Browse files
committed
some additions to convention
1 parent 4960104 commit d2ab44a

File tree

3 files changed

+3
-2
lines changed

3 files changed

+3
-2
lines changed

docs/python/exceptions.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,6 @@ sidebar_label: Exception Handling
1313
- Write your custom error only when your error is not described or fulfilled by [internal exceptions](https://docs.python.org/3/library/exceptions.html).
1414
- Create custom `Exception` class primarily suffixing it with `Error` such as `MyCustomError(Exception)` and use it.
1515
- Always use `Exception` as your parent class for user defined exceptions. Donot use `BaseException`.
16-
* Add traceback to you mitigation. i.e. either `logging` or mails. Donot `pass`.
16+
* Add traceback to your mitigation. i.e. either `logging` or mails. Donot `pass`.
1717
* The `try` block should be specific to desired exception. Donot use huge code chunk in `try`. Use `else` if needed.
1818

docs/python/general.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ sidebar_label: General Coding Guidelines
3737
- i.e. `with` statement when supported.
3838
- Always remember to close on exit. i.e. if you open the file `close` on `finally` or better use `with` or `contextlib.closing`.
3939
* While `python` is an OOP, you can always choose `functions` and `modules` over `class` if there is only one `object` to be created.
40+
* Use `property` setter when writing OOP and you need readonly attributes.
4041
* Use `pdb` as debugger whenever required.
4142
* Multi-threading can be especially used when we have io bound and network bound multiple operation. Multiprocessing can be used to use multiple cores.
4243
- Recommended module is `concurrent.futures` in most cases. If lower level API is needed there is always `threading` and `multiprocessing` module.

docs/python/logging.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ sidebar_label: Logging Convention
1414
- **ERROR**: errors in programs.
1515
- **CRITICAL**: blocking issues or immediate attention issues.
1616
* **ERROR and CRITICAL** levels should be mitigated and informed.
17-
* `logger` is used for naming single logger. Use `NAME_logger` name for more than one logger when required.
17+
* `logger` is used for naming single logger object. Use `NAME_logger` name for more than one logger when required.
1818
* It is singleton and single threaded by default for given name of the logger. Can be [non-blocking](https://docs.python.org/3/howto/logging-cookbook.html#dealing-with-handlers-that-block) if required.
1919
* [Logging Cookbook](https://docs.python.org/3/howto/logging-cookbook.html) for reference.
2020
* Always use `exception` method rather than `error` method of `logger` object to log traceback when catching exceptions.

0 commit comments

Comments
 (0)