Hacker News
new
|
past
|
comments
|
ask
|
show
|
jobs
|
submit
login
jparise
on Dec 29, 2010
|
parent
|
context
|
favorite
| on:
Perl 6 in 2010 - a retrospection
You're right. I misread the range of the Perl version. Adjust the slice accordingly.
masak
on Dec 29, 2010
[–]
No, that's too easy a cop-out. :-) How would you stop at the right number in Python code? Would you compute 100 numbers and then inspect/truncate afterwards?
jparise
on Dec 29, 2010
|
parent
[–]
Ah, I see that I truly missed your earlier point. I suppose I would just do this:
def fib(max): a, b = 0, 1 while a < max: yield a a, b = b, a + b for k in fib(100): print(k)
Guidelines
|
FAQ
|
Lists
|
API
|
Security
|
Legal
|
Apply to YC
|
Contact
Search: