[Python-ideas] Allow additional separator character in variables

Stephan Houben stephanh42 at gmail.com
Sun Nov 19 02:42:51 EST 2017


Note that Python already allows Unicode characters from class "connector
punctuations (Pc)" in identifiers.

No dashes in that, but if you are into that kind of thing,
then this⁀is⁀a⁀valid⁀identifier .

Stephan

Op 19 nov. 2017 08:13 schreef "Bruce Leban" <bruce at leban.us>:

>
> 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.
> http://unicode.org/cldr/utility/character.jsp?a=002D
> 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
> of COBOL?
>
>
>>
>>
> > 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.
>
> You-know-what-really-would-increase-readability?
> Allowing-the-use-of-spaces-in-variable-names. As-you-can-see-from-this-
> example-hyphens-between-words-decreases-readability.
>
> 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
>
> _______________________________________________
> Python-ideas mailing list
> Python-ideas at python.org
> https://mail.python.org/mailman/listinfo/python-ideas
> Code of Conduct: http://python.org/psf/codeofconduct/
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20171119/9f292147/attachment.html>


More information about the Python-ideas mailing list