Private
Public Access
feat(directives): harvest 7 directives from python.md §17.1-17.7 (banned patterns + boundary exception)
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
# ban_getattr_dispatch — v1
|
||||
|
||||
**Why this iteration:** Lifted verbatim from `conductor/code_styleguides/python.md` §17.5 (lines 328-338).
|
||||
This is the baseline encoding — the imperative-ban style currently in production.
|
||||
Future variants will test alternative encodings (rationale-first, before/after, tabular) against this baseline.
|
||||
|
||||
**Source:** `conductor/code_styleguides/python.md:328-338`
|
||||
|
||||
---
|
||||
|
||||
### 17.5 Banned: `getattr(x, 'field', default)` for type dispatch
|
||||
|
||||
```python
|
||||
# BANNED:
|
||||
tool_id = getattr(tc, "id", "") or ""
|
||||
tool_name = getattr(tc.function, "name", "") or ""
|
||||
|
||||
# CORRECT:
|
||||
tool_id = tc.id
|
||||
tool_name = tc.function.name
|
||||
```
|
||||
Reference in New Issue
Block a user