diff options
-rw-r--r-- | Doc/tutorial/classes.rst | 4 | ||||
-rw-r--r-- | Doc/tutorial/datastructures.rst | 20 |
2 files changed, 12 insertions, 12 deletions
diff --git a/Doc/tutorial/classes.rst b/Doc/tutorial/classes.rst index 9f115b0f8f..95a3a832d6 100644 --- a/Doc/tutorial/classes.rst +++ b/Doc/tutorial/classes.rst @@ -534,8 +534,8 @@ http://www.python.org/download/releases/2.3/mro/. .. _tut-private: -Private Variables -================= +Private Variables and Class-local References +============================================ "Private" instance variables that cannot be accessed except from inside an object don't exist in Python. However, there is a convention that is followed diff --git a/Doc/tutorial/datastructures.rst b/Doc/tutorial/datastructures.rst index 489a336a83..0240e616b7 100644 --- a/Doc/tutorial/datastructures.rst +++ b/Doc/tutorial/datastructures.rst @@ -577,16 +577,6 @@ keyword arguments:: Looping Techniques ================== -When looping through dictionaries, the key and corresponding value can be -retrieved at the same time using the :meth:`iteritems` method. :: - - >>> knights = {'gallahad': 'the pure', 'robin': 'the brave'} - >>> for k, v in knights.iteritems(): - ... print k, v - ... - gallahad the pure - robin the brave - When looping through a sequence, the position index and corresponding value can be retrieved at the same time using the :func:`enumerate` function. :: @@ -633,6 +623,16 @@ returns a new sorted list while leaving the source unaltered. :: orange pear +When looping through dictionaries, the key and corresponding value can be +retrieved at the same time using the :meth:`iteritems` method. :: + + >>> knights = {'gallahad': 'the pure', 'robin': 'the brave'} + >>> for k, v in knights.iteritems(): + ... print k, v + ... + gallahad the pure + robin the brave + .. _tut-conditions: |