Skip to content

Commit d18e282

Browse files
committed
Fix code formatting in collections.rst
1 parent 4473bb3 commit d18e282

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

collections.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ major one is that unlike lists, **you can not change a value in a
205205
tuple**. In order to access the value in a tuple you use integer indexes
206206
like:
207207

208-
::
208+
.. code:: python
209209
210210
man = ('Ali', 30)
211211
print(man[0])
@@ -217,7 +217,7 @@ integer indexes for accessing members of a tuple. You can think of
217217
namedtuples like dictionaries but unlike dictionaries they are
218218
immutable.
219219

220-
::
220+
.. code:: python
221221
222222
from collections import namedtuple
223223
@@ -244,7 +244,7 @@ memory than regular tuples. This makes them faster than dictionaries.
244244
However, do remember that as with tuples, **attributes in namedtuples
245245
are immutable**. It means that this would not work:
246246

247-
::
247+
.. code:: python
248248
249249
from collections import namedtuple
250250
@@ -260,7 +260,7 @@ You should use named tuples to make your code self-documenting. **They
260260
are backwards compatible with normal tuples**. It means that you can use
261261
integer indexes with namedtuples as well:
262262

263-
::
263+
.. code:: python
264264
265265
from collections import namedtuple
266266
@@ -272,7 +272,7 @@ integer indexes with namedtuples as well:
272272
Last but not the least, you can convert a namedtuple to a dictionary.
273273
Like this:
274274

275-
::
275+
.. code:: python
276276
277277
from collections import namedtuple
278278

0 commit comments

Comments
 (0)