[Python-ideas] Allow additional separator character in variables
prometheus235 at gmail.com
Sun Nov 19 00:01:55 EST 2017
Python does not use U+2010 HYPHEN for the minus operator, it uses the
U+002D (-) HYPHEN-MINUS.
In some monospace fonts, there is a subtle difference between U+002D,
U+2013 EN DASH, and U+2014 EM DASH, but it's usually hard to tell them
If you want to make a proposal, I'd suggest that you limit it to allowing
the U+2010 HYPHEN to be used for names. U+002D simply cannot be changed
because it would break billions of lines of code.
On Sat, Nov 18, 2017 at 10:44 PM, Mikhail V <mikhailwas at gmail.com> wrote:
> On Sun, Nov 19, 2017 at 3:42 AM, Nick Coghlan <ncoghlan at gmail.com> wrote:
> > For anyone tempted to suggest "What about multiple underscores
> > indicating continuation of the variable name?", that's still a
> > compatibility problem due to the unary minus operator:
> > >>> my--variable
> > 2
> > >>> my---variable
> > 0
> That seems to be another showcase of misfotune that Python
> uses hyphen for minus operator. I know it is not language designer's
> fault, because basic ASCII simply did not not include minus character.
> But do you realise that the **current** problem you are adressing is that
> font designers forgot to make the minus character (in monospaced font)
> distinctive from the hyphen character?
> Well, what can I say, I just think it should be a reason to make a
> collective complain to font providers, but not that you should silently
> accept this and adopt the language design to someone's sloppy font design.
> As an aid for monospace die-hards, to minimise the confusion one could
> publish a style-guide that recommends to disclose the minus operator
> hyphen char) in spaces, like a - b, and probably disallow the new proposed
> hyphen character in the beginning of the identifiers.
> That would still leave potential for confusion because you cant' force
> to follow style-guides, but one should struggle to break from this cycle
> > Would hyphens in variable names improve readability sometimes?
> For reading code, indeed, always and very much. Of course not in case
> I would be forced
> to use monospaced font with a similar minus and hyphen. But
> in that case I am already accepting the level of readability of
> 12th century, so this would not make things much worse, and I
> would simply put spaces around the minus operator and try to highlight
> it with some strong color.
> Python-ideas mailing list
> Python-ideas at python.org
> Code of Conduct: http://python.org/psf/codeofconduct/
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Python-ideas