Premature send with incomplete info, sorry!

On Sat, May 15, 2021 at 3:01 AM Chris Angelico <ros...@gmail.com> wrote:
>
> On Sat, May 15, 2021 at 2:55 AM Martin Teichmann
> <martin.teichm...@gmail.com> wrote:
> >
> > Hi Chris,
> >
> > I would be willing to write such a PEP. It will take a while though, I am 
> > not fast at those kinda things.
>
> Cool cool. Feel free to email me off-list about getting started;
> here's some handy info to read:

https://www.python.org/dev/peps/pep-0001/
https://www.python.org/dev/peps/pep-0012/

> > I actually have a new idea about how a fraction literal could look like: 
> > just write 2/3 as opposed to 2 / 3, and you get a fraction. So: no spaces: 
> > fraction, with spaces: float.
> >
> > I hear you crying "but that's illegal, whitespace should not matter!", to 
> > which I respond:
> >
> >     >>> 3.real
> >       File "<stdin>", line 1
> >         3.real
> >              ^
> >     SyntaxError: invalid syntax
> >     >>> 3 . real
> >     3

That's a syntactic matter, and it's not actually whitespace
necessarily that does it.

>>> (3).real
3
>>> x = 3
>>> x.real
3
>>> x . real
3

So, no, whitespace or lack thereof should not drastically change the
behaviour. In any case, this would still need to be defined as a new
operator, so that different types can react appropriately, so you
don't really gain much in return for sacrificing readability by having
x/y be different from x / y !

But there's no real reason to create a new operator if it can be done
in a simpler way.

ChrisA
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/SKD7RGYY2VNMHVFSEJZA4HZ34DZ53R6L/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to