I'm not married to the colon. Does anyone else see any issue with dropping
it?

On 18 February 2017 at 00:27, David Mertz <me...@gnosis.cx> wrote:

> On Fri, Feb 17, 2017 at 2:35 PM, Joseph Hackman <josephhack...@gmail.com>
> wrote:
>
>> I think we should use the colon to make the delayed word (or whatever
>> word is selected), unambiguously used in this way (and to prevent any
>> existing code from breaking).
>>
>> On 17 February 2017 at 17:09, David Mertz <me...@gnosis.cx> wrote:
>>
>>> That was a problem with the colon that occurred to me. I think it can't
>>> be tokenized in function annotations.
>>>
>>
>> I don't see any reason for delayed execution and function annotations to
>> mix. i.e.
>> def foo(delayed: bar):
>>     pass
>> would define a function that takes one argument, named delayed, of type
>> bar.
>>
>
> I still think the colon is ugly and inconsistent with other Python uses.
> I know you are trying for analogy with lambda (which is related, yes).  But
> the analogies with yield, yield from, async, and await feel much stronger
> to me.  Also, 'lambda' *requires* the colon since it might take arguments
> and that is necessary to tell when they end.[*]  'delayed' like those other
> words I mention has no such need.
>
> That said, I think you are right that it makes no sense to declare a
> function signature with 'delayed' (or 'lazy', 'deferred', whatever word).
> Calling it definitely! This feels important:
>
>     x = foo(delayed very_complex_computation())
>
> But in the definition signature it feels nonsensical, I agree.  However,
> that still doesn't answer other uses of the colon:
>
>     {delayed: 17}   # No idea if this is a set of one delayed object or a
> dictionary
>     lambda delayed: delayed: 17  # Just don't know where to start with this
>
> All these problems simply go away if we drop the colon.
>
>
> [*] i.e. what would this colon-free lambda mean: 'lambda a, b, c'? A
> function of no arguments return a tuple? a function of three arguments?
>
>
> --
> Keeping medicines from the bloodstreams of the sick; food
> from the bellies of the hungry; books from the hands of the
> uneducated; technology from the underdeveloped; and putting
> advocates of freedom in prisons.  Intellectual property is
> to the 21st century what the slave trade was to the 16th.
>
_______________________________________________
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to