![](https://secure.gravatar.com/avatar/6c371f35178d02dfdacef102f3843b51.jpg?s=120&d=mm&r=g)
Hi, the idea here is just to add the __larrow__ and __rarrow__ operators for <- and ->. E.g. of use on dicts :
d1 = {'a':1, 'b':1 } d2 = {'a':2 } d3 = d1 -> d2 d3 {'a':1, 'b':1 }
d1 = {'a':1, 'b':1 } d2 = {'a':2 } d3 = d1 <- d2 d3 {'a':2, 'b':1 }
Or on bools as Modus Ponens [1] Or your idea/imagination here :-) Regards, --francis [1] https://en.wikipedia.org/wiki/Modus_ponens
![](https://secure.gravatar.com/avatar/512cfbaf98d63ca4acd57b2df792aec6.jpg?s=120&d=mm&r=g)
On Sun, Mar 03, 2019 at 03:46:24PM +0100, francismb <francismb@email.de> wrote:
Hi, the idea here is just to add the __larrow__ and __rarrow__ operators for <- and ->.
You cannot create operator ``<-`` because it's currently valid syntax: 3 <- 2 is equivalent to 3 < -2
Regards, --francis
Oleg. -- Oleg Broytman https://phdru.name/ phd@phdru.name Programmers don't die, they just GOSUB without RETURN.
![](https://secure.gravatar.com/avatar/6c371f35178d02dfdacef102f3843b51.jpg?s=120&d=mm&r=g)
Hi Oleg, On 3/3/19 4:06 PM, Oleg Broytman wrote:
You cannot create operator ``<-`` because it's currently valid syntax:
3 <- 2
is equivalent to
3 < -2
Yes, its a good point, but for me it's not the same '<-' and '< -' due (n)blanks in between. It is may be how now it is, but means that it needs to be always like this? Isn't Python not already blank(s)/indentation aware? or it's just a grammar NO GO? Thanks in advance! --francis
![](https://secure.gravatar.com/avatar/d67ab5d94c2fed8ab6b727b62dc1b213.jpg?s=120&d=mm&r=g)
On Sat, Mar 9, 2019 at 7:05 AM francismb <francismb@email.de> wrote:
Hi Oleg,
On 3/3/19 4:06 PM, Oleg Broytman wrote:
You cannot create operator ``<-`` because it's currently valid syntax:
3 <- 2
is equivalent to
3 < -2
Yes, its a good point, but for me it's not the same '<-' and '< -' due (n)blanks in between. It is may be how now it is, but means that it needs to be always like this? Isn't Python not already blank(s)/indentation aware? or it's just a grammar NO GO?
Python permits "3<-2", so this is indeed a no-go. You can easily test this at the interactive interpreter. ChrisA
![](https://secure.gravatar.com/avatar/72ee673975357d43d79069ac1cd6abda.jpg?s=120&d=mm&r=g)
francismb wrote:
It is may be how now it is, but means that it needs to be always like this?
Yes, as long as you care about not breaking existing code. While you may be in the habit of always leaving a space between '<' and '-', others may have different styles. Do you really want to tell them that all their code is now wrong? -- Greg
![](https://secure.gravatar.com/avatar/6c371f35178d02dfdacef102f3843b51.jpg?s=120&d=mm&r=g)
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
Hi Greg, On 3/9/19 1:42 AM, Greg Ewing wrote: 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
![](https://secure.gravatar.com/avatar/1a71658d81f8a82a8122050f21bb86d3.jpg?s=120&d=mm&r=g)
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-pip... On Mon, Mar 11, 2019 at 2:58 PM francismb <francismb@email.de> wrote:
Hi Greg,
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
On 3/9/19 1:42 AM, Greg Ewing wrote: 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@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/
![](https://secure.gravatar.com/avatar/acb6f5f2726ca30720a0ddcca2323c07.jpg?s=120&d=mm&r=g)
`->` 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@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-pip...
On Mon, Mar 11, 2019 at 2:58 PM francismb <francismb@email.de> wrote:
Hi Greg,
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
On 3/9/19 1:42 AM, Greg Ewing wrote: 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@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/
_______________________________________________ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/
![](https://secure.gravatar.com/avatar/5426055f54148a02d5d724ccbfdeca19.jpg?s=120&d=mm&r=g)
On 3/13/19 1:44 PM, David Teresi wrote:
`->` 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).
But by that logic, the colon is also ambiguous: the colon is used to indicate a dictionary entry, as in {a : str}. Given the radically difference contexts in which the tokens in question occur, I don't think that this is an issue (then again, I've never designed a language as widely consumed as Python).
![](https://secure.gravatar.com/avatar/6c371f35178d02dfdacef102f3843b51.jpg?s=120&d=mm&r=g)
On 3/13/19 7:44 PM, David Teresi wrote:
`->` 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). IMHO in that context the asymmetry is still there:
(a: str, b: str) -> str And the operator is the function. Regards, --francis
![](https://secure.gravatar.com/avatar/6c371f35178d02dfdacef102f3843b51.jpg?s=120&d=mm&r=g)
Hi Nick, On 3/12/19 3:57 PM, Nick Timkovich wrote:
The onus is on you to positively demonstrate you require both directions, not him to negatively demonstrate it's never required. From Calvin I just wanted to have some examples where he sees a use for swapping operands (nothing to be demonstrated :-) ).
But I really just wanted to talk some *visual asymmetric form* that could be used as operator for potentially asymmetric operations and thought that the arrow could be one of this. So you're correct one should discuss with *form* could potentially be wider accepted/work. The debate on this is going on the thread: "Why operators are useful". Regards, --francis
![](https://secure.gravatar.com/avatar/895705a82b01954dc9f8547f8bc1b202.jpg?s=120&d=mm&r=g)
I wonder if it is necessary to add two new operators, and for me, "arrow operator" is not clearer than `+`. Could you explain why do you prefer this operator than `+`? Also -> is a symbol of propositional logic, like ∧ and ∨ , do we also need these operators as well? At 2019-03-03 22:46:24, "francismb" <francismb@email.de> wrote:
Hi, the idea here is just to add the __larrow__ and __rarrow__ operators for <- and ->.
E.g. of use on dicts :
d1 = {'a':1, 'b':1 } d2 = {'a':2 } d3 = d1 -> d2 d3 {'a':1, 'b':1 }
d1 = {'a':1, 'b':1 } d2 = {'a':2 } d3 = d1 <- d2 d3 {'a':2, 'b':1 }
Or on bools as Modus Ponens [1]
Or your idea/imagination here :-)
Regards, --francis
[1] https://en.wikipedia.org/wiki/Modus_ponens
_______________________________________________ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/
![](https://secure.gravatar.com/avatar/6c371f35178d02dfdacef102f3843b51.jpg?s=120&d=mm&r=g)
Could you explain why do you prefer this operator than `+`? Well yes, because of the asymmetric operation done underneath (merging dicts is not symmetric). The asymmetry is explicit in the symbol. Not implicit from the documentation you need to know/read for + (in the case
Hi fhsxfhsx, On 3/4/19 5:56 AM, fhsxfhsx wrote: proposed for dictionaries). Regards, --francis
![](https://secure.gravatar.com/avatar/0ba23f0a211079fb3e219acfaa9e432d.jpg?s=120&d=mm&r=g)
I don't like the idea of arrows in both directions when you can just swap the operands instead On Sun, Mar 3, 2019 at 9:52 AM francismb <francismb@email.de> wrote:
Hi, the idea here is just to add the __larrow__ and __rarrow__ operators for <- and ->.
E.g. of use on dicts :
d1 = {'a':1, 'b':1 } d2 = {'a':2 } d3 = d1 -> d2 d3 {'a':1, 'b':1 }
d1 = {'a':1, 'b':1 } d2 = {'a':2 } d3 = d1 <- d2 d3 {'a':2, 'b':1 }
Or on bools as Modus Ponens [1]
Or your idea/imagination here :-)
Regards, --francis
[1] https://en.wikipedia.org/wiki/Modus_ponens
_______________________________________________ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/
-- CALVIN SPEALMAN SENIOR QUALITY ENGINEER cspealma@redhat.com M: +1.336.210.5107 <https://red.ht/sig> TRIED. TESTED. TRUSTED. <https://redhat.com/trusted>
![](https://secure.gravatar.com/avatar/6c371f35178d02dfdacef102f3843b51.jpg?s=120&d=mm&r=g)
Hi Calvin, On 3/4/19 2:09 PM, Calvin Spealman wrote:
I don't like the idea of arrows in both directions when you can just swap the operands instead Well you saw just to examples of contexts (dict and bool). Could you imagine a context where swapping cannot be done and thus there is a need for left- and right arrow?
Thanks in advance! --francis
![](https://secure.gravatar.com/avatar/998f5c5403f3657437a3afbf6a16e24b.jpg?s=120&d=mm&r=g)
What is the operator supposed to do? On Sun, Mar 3, 2019, 09:52 francismb <francismb@email.de> wrote:
Hi, the idea here is just to add the __larrow__ and __rarrow__ operators for <- and ->.
E.g. of use on dicts :
d1 = {'a':1, 'b':1 } d2 = {'a':2 } d3 = d1 -> d2 d3 {'a':1, 'b':1 }
d1 = {'a':1, 'b':1 } d2 = {'a':2 } d3 = d1 <- d2 d3 {'a':2, 'b':1 }
Or on bools as Modus Ponens [1]
Or your idea/imagination here :-)
Regards, --francis
[1] https://en.wikipedia.org/wiki/Modus_ponens
_______________________________________________ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/
participants (10)
-
Calvin Spealman
-
Chris Angelico
-
Dan Sommers
-
David Teresi
-
fhsxfhsx
-
francismb
-
Greg Ewing
-
Nick Timkovich
-
Oleg Broytman
-
Todd