[Python-ideas] Left arrow and right arrow operators

David Teresi dkteresi at gmail.com
Wed Mar 13 14:44:51 EDT 2019


`->` would not be ambiguous in the proposed cases, but it does already
mean something elsewhere in the language as of 3.5:

def concat(a: str, b: str) -> str:
    return a + b

This could potentially cause confusion (as with the % operator being
used for modulo as well as string formatting).

On Tue, Mar 12, 2019 at 10:58 AM Nick Timkovich <prometheus235 at gmail.com> wrote:
>
> In general, there is lots of code out in the wild that can't be updated for whatever reason, e.g. the person that knows Python left and it needs to continue to work. Weak argument, but cost-benefit I think it comes out ahead. In your example there isn't a reason I can tell why swapping the operands isn't what should be done as Calvin mentioned. The onus is on you to positively demonstrate you require both directions, not him to negatively demonstrate it's never required.
>
> I suggest you confine your proposal to `->` only, as it's currently illegal syntax. You would also want the reflected `__r*__` equivalent of `__arrow__` or `__rarrow__` (`__rrarrow__` if you also need the left-arrow...)
>
> Perhaps broadening the use of it, functions may be able to use it as a pipe operator, e.g. Elixir: https://elixir-lang.org/getting-started/enumerables-and-streams.html#the-pipe-operator
>
> On Mon, Mar 11, 2019 at 2:58 PM francismb <francismb at email.de> wrote:
>>
>> Hi Greg,
>>
>> On 3/9/19 1:42 AM, Greg Ewing wrote:
>> > Do you really want
>> > to tell them that all their code is now wrong?
>> Of course not, at least not so promptly. But, would it be still a
>> problem if the update to a new version (let say from 3.X to next(3.X))
>> is done through some kind of updater/re-writer/evolver. In that case the
>> evolver could just add the blanks. What do you think ? Could it work?
>>
>> Thanks in advance!
>> --francis
>> _______________________________________________
>> 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/
>
> _______________________________________________
> 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/


More information about the Python-ideas mailing list