On Wed, Oct 23, 2019 at 10:59 AM Steven D'Aprano <st...@pearwood.info> wrote:
> On Wed, Oct 23, 2019 at 10:09:41AM -0400, David Mertz wrote: > > > One big problem with the current obvious way would be shared by the > > proposal. This hits me fairly often. > > > > colors1 = "red green blue".split() # happy > > > > Later > > > > colors2 = "cyan forest green burnt umber".split() > > # oops, not what I wanted, quote each separately > > It isn't shared by the proposal. > > colors2 = %w[cyan forest green burnt\x20umber] > > > Escaping the space ``\ `` might be nicer, but escaping an invisible > character is problematic (see the problems with the explict line > continuation character ``\``) and we may not be able to add any new > escape characters to the language. However a hex escape will do the > trick. > Compare that to: colors2 = "cyan,forest green,burnt umber".split(',') or, if you follow pep8-style commas: colors2 = "cyan, forest green, burnt umber".split(', ') This is one of the many cases where being able to specify the delimiter helps.
_______________________________________________ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@python.org https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://mail.python.org/archives/list/python-ideas@python.org/message/DF5N3ER7GL224SAAS74G2ASERPDYG3MO/ Code of Conduct: http://python.org/psf/codeofconduct/