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/2012-March/117935.html below:

[Python-Dev] New PEP

[Python-Dev] New PEPEthan Furman ethan at stoneleaf.us
Thu Mar 22 01:09:22 CET 2012
Huan Do wrote:
> *Hi,
> 
> I am a graduating Berkeley student that loves python and would like to 
> propose an enhancement to python. My proposal introduces a concept of 
> slicing generator. For instance, if one does x[:] it returns a list 
> which is a copy of x. Sometimes programmers would want to iterate over a 
> slice of x, but they do not like the overhead of constructing another 
> list. Instead we can create a similar operator that returns a generator. 
> My proposed syntax is x(:). The programmers are of course able to set 
> lower, upper, and step size like the following.
> 
> x(1::-1)

The biggest problem with your proposal is that generators don't remember 
what they have already yielded, so

x(:) != x(:) # first time gets everything, second time gets nothing

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