Return either the values or viewvalues method for a dictionary. Args: d (:obj:`dict`): A dictionary. Returns: view method: Either the values or viewvalues method.
(d)
| 42 | |
| 43 | |
| 44 | def viewvalues(d): |
| 45 | """Return either the values or viewvalues method for a dictionary. |
| 46 | |
| 47 | Args: |
| 48 | |
| 49 | d (:obj:`dict`): A dictionary. |
| 50 | |
| 51 | Returns: |
| 52 | |
| 53 | view method: Either the values or viewvalues method. |
| 54 | |
| 55 | """ |
| 56 | func = getattr(d, "viewvalues", None) |
| 57 | if func is None: |
| 58 | func = d.values |
| 59 | return func() |
| 60 | |
| 61 | |
| 62 | def isstr(s): |