What will the hyphen bring to what is already allowed with underscore? It is not possible to break compatibility with '-' character.
2017-11-19 3:01 GMT+01:00 Mikhail V <mikhail...@gmail.com>: > Python allows underscore character as a separator in variables. > This is better than nothing, still it does not make the look much better. > > **Proposal**: allow additional separator, namely hyphen character. > > **Benefits**: this should provide significant readability improvement. > Compared to most syntax change proposals that I remember till now, > this seems to have really tangible benefits. So all in all I see it as > a significant > language improvement. > Besides its direct benefit as a good looking separator, it also gives > an opprtunity > to reduce "camelCase" or similar ugly inclusions in code. > > So one can easily compose human-readable variable names e.g.: > my-variable > figure-shape---width > etc. > > **Problem**: currently hyphen character is used as a minus operator! > The problem is as old as the history of most programming languages, > and inherited from initial poorness of character sets. > Therefore I don't see a single optimal solution to this. > > Possible solutions: > > Solution 1: > Use another similar looking character from unicode, > for example: U+02D7 (modifier letter minus sign). > At the same time IMO it is needed to allow the minus character > for the minus operator, namely U+2212 Minus sign. This will > allow proper typography of source code. > Main benefit of such approach: no breakage of current code base, > since new chars are additional to existing ones. > > Solution 2: (radical) > Disallow hyphen as minus operator, and use only U+2212 Minus sign. > I.e. "a-b" would be a variable and "a − b" a minus operation. > Advantage: opportunity to correct the improper character usage once and > for all. > Disadvantage: breakage of current code base + force UTF-8 storage use > (consider > e.g. editors without unicode support). > Thus most probably such solution will cause howl reaching to the sky among > users, despite many modern editors allow unicode and custom operator > styling, > for example to distinguish dash from hyphen in a monospaced editor. > > So is my proposal, and as usual urging for constructive conversation. > (i.e. proposing to write own language/translator is not constructive > conversation) > > > Cheers, > Mikhail > _______________________________________________ > Python-ideas mailing list > Python-ideas@python.org > https://mail.python.org/mailman/listinfo/python-ideas > Code of Conduct: http://python.org/psf/codeofconduct/ > -- Antoine Rozo
_______________________________________________ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/