Just my opinion, I do not think this belongs in PEP8 or official guidelines.
Different editors will vary, of course, in how they handle "invisible"
characters. But since various people will read your code, I think it's
generally friendlier to use a name or Unicode escape rather than a quoted
literal.
E.g.
foobar = "foo\u200bbar" # zero-width space inside
Or if you use it often:
zw = "\u200b"
foobar = f"foo{zw}bar"
On Sun, Nov 10, 2019, 9:34 AM Artemis <[email protected]> wrote:
> What should one do when one wants to put a zero width space or other
> invisible character in code?
> These are often not displayed in editors, which can lead to confusion. I
> see two solutions:
> - include it but add a comment noting it
> - use the chr function to get the character (and add a comment saying
> what it is)
> Where should a guideline for this go (PEP 8?)? What should the guideline
> be (one of these or something else?)?
>
> This is my first time contributing in any way to Python, please excuse me
> if I've done it in the wrong place/format.
> _______________________________________________
> Python-ideas mailing list -- [email protected]
> To unsubscribe send an email to [email protected]
> https://mail.python.org/mailman3/lists/python-ideas.python.org/
> Message archived at
> https://mail.python.org/archives/list/[email protected]/message/6XBJGGV6XTNN5CICTCI2457QDG2RASRF/
> Code of Conduct: http://python.org/psf/codeofconduct/
>
_______________________________________________
Python-ideas mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at
https://mail.python.org/archives/list/[email protected]/message/RID2XSCUYO2L3I3Z2Y4URGHMO6523CCC/
Code of Conduct: http://python.org/psf/codeofconduct/