-
Notifications
You must be signed in to change notification settings - Fork 905
Commit 217afe2
committed
simplify: use direct node.children check instead of has_children() method
Even simpler approach:
- Replace node.has_children() with direct if node.children:
- Remove unnecessary has_children() methods from all classes
- Pythonic and direct - empty lists are falsy, non-empty are truthy
- Less code, same functionality
This is the most straightforward way to check for children in Python.1 parent 5efe631 commit 217afe2
2 files changed
+3
-7
lines changedLines changed: 1 addition & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
156 | 156 |
| |
157 | 157 |
| |
158 | 158 |
| |
159 | - | ||
159 | + | ||
160 | 160 |
| |
161 | 161 |
| |
162 | 162 |
| |
|
Lines changed: 2 additions & 6 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
112 | 112 |
| |
113 | 113 |
| |
114 | 114 |
| |
115 | - | ||
116 | - | ||
117 | - | ||
115 | + | ||
118 | 116 |
| |
119 | 117 |
| |
120 | 118 |
| |
| |||
167 | 165 |
| |
168 | 166 |
| |
169 | 167 |
| |
170 | - | ||
171 | - | ||
172 | - | ||
168 | + | ||
173 | 169 |
| |
174 | 170 |
| |
175 | 171 |
| |
|
0 commit comments