A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2010-August/103306.html below:

[Python-Dev] Return from generators in Python 3.2

[Python-Dev] Return from generators in Python 3.2 [Python-Dev] Return from generators in Python 3.2Greg Ewing greg.ewing at canterbury.ac.nz
Fri Aug 27 02:04:42 CEST 2010
Yury Selivanov wrote:

> However, as I outlined in the first message, this was intended to prevent
> this kind of mistakes:
> 
> ... def test():
> ...     for i in range(10):
> ...         yield i
> ...     return 10
> 
> Which will certainly happen, especially with people new to python.

That very problem was considered in the discussion, and
it was concluded that it wasn't severe enough to be worth
breaking the symmetry between return <-> StopIteration and
return value <-> StopIteration(value).

> Good point.  It's all about our level of care about beginners ;)

While due consideration is always given to beginners, being
beginner-friendly is not a good enough reason to introduce
a feature that would be *unfriendly* to experienced programmers.

> I, for example, deal with really a lot of coroutine based
> code, and it's very annoying that I have to use some creepy abstractions
> in order to just return a value!

Even with your proposal, you'd still have to use a 'creepy
abstraction' every time one of your coroutines calls another.
That's why PEP 380 deals with 'more than just return'.

-- 
Greg
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4