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/codeofconduct/


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 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
___
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/


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
> 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


___
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/


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 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).

___
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/


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 Tue, Mar 12, 2019 at 10:58 AM Nick Timkovich  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  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@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/
___
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/


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 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  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@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/


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-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/


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 that all their code is now wrong?

--
Greg
___
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/


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, 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
___
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/


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 know/read for + (in the case
proposed for dictionaries).

Regards,
--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/


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 left- and right arrow?

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/


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
___
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/


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 }
>
> >>> 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/
>
___
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/


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 }
> >>> 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

cspea...@redhat.com  M: +1.336.210.5107

TRIED. TESTED. TRUSTED. 
___
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/


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:46:24, "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 }
>
 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/
___
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/


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

Oleg.
-- 
Oleg Broytmanhttps://phdru.name/p...@phdru.name
   Programmers don't die, they just GOSUB without RETURN.
___
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] 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 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/