On Wed, Oct 23, 2019 at 8:45 AM Chris Angelico <ros...@gmail.com> wrote:
> > This would be a good argument if Python be a write-only language. > > I'm pretty sure the character counts are the same whether you're > reading or writing. If anything, writing is based on keystrokes, but > reading is based on characters. > It's not that simple -- it takes more work to type the quotes -- it may take more work to read them, but they provide useful information -- this is a string. If I see: colors = ["red", "green", "blue"] It is VERY clear to me, at a glance, that it is a list of strings. but when I see: colors = "red, green, blue".split() I need to think about it a bit. As for: %w[red green blue] The [] make it pretty clear at a glance that I'm dealing with a list -- but the lack of quotes is really likely to confuse me -- particularly if I have identifiers with similar names! and: %w[1 2 3] would really take a cognitive load to remember that that is a list of strings. I won't say that I (as a pretty bad typist) don't get annoyed at having to type quotes a lot, but I really do appreciate that clear distinction between identifiers and strings when reading code. -CHB -- Christopher Barker, PhD Python Language Consulting - Teaching - Scientific Software Development - Desktop GUI and Web Development - wxPython, numpy, scipy, Cython
_______________________________________________ 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/HX3FPTRGEA73CNEJTSJDR24LVEJ6DFMV/ Code of Conduct: http://python.org/psf/codeofconduct/