New submission from Mark Dickinson <dicki...@gmail.com>: The docstring of str.splitlines says:
splitlines(...) S.splitlines([keepends]) -> list of strings Return a list of the lines in S, breaking at line boundaries. Line breaks are not included in the resulting list unless keepends is given and true. Currently the optional argument can only be specified positionally. What do people think about also allowing this argument to be specified by keyword? (And applying the same change to bytes.splitlines.) The main motivation here is readability: in long_string.splitlines(keepends=True) it's fairly clear what the boolean argument is doing. But in long_string.splitlines(True) it's much less clear. (This came up during a Python training class that I was running recently.) I'm not advocating making the argument keyword-only; just allowing those who want to specify it by keyword to do so. There are many other str methods that don't accept keyword arguments, but it's only this one where I think readability would really benefit. ---------- components: Interpreter Core messages: 144326 nosy: mark.dickinson priority: normal severity: normal stage: needs patch status: open title: Allow keyword argument in str.splitlines() type: feature request versions: Python 3.3 _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue13012> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com