id,node_id,number,title,user,state,locked,assignee,milestone,comments,created_at,updated_at,closed_at,author_association,active_lock_reason,draft,pull_request,body,reactions,performed_via_github_app,state_reason,repo,type 683954433,MDU6SXNzdWU2ODM5NTQ0MzM=,4367,Should __repr__ and __str__ be PEP8 compliant?,14371165,closed,0,,,7,2020-08-22T08:10:15Z,2020-11-25T23:25:44Z,2020-11-25T23:25:44Z,MEMBER,,,," **Is your feature request related to a problem? Please describe.** When creating docs with examples it would be nice if you could simply use `print(ds)` without being concerned about line lengths. **Describe the solution you'd like** Limit line length so that a method docstring in a class can use `print(ds)` without breaking PEP8 conventions. So maximum line length for the `ds.__repr__`/`ds.__str__` would be 79 - 4 - 4 = 71. **Example code** Example where print(ds) creates lines longer than 79: ```python import numpy as np import pandas as pd import xarray as xr class foo(): """""" Test class. (...) """""" def bar(): """""" Return 1. Examples -------- Create data: >>> np.random.seed(0) >>> temperature = 15 + 8 * np.random.randn(2, 2, 3) >>> precipitation = 10 * np.random.rand(2, 2, 3) >>> lon = [[-99.83, -99.32], [-99.79, -99.23]] >>> lat = [[42.25, 42.21], [42.63, 42.59]] >>> time = pd.date_range(""2014-09-06"", periods=3) >>> reference_time = pd.Timestamp(""2014-09-05"") Initialize a dataset with multiple dimensions: >>> ds = xr.Dataset( ... { ... ""temperature"": ([""x"", ""y"", ""time""], temperature), ... ""precipitation"": ([""x"", ""y"", ""time""], precipitation), ... }, ... coords={ ... ""lon"": ([""x"", ""y""], lon), ... ""lat"": ([""x"", ""y""], lat), ... ""time"": time, ... ""reference_time"": reference_time, ... }, ... ) Print results: >>> print(ds.temperature.values[0]) [[29.11241877 18.20125767 22.82990387] [32.92714559 29.94046392 7.18177696]] >>> print(ds) Dimensions: (time: 3, x: 2, y: 2) Coordinates: lon (x, y) float64 -99.83 -99.32 -99.79 -99.23 lat (x, y) float64 42.25 42.21 42.63 42.59 * time (time) datetime64[ns] 2014-09-06 2014-09-07 2014-09-08 reference_time datetime64[ns] 2014-09-05 Dimensions without coordinates: x, y Data variables: temperature (x, y, time) float64 29.11 18.2 22.83 ... 18.28 16.15 26.63 precipitation (x, y, time) float64 5.68 9.256 0.7104 ... 7.992 4.615 7.805 >>> ds Dimensions: (time: 3, x: 2, y: 2) Coordinates: lon (x, y) float64 -99.83 -99.32 -99.79 -99.23 lat (x, y) float64 42.25 42.21 42.63 42.59 * time (time) datetime64[ns] 2014-09-06 2014-09-07 2014-09-08 reference_time datetime64[ns] 2014-09-05 Dimensions without coordinates: x, y Data variables: temperature (x, y, time) float64 29.11 18.2 22.83 ... 18.28 16.15 26.63 precipitation (x, y, time) float64 5.68 9.256 0.7104 ... 7.992 4.615 7.805 """""" return 1 if __name__ == '__main__': import doctest doctest.testmod() ```","{""url"": ""https://api.github.com/repos/pydata/xarray/issues/4367/reactions"", ""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,completed,13221727,issue