Re: Let range() return a generator?
| From: | Adam Baratz | Date: | Fri, 17 Mar 2017 12:57:20 +0000 |
| Subject: | Re: Let range() return a generator? | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-98575@lists.php.net to get a copy of this message | ||
> Yes, that's a BC break. Instead of changing it, there could be a new
> function. But as it can be simply built in userland, I don't see much
> reason to have it in core.
Whether or not it's in core, the two-pronged approach is what Python does
(range and xrange). Sometimes you want an array and not a generator. That
language is really sympathetic to generator use, but it never forces you to
use them. The core libraries are structured thoughtfully in that regard.
Thanks,
Adam