Skip to content

Commit 348f699

Browse files
authored
Update README.md
1 parent c09fea7 commit 348f699

1 file changed

Lines changed: 15 additions & 22 deletions

File tree

‎README.md‎

Lines changed: 15 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -118,33 +118,26 @@ Don’t force the reader of your code to translate what the variable means.
118118
Explicit is better than implicit.
119119

120120
**Bad:**
121-
```php
122-
$l = ['Austin', 'New York', 'San Francisco'];
121+
```python
122+
seq = ('Austin', 'New York', 'San Francisco')
123123

124-
for ($i = 0; $i < count($l); $i++) {
125-
$li = $l[$i];
126-
doStuff();
127-
doSomeOtherStuff();
128-
// ...
129-
// ...
130-
// ...
131-
// Wait, what is `$li` for again?
132-
dispatch($li);
133-
}
124+
for item in seq:
125+
do_stuff()
126+
do_some_other_stuff()
127+
# ...
128+
# Wait, what's `item` for again?
129+
dispatch(item)
134130
```
135131

136132
**Good**:
137-
```php
138-
$locations = ['Austin', 'New York', 'San Francisco'];
133+
```python
134+
locations = ('Austin', 'New York', 'San Francisco')
139135

140-
foreach ($locations as $location) {
141-
doStuff();
142-
doSomeOtherStuff();
143-
// ...
144-
// ...
145-
// ...
146-
dispatch($location);
147-
});
136+
for location in locations:
137+
do_stuff()
138+
do_some_other_stuff()
139+
# ...
140+
dispatch(location)
148141
```
149142
**[⬆ back to top](#table-of-contents)**
150143

0 commit comments

Comments
 (0)