[Python-ideas] Allow additional separator character in variables

Bruce Leban bruce at leban.us
Sun Nov 19 02:11:58 EST 2017

On Sat, Nov 18, 2017 at 8:44 PM, Mikhail V <mikhailwas at gmail.com> wrote:
> 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?

It is not a misfortune or even true that Python uses hyphen for minus.
The name of the character used in Python is HYPHEN-MINUS.
It is both a hyphen and a minus. And it served double-duty even in ASCII.

A language that requires using characters not present on standard keyboards
is unlikely to be successful.
Or we would all be programming in APL.

And it's not as if no one every thought of this before. Maybe you've heard

> Would hyphens in variable names improve readability sometimes?
> For reading code, indeed, always and very much.

No it wouldn't. You're personal preference is hardly authoritative. I am
extremely skeptical that a legitimate usability study would find that
record-count is better than record_count.

There are studies that monospace fonts are harder to read than
proportionally spaced, e.g.,
http://journals.sagepub.com/doi/pdf/10.1177/001872088302500303. Yet many
programmers use monospace fonts because the advantages -- in our opinions
-- outweigh the disadvantages. And the reality is that only my opinion
matters when I'm choosing the fonts to display my code in, not yours.


And because spaces between words is mostly not valid syntax currently, this
change would be easier to introduce than breaking every single program out
there by re-purposing hyphen-minus. But I'm not seriously proposing this
because I think the modest benefits are outweighed by the many problems it
would introduce.

--- Bruce
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20171118/97bf2bd0/attachment-0001.html>

More information about the Python-ideas mailing list