Ignore:
Timestamp:
Dec 26, 2018, 8:00:40 PM (6 months ago)
Author:
Stefan Schwarzer <sschwarzer@…>
Branch:
default
Message:
Remove positional argument specifiers for `format`

In strings for `format` calls, remove the digits for positional
arguments. For example, "{0}, {1}" becomes "{}, {}".
File:
1 edited

Legend:

Unmodified
Added
Removed
  • sandbox/compat_python2_vs_3.py

    r1198 r1723  
    2020    def test_call(self, *args, **kwargs):
    2121        should_print_result = kwargs.pop("print_result", False)
    22         print("Callable: {0}; Args: {1}; Kwargs: {2}".format(self.callable,
    23                                                              args, kwargs))
     22        print("Callable: {}; Args: {}; Kwargs: {}".format(self.callable,
     23                                                          args, kwargs))
    2424        try:
    2525            result = self.callable(*args, **kwargs)
    2626        except Exception as exc:
    27             print("Exception in `test_call`: {0}".format(exc))
     27            print("Exception in `test_call`: {}".format(exc))
    2828        else:
    29             print("Result type: {0}".format(type(result)))
     29            print("Result type: {}".format(type(result)))
    3030            if should_print_result:
    31                 print("Result: {0!r}".format(result))
     31                print("Result: {!r}".format(result))
    3232        print()
    3333        return result
Note: See TracChangeset for help on using the changeset viewer.