|
46 | 46 | "If an inner function needs it, pass the value in as an argument instead of relying on the enclosing scope." |
47 | 47 | ], |
48 | 48 | "_placeholders": { |
49 | | - "name": "The enclosing-scope variable name, e.g. total", |
50 | | - "loc": "Where it was used, e.g. line 3 in main.py" |
| 49 | + "name": "The enclosing-scope variable name, eg. total", |
| 50 | + "loc": "Where it was used, eg. line 3 in main.py" |
51 | 51 | } |
52 | 52 | }, |
53 | 53 | { |
|
63 | 63 | "Check spelling and capital letters." |
64 | 64 | ], |
65 | 65 | "_placeholders": { |
66 | | - "name": "The undefined variable name, e.g. kittens", |
67 | | - "loc": "Where it was used, e.g. line 2 in main.py" |
| 66 | + "name": "The undefined variable name, eg. kittens", |
| 67 | + "loc": "Where it was used, eg. line 2 in main.py" |
68 | 68 | } |
69 | 69 | } |
70 | 70 | ] |
|
80 | 80 | "Give it a value first (add a line like {{name}} = ... before you use it)." |
81 | 81 | ], |
82 | 82 | "_placeholders": { |
83 | | - "name": "The variable used before assignment, e.g. score", |
84 | | - "loc": "Where it was read before being set, e.g. line 4 in main.py" |
| 83 | + "name": "The variable used before assignment, eg. score", |
| 84 | + "loc": "Where it was read before being set, eg. line 4 in main.py" |
85 | 85 | } |
86 | 86 | } |
87 | 87 | ] |
|
101 | 101 | "Add a colon (:) at the end of that line." |
102 | 102 | ], |
103 | 103 | "_placeholders": { |
104 | | - "loc": "Where the missing colon is, e.g. line 3 in main.py", |
105 | | - "codeLine": "The line that needs the colon, e.g. for i in range(10)" |
| 104 | + "loc": "Where the missing colon is, eg. line 3 in main.py", |
| 105 | + "codeLine": "The line that needs the colon, eg. for i in range(10)" |
106 | 106 | } |
107 | 107 | }, |
108 | 108 | { |
|
116 | 116 | "Replace the comma with a colon (:)." |
117 | 117 | ], |
118 | 118 | "_placeholders": { |
119 | | - "loc": "Where the comma is, e.g. line 1 in main.py", |
120 | | - "codeLine": "The line ending with a comma, e.g. if score > 10," |
| 119 | + "loc": "Where the comma is, eg. line 1 in main.py", |
| 120 | + "codeLine": "The line ending with a comma, eg. if score > 10," |
121 | 121 | } |
122 | 122 | }, |
123 | 123 | { |
|
131 | 131 | "Leave only one colon (:) at the end of the line." |
132 | 132 | ], |
133 | 133 | "_placeholders": { |
134 | | - "loc": "Where the extra colon is, e.g. line 2 in main.py", |
135 | | - "codeLine": "The line with double colons, e.g. if x > 0::" |
| 134 | + "loc": "Where the extra colon is, eg. line 2 in main.py", |
| 135 | + "codeLine": "The line with double colons, eg. if x > 0::" |
136 | 136 | } |
137 | 137 | }, |
138 | 138 | { |
|
200 | 200 | "Keep = for setting a variable value outside comparisons." |
201 | 201 | ], |
202 | 202 | "_placeholders": { |
203 | | - "loc": "Where the = is used in a condition, e.g. line 6 in main.py", |
204 | | - "codeLine": "The condition line, e.g. if score = 10:" |
| 203 | + "loc": "Where the = is used in a condition, eg. line 6 in main.py", |
| 204 | + "codeLine": "The condition line, eg. if score = 10:" |
205 | 205 | } |
206 | 206 | }, |
207 | 207 | { |
|
240 | 240 | "Line up all lines in the block." |
241 | 241 | ], |
242 | 242 | "_placeholders": { |
243 | | - "loc": "Where the indentation problem is, e.g. line 7 in main.py" |
| 243 | + "loc": "Where the indentation problem is, eg. line 7 in main.py" |
244 | 244 | } |
245 | 245 | } |
246 | 246 | ] |
|
276 | 276 | ] |
277 | 277 | }, |
278 | 278 | { |
279 | | - "title": "This thing doesn't have that name after the dot", |
280 | | - "summary": "The thing you're using doesn't have that attribute or method.", |
281 | | - "why": "That kind of thing doesn't provide this feature.", |
| 279 | + "title": "That name after the dot isn't available for this value", |
| 280 | + "summary": "At {{loc}}, {{codeLine}} uses a name after the dot that this kind of value doesn't have. It might be a typo, or a method that belongs to a different type of value.", |
| 281 | + "why": "After a dot, Python looks for a method or property that belongs to that exact kind of value - a string, a list, a number, and so on. If that kind of value has nothing by that name, you get this error.", |
282 | 282 | "steps": [ |
283 | | - "Check the spelling after the dot.", |
284 | | - "Use a name that exists for this kind of thing." |
285 | | - ] |
| 283 | + "Check the spelling and capital letters of the name after the dot.", |
| 284 | + "Make sure the value is the kind you expect - for example a list has .append(), but a string does not.", |
| 285 | + "Look up which methods that kind of value supports, and use one of those." |
| 286 | + ], |
| 287 | + "_placeholders": { |
| 288 | + "loc": "Where the attribute was used, eg. line 2 in main.py", |
| 289 | + "codeLine": "The line with the dotted access, eg. name.shrink()" |
| 290 | + } |
286 | 291 | } |
287 | 292 | ] |
288 | 293 | }, |
|
0 commit comments