Re: [Python-Dev] Is PEP 572 really the most effective way to solve the problems it's targeting?

2018年4月26日 18:02:55 -0700

On Thu, Apr 26, 2018 at 09:36:48AM -0700, Mike Miller wrote:
> However, there were two good questions in this message which I haven't seen 
> addressed yet:
> 
> - How are other modern languages solving this issue?
> - How does this new construct intersect with typing functionality?
What counts as a modern language? Less than five years old? Less than 
fifty years old? Are Javascript, Ruby and R modern? They all support 
assignment as expressions.
I think Koitlin, Rust and Go prohibit assignment as expressions.
Swift assignment evaluates as Void (equivalent to None in Python, I 
guess), so you can use assignment in an expression but it returns 
nothing and only operates by side-effect.
As far as type hints go, I think that if you need explicit type hints in 
the middle of an expression, it's a bad idea and you ought to pull it 
out as a separate statement. That applies regardless of whether that 
expression involves binding or not.
-- 
Steve
_______________________________________________
Python-Dev mailing list
[email protected]
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to