<div dir="ltr">This looks really good.<div><br></div><div>If you want to be consistent with range, line 21 should be:<div><br></div><div><pre style="margin-top:0px;margin-bottom:0px;padding:0px;border:none;outline:0px;font-size:12px;vertical-align:baseline;font-family:Monaco,'DejaVu Sans Mono','Bitstream Vera Sans Mono',monospace;color:rgb(68,68,68);overflow:inherit;font-stretch:normal;background:rgb(241,241,241)"><span class="" style="margin:0px;padding:0px;border:0px;outline:0px;vertical-align:baseline;color:rgb(32,74,135);font-weight:bold;background:transparent">if</span> <span class="" style="margin:0px;padding:0px;border:0px;outline:0px;vertical-align:baseline;color:rgb(0,0,0);background-image:initial;background-repeat:initial">i</span> <span class="" style="margin:0px;padding:0px;border:0px;outline:0px;vertical-align:baseline;color:rgb(206,92,0);font-weight:bold;background-image:initial;background-color:transparent;background-repeat:initial">>=</span> <span class="" style="margin:0px;padding:0px;border:0px;outline:0px;vertical-align:baseline;color:rgb(52,101,164);background:transparent">self</span><span class="" style="margin:0px;padding:0px;border:0px;outline:0px;vertical-align:baseline;color:rgb(206,92,0);font-weight:bold;background-image:initial;background-color:transparent;background-repeat:initial">.</span><span class="" style="margin:0px;padding:0px;border:0px;outline:0px;vertical-align:baseline;color:rgb(0,0,0);background-image:initial;background-repeat:initial">num or i < 0</span><span class="" style="margin:0px;padding:0px;border:0px;outline:0px;vertical-align:baseline;color:rgb(0,0,0);font-weight:bold;background-image:initial;background-color:transparent;background-repeat:initial">:</span></pre></div><div class="gmail_extra"><br></div><div class="gmail_extra">because i could have been less than -self.num, which is an index error.</div><div class="gmail_extra"><br></div><div class="gmail_extra">I think you should support num == 0 and num == 1 because numpy's linspace supports it.  Just set step to None in those cases and make sure you return start when indexing at 0 for num == 1. I think the rest of your code will work.</div><div class="gmail_extra"><br></div><div class="gmail_extra">Also, you should put the code through autopep8 as there are some style "problems" :)</div><div class="gmail_extra"><br></div><div class="gmail_extra">Best,</div><div class="gmail_extra"><br></div><div class="gmail_extra">Neil</div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Jan 12, 2015 at 5:51 PM, 'Andrew Barnert' via python-ideas <span dir="ltr"><<a href="mailto:python-ideas@googlegroups.com" target="_blank">python-ideas@googlegroups.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Sorry, hit Send accidentally.<br>
<br>
The ActiveState recipe referenced is #579000; it's the same as the class I posted on GitHub, but with only the NumPy implementation, rather than both that and Guido's version. It also links to the two earlier recipes I could find, and to NumPy docs and code, and the discussion section covers (I hope) all the caveats and bikeshedding issues that came up in this thread; the goal is that anyone following a link from the docs will find everything they might need to know about.<br>
<br>
Sent from a random iPhone<br>
<div class="HOEnZb"><div class="h5"><br>
On Jan 12, 2015, at 14:44, Andrew Barnert <abarnert@yahoo.com.dmarc.invalid> wrote:<br>
<br>
> On Jan 10, 2015, at 13:48, Ethan Furman <<a href="mailto:ethan@stoneleaf.us">ethan@stoneleaf.us</a>> wrote:<br>
><br>
>> On 01/10/2015 11:50 AM, Guido van Rossum wrote:<br>
>>><br>
>>> I suppose the briefest of recipes could go in the range() docs, in a section "what do do for floats". More extended<br>
>>> recipes should probably go on the activestate recipes site.<br>
>><br>
>> The range docs do seem to be the obvious place for range recipes.<br>
><br>
> I've created issue #23226, with a patch (the whole thing fits into one paragraph and a short example, so I didn't think a subsection was necessary, but that can easily be changed), and a link to a new ActiveState recipe ( that contains the same simple class that turns the NumPy algorithm into a lazy sequence.<br>
> _______________________________________________<br>
> Python-ideas mailing list<br>
> <a href="mailto:Python-ideas@python.org">Python-ideas@python.org</a><br>
> <a href="https://mail.python.org/mailman/listinfo/python-ideas" target="_blank">https://mail.python.org/mailman/listinfo/python-ideas</a><br>
> Code of Conduct: <a href="http://python.org/psf/codeofconduct/" target="_blank">http://python.org/psf/codeofconduct/</a><br>
_______________________________________________<br>
Python-ideas mailing list<br>
<a href="mailto:Python-ideas@python.org">Python-ideas@python.org</a><br>
<a href="https://mail.python.org/mailman/listinfo/python-ideas" target="_blank">https://mail.python.org/mailman/listinfo/python-ideas</a><br>
Code of Conduct: <a href="http://python.org/psf/codeofconduct/" target="_blank">http://python.org/psf/codeofconduct/</a><br>
<br>
--<br>
<br>
---<br>
You received this message because you are subscribed to a topic in the Google Groups "python-ideas" group.<br>
To unsubscribe from this topic, visit <a href="https://groups.google.com/d/topic/python-ideas/H69Z7qPe0Dg/unsubscribe" target="_blank">https://groups.google.com/d/topic/python-ideas/H69Z7qPe0Dg/unsubscribe</a>.<br>
To unsubscribe from this group and all its topics, send an email to <a href="mailto:python-ideas%2Bunsubscribe@googlegroups.com">python-ideas+unsubscribe@googlegroups.com</a>.<br>
For more options, visit <a href="https://groups.google.com/d/optout" target="_blank">https://groups.google.com/d/optout</a>.<br>
</div></div></blockquote></div><br></div></div></div>