Re: [Python-ideas] Left arrow and right arrow operators

2019-03-17 Thread francismb
On 3/15/19 9:02 PM, francismb wrote: > And the operator is the function.exactly, function application/call ___ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/c

Re: [Python-ideas] Left arrow and right arrow operators

2019-03-17 Thread francismb
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 demons

Re: [Python-ideas] Left arrow and right arrow operators

2019-03-15 Thread francismb
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 >

Re: [Python-ideas] Left arrow and right arrow operators

2019-03-13 Thread Dan Sommers
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 m

Re: [Python-ideas] Left arrow and right arrow operators

2019-03-13 Thread David Teresi
`->` 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 Tu

Re: [Python-ideas] Left arrow and right arrow operators

2019-03-12 Thread Nick Timkovich
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

Re: [Python-ideas] Left arrow and right arrow operators

2019-03-11 Thread francismb
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-write

Re: [Python-ideas] Left arrow and right arrow operators

2019-03-08 Thread Greg Ewing
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

Re: [Python-ideas] Left arrow and right arrow operators

2019-03-08 Thread Chris Angelico
On Sat, Mar 9, 2019 at 7:05 AM francismb 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 t

Re: [Python-ideas] Left arrow and right arrow operators

2019-03-08 Thread francismb
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

Re: [Python-ideas] Left arrow and right arrow operators

2019-03-08 Thread francismb
Hi fhsxfhsx, On 3/4/19 5:56 AM, fhsxfhsx wrote: > 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 kno

Re: [Python-ideas] Left arrow and right arrow operators

2019-03-08 Thread francismb
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

Re: [Python-ideas] Left arrow and right arrow operators

2019-03-08 Thread francismb
Hi Todd, On 3/4/19 2:18 PM, Todd wrote: > What is the operator supposed to do? this should depend on what you want to do, the type, the context. How to you would want to use it ? do you see a context where the symbols make meaning to you? Thanks in advance! --francis

Re: [Python-ideas] Left arrow and right arrow operators

2019-03-04 Thread Todd
What is the operator supposed to do? On Sun, Mar 3, 2019, 09:52 francismb 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

Re: [Python-ideas] Left arrow and right arrow operators

2019-03-04 Thread Calvin Spealman
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 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 } > >

Re: [Python-ideas] Left arrow and right arrow operators

2019-03-03 Thread fhsxfhsx
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:

Re: [Python-ideas] Left arrow and right arrow operators

2019-03-03 Thread Oleg Broytman
On Sun, Mar 03, 2019 at 03:46:24PM +0100, francismb 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 Ole

[Python-ideas] Left arrow and right arrow operators

2019-03-03 Thread francismb
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 M