Show More
@@ -49,7 +49,7 b' create random Python file to exercise Py' | |||
|
49 | 49 | > except (ValueError, IndexError): |
|
50 | 50 | > n = 10 |
|
51 | 51 | > p = primes() |
|
52 |
> print |
|
|
52 | > print("The first %d primes: %s" % (n, list(islice(p, n)))) | |
|
53 | 53 | > EOF |
|
54 | 54 |
$ |
|
55 | 55 | $ hg ci -Ama |
@@ -74,7 +74,7 b' hgweb filerevision, html' | |||
|
74 | 74 | <script type="text/javascript" src="/static/mercurial.js"></script> |
|
75 | 75 | |
|
76 | 76 | <link rel="stylesheet" href="/highlightcss" type="text/css" /> |
|
77 |
<title>test: |
|
|
77 | <title>test: f4fca47b67e6 primes.py</title> | |
|
78 | 78 | </head> |
|
79 | 79 | <body> |
|
80 | 80 | |
@@ -112,7 +112,7 b' hgweb filerevision, html' | |||
|
112 | 112 | <div class="main"> |
|
113 | 113 | <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2> |
|
114 | 114 | <h3> |
|
115 |
view primes.py @ 0:<a href="/rev/ |
|
|
115 | view primes.py @ 0:<a href="/rev/f4fca47b67e6">f4fca47b67e6</a> | |
|
116 | 116 | <span class="tag">tip</span> |
|
117 | 117 | </h3> |
|
118 | 118 | |
@@ -182,7 +182,7 b' hgweb filerevision, html' | |||
|
182 | 182 | <span id="l27"> <span class="kn">except</span> <span class="p">(</span><span class="ne">ValueError</span><span class="p">,</span> <span class="ne">IndexError</span><span class="p">):</span></span><a href="#l27"></a> |
|
183 | 183 | <span id="l28"> <span class="n">n</span> <span class="o">=</span> <span class="mi">10</span></span><a href="#l28"></a> |
|
184 | 184 | <span id="l29"> <span class="n">p</span> <span class="o">=</span> <span class="n">primes</span><span class="p">()</span></span><a href="#l29"></a> |
|
185 | <span id="l30"> <span class="kn">print</span> <span class="s">"The first </span><span class="si">%d</span><span class="s"> primes: </span><span class="si">%s</span><span class="s">"</span> <span class="o">%</span> <span class="p">(</span><span class="n">n</span><span class="p">,</span> <span class="nb">list</span><span class="p">(</span><span class="n">islice</span><span class="p">(</span><span class="n">p</span><span class="p">,</span> <span class="n">n</span><span class="p">)))</span></span><a href="#l30"></a> | |
|
185 | <span id="l30"> <span class="kn">print</span><span class="p">(</span><span class="s">"The first </span><span class="si">%d</span><span class="s"> primes: </span><span class="si">%s</span><span class="s">"</span> <span class="o">%</span> <span class="p">(</span><span class="n">n</span><span class="p">,</span> <span class="nb">list</span><span class="p">(</span><span class="n">islice</span><span class="p">(</span><span class="n">p</span><span class="p">,</span> <span class="n">n</span><span class="p">))))</span></span><a href="#l30"></a> | |
|
186 | 186 | <span id="l31"></span><a href="#l31"></a> |
|
187 | 187 | </pre> |
|
188 | 188 | </div> |
@@ -251,7 +251,7 b' hgweb fileannotate, html' | |||
|
251 | 251 | <div class="main"> |
|
252 | 252 | <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2> |
|
253 | 253 | <h3> |
|
254 |
annotate primes.py @ 0:<a href="/rev/ |
|
|
254 | annotate primes.py @ 0:<a href="/rev/f4fca47b67e6">f4fca47b67e6</a> | |
|
255 | 255 | <span class="tag">tip</span> |
|
256 | 256 | </h3> |
|
257 | 257 | |
@@ -299,19 +299,19 b' hgweb fileannotate, html' | |||
|
299 | 299 | |
|
300 | 300 | <tr id="l1" class="thisrev"> |
|
301 | 301 | <td class="annotate parity0"> |
|
302 |
<a href="/annotate/ |
|
|
302 | <a href="/annotate/f4fca47b67e6/primes.py#l1"> | |
|
303 | 303 | 0 |
|
304 | 304 | </a> |
|
305 | 305 | <div class="annotate-info"> |
|
306 | 306 | <div> |
|
307 |
<a href="/annotate/ |
|
|
308 | 1af356141006</a> | |
|
307 | <a href="/annotate/f4fca47b67e6/primes.py#l1"> | |
|
308 | f4fca47b67e6</a> | |
|
309 | 309 | a |
|
310 | 310 | </div> |
|
311 | 311 | <div><em>test</em></div> |
|
312 | 312 | <div>parents: </div> |
|
313 |
<a href="/diff/ |
|
|
314 |
<a href="/rev/ |
|
|
313 | <a href="/diff/f4fca47b67e6/primes.py">diff</a> | |
|
314 | <a href="/rev/f4fca47b67e6">changeset</a> | |
|
315 | 315 | </div> |
|
316 | 316 | </td> |
|
317 | 317 | <td class="source followlines-btn-parent"><a href="#l1"> 1</a> <span class="sd">"""Fun with generators. Corresponding Haskell implementation:</span></td> |
@@ -321,14 +321,14 b' hgweb fileannotate, html' | |||
|
321 | 321 | |
|
322 | 322 | <div class="annotate-info"> |
|
323 | 323 | <div> |
|
324 |
<a href="/annotate/ |
|
|
325 | 1af356141006</a> | |
|
324 | <a href="/annotate/f4fca47b67e6/primes.py#l2"> | |
|
325 | f4fca47b67e6</a> | |
|
326 | 326 | a |
|
327 | 327 | </div> |
|
328 | 328 | <div><em>test</em></div> |
|
329 | 329 | <div>parents: </div> |
|
330 |
<a href="/diff/ |
|
|
331 |
<a href="/rev/ |
|
|
330 | <a href="/diff/f4fca47b67e6/primes.py">diff</a> | |
|
331 | <a href="/rev/f4fca47b67e6">changeset</a> | |
|
332 | 332 | </div> |
|
333 | 333 | </td> |
|
334 | 334 | <td class="source followlines-btn-parent"><a href="#l2"> 2</a> </td> |
@@ -338,14 +338,14 b' hgweb fileannotate, html' | |||
|
338 | 338 | |
|
339 | 339 | <div class="annotate-info"> |
|
340 | 340 | <div> |
|
341 |
<a href="/annotate/ |
|
|
342 | 1af356141006</a> | |
|
341 | <a href="/annotate/f4fca47b67e6/primes.py#l3"> | |
|
342 | f4fca47b67e6</a> | |
|
343 | 343 | a |
|
344 | 344 | </div> |
|
345 | 345 | <div><em>test</em></div> |
|
346 | 346 | <div>parents: </div> |
|
347 |
<a href="/diff/ |
|
|
348 |
<a href="/rev/ |
|
|
347 | <a href="/diff/f4fca47b67e6/primes.py">diff</a> | |
|
348 | <a href="/rev/f4fca47b67e6">changeset</a> | |
|
349 | 349 | </div> |
|
350 | 350 | </td> |
|
351 | 351 | <td class="source followlines-btn-parent"><a href="#l3"> 3</a> <span class="sd">primes = 2 : sieve [3, 5..]</span></td> |
@@ -355,14 +355,14 b' hgweb fileannotate, html' | |||
|
355 | 355 | |
|
356 | 356 | <div class="annotate-info"> |
|
357 | 357 | <div> |
|
358 |
<a href="/annotate/ |
|
|
359 | 1af356141006</a> | |
|
358 | <a href="/annotate/f4fca47b67e6/primes.py#l4"> | |
|
359 | f4fca47b67e6</a> | |
|
360 | 360 | a |
|
361 | 361 | </div> |
|
362 | 362 | <div><em>test</em></div> |
|
363 | 363 | <div>parents: </div> |
|
364 |
<a href="/diff/ |
|
|
365 |
<a href="/rev/ |
|
|
364 | <a href="/diff/f4fca47b67e6/primes.py">diff</a> | |
|
365 | <a href="/rev/f4fca47b67e6">changeset</a> | |
|
366 | 366 | </div> |
|
367 | 367 | </td> |
|
368 | 368 | <td class="source followlines-btn-parent"><a href="#l4"> 4</a> <span class="sd"> where sieve (p:ns) = p : sieve [n | n <- ns, mod n p /= 0]</span></td> |
@@ -372,14 +372,14 b' hgweb fileannotate, html' | |||
|
372 | 372 | |
|
373 | 373 | <div class="annotate-info"> |
|
374 | 374 | <div> |
|
375 |
<a href="/annotate/ |
|
|
376 | 1af356141006</a> | |
|
375 | <a href="/annotate/f4fca47b67e6/primes.py#l5"> | |
|
376 | f4fca47b67e6</a> | |
|
377 | 377 | a |
|
378 | 378 | </div> |
|
379 | 379 | <div><em>test</em></div> |
|
380 | 380 | <div>parents: </div> |
|
381 |
<a href="/diff/ |
|
|
382 |
<a href="/rev/ |
|
|
381 | <a href="/diff/f4fca47b67e6/primes.py">diff</a> | |
|
382 | <a href="/rev/f4fca47b67e6">changeset</a> | |
|
383 | 383 | </div> |
|
384 | 384 | </td> |
|
385 | 385 | <td class="source followlines-btn-parent"><a href="#l5"> 5</a> <span class="sd">"""</span></td> |
@@ -389,14 +389,14 b' hgweb fileannotate, html' | |||
|
389 | 389 | |
|
390 | 390 | <div class="annotate-info"> |
|
391 | 391 | <div> |
|
392 |
<a href="/annotate/ |
|
|
393 | 1af356141006</a> | |
|
392 | <a href="/annotate/f4fca47b67e6/primes.py#l6"> | |
|
393 | f4fca47b67e6</a> | |
|
394 | 394 | a |
|
395 | 395 | </div> |
|
396 | 396 | <div><em>test</em></div> |
|
397 | 397 | <div>parents: </div> |
|
398 |
<a href="/diff/ |
|
|
399 |
<a href="/rev/ |
|
|
398 | <a href="/diff/f4fca47b67e6/primes.py">diff</a> | |
|
399 | <a href="/rev/f4fca47b67e6">changeset</a> | |
|
400 | 400 | </div> |
|
401 | 401 | </td> |
|
402 | 402 | <td class="source followlines-btn-parent"><a href="#l6"> 6</a> </td> |
@@ -406,14 +406,14 b' hgweb fileannotate, html' | |||
|
406 | 406 | |
|
407 | 407 | <div class="annotate-info"> |
|
408 | 408 | <div> |
|
409 |
<a href="/annotate/ |
|
|
410 | 1af356141006</a> | |
|
409 | <a href="/annotate/f4fca47b67e6/primes.py#l7"> | |
|
410 | f4fca47b67e6</a> | |
|
411 | 411 | a |
|
412 | 412 | </div> |
|
413 | 413 | <div><em>test</em></div> |
|
414 | 414 | <div>parents: </div> |
|
415 |
<a href="/diff/ |
|
|
416 |
<a href="/rev/ |
|
|
415 | <a href="/diff/f4fca47b67e6/primes.py">diff</a> | |
|
416 | <a href="/rev/f4fca47b67e6">changeset</a> | |
|
417 | 417 | </div> |
|
418 | 418 | </td> |
|
419 | 419 | <td class="source followlines-btn-parent"><a href="#l7"> 7</a> <span class="kn">from</span> <span class="nn">itertools</span> <span class="kn">import</span> <span class="n">dropwhile</span><span class="p">,</span> <span class="n">ifilter</span><span class="p">,</span> <span class="n">islice</span><span class="p">,</span> <span class="n">count</span><span class="p">,</span> <span class="n">chain</span></td> |
@@ -423,14 +423,14 b' hgweb fileannotate, html' | |||
|
423 | 423 | |
|
424 | 424 | <div class="annotate-info"> |
|
425 | 425 | <div> |
|
426 |
<a href="/annotate/ |
|
|
427 | 1af356141006</a> | |
|
426 | <a href="/annotate/f4fca47b67e6/primes.py#l8"> | |
|
427 | f4fca47b67e6</a> | |
|
428 | 428 | a |
|
429 | 429 | </div> |
|
430 | 430 | <div><em>test</em></div> |
|
431 | 431 | <div>parents: </div> |
|
432 |
<a href="/diff/ |
|
|
433 |
<a href="/rev/ |
|
|
432 | <a href="/diff/f4fca47b67e6/primes.py">diff</a> | |
|
433 | <a href="/rev/f4fca47b67e6">changeset</a> | |
|
434 | 434 | </div> |
|
435 | 435 | </td> |
|
436 | 436 | <td class="source followlines-btn-parent"><a href="#l8"> 8</a> </td> |
@@ -440,14 +440,14 b' hgweb fileannotate, html' | |||
|
440 | 440 | |
|
441 | 441 | <div class="annotate-info"> |
|
442 | 442 | <div> |
|
443 |
<a href="/annotate/ |
|
|
444 | 1af356141006</a> | |
|
443 | <a href="/annotate/f4fca47b67e6/primes.py#l9"> | |
|
444 | f4fca47b67e6</a> | |
|
445 | 445 | a |
|
446 | 446 | </div> |
|
447 | 447 | <div><em>test</em></div> |
|
448 | 448 | <div>parents: </div> |
|
449 |
<a href="/diff/ |
|
|
450 |
<a href="/rev/ |
|
|
449 | <a href="/diff/f4fca47b67e6/primes.py">diff</a> | |
|
450 | <a href="/rev/f4fca47b67e6">changeset</a> | |
|
451 | 451 | </div> |
|
452 | 452 | </td> |
|
453 | 453 | <td class="source followlines-btn-parent"><a href="#l9"> 9</a> <span class="kn">def</span> <span class="nf">primes</span><span class="p">():</span></td> |
@@ -457,14 +457,14 b' hgweb fileannotate, html' | |||
|
457 | 457 | |
|
458 | 458 | <div class="annotate-info"> |
|
459 | 459 | <div> |
|
460 |
<a href="/annotate/ |
|
|
461 | 1af356141006</a> | |
|
460 | <a href="/annotate/f4fca47b67e6/primes.py#l10"> | |
|
461 | f4fca47b67e6</a> | |
|
462 | 462 | a |
|
463 | 463 | </div> |
|
464 | 464 | <div><em>test</em></div> |
|
465 | 465 | <div>parents: </div> |
|
466 |
<a href="/diff/ |
|
|
467 |
<a href="/rev/ |
|
|
466 | <a href="/diff/f4fca47b67e6/primes.py">diff</a> | |
|
467 | <a href="/rev/f4fca47b67e6">changeset</a> | |
|
468 | 468 | </div> |
|
469 | 469 | </td> |
|
470 | 470 | <td class="source followlines-btn-parent"><a href="#l10"> 10</a> <span class="sd">"""Generate all primes."""</span></td> |
@@ -474,14 +474,14 b' hgweb fileannotate, html' | |||
|
474 | 474 | |
|
475 | 475 | <div class="annotate-info"> |
|
476 | 476 | <div> |
|
477 |
<a href="/annotate/ |
|
|
478 | 1af356141006</a> | |
|
477 | <a href="/annotate/f4fca47b67e6/primes.py#l11"> | |
|
478 | f4fca47b67e6</a> | |
|
479 | 479 | a |
|
480 | 480 | </div> |
|
481 | 481 | <div><em>test</em></div> |
|
482 | 482 | <div>parents: </div> |
|
483 |
<a href="/diff/ |
|
|
484 |
<a href="/rev/ |
|
|
483 | <a href="/diff/f4fca47b67e6/primes.py">diff</a> | |
|
484 | <a href="/rev/f4fca47b67e6">changeset</a> | |
|
485 | 485 | </div> |
|
486 | 486 | </td> |
|
487 | 487 | <td class="source followlines-btn-parent"><a href="#l11"> 11</a> <span class="kn">def</span> <span class="nf">sieve</span><span class="p">(</span><span class="n">ns</span><span class="p">):</span></td> |
@@ -491,14 +491,14 b' hgweb fileannotate, html' | |||
|
491 | 491 | |
|
492 | 492 | <div class="annotate-info"> |
|
493 | 493 | <div> |
|
494 |
<a href="/annotate/ |
|
|
495 | 1af356141006</a> | |
|
494 | <a href="/annotate/f4fca47b67e6/primes.py#l12"> | |
|
495 | f4fca47b67e6</a> | |
|
496 | 496 | a |
|
497 | 497 | </div> |
|
498 | 498 | <div><em>test</em></div> |
|
499 | 499 | <div>parents: </div> |
|
500 |
<a href="/diff/ |
|
|
501 |
<a href="/rev/ |
|
|
500 | <a href="/diff/f4fca47b67e6/primes.py">diff</a> | |
|
501 | <a href="/rev/f4fca47b67e6">changeset</a> | |
|
502 | 502 | </div> |
|
503 | 503 | </td> |
|
504 | 504 | <td class="source followlines-btn-parent"><a href="#l12"> 12</a> <span class="n">p</span> <span class="o">=</span> <span class="n">ns</span><span class="o">.</span><span class="n">next</span><span class="p">()</span></td> |
@@ -508,14 +508,14 b' hgweb fileannotate, html' | |||
|
508 | 508 | |
|
509 | 509 | <div class="annotate-info"> |
|
510 | 510 | <div> |
|
511 |
<a href="/annotate/ |
|
|
512 | 1af356141006</a> | |
|
511 | <a href="/annotate/f4fca47b67e6/primes.py#l13"> | |
|
512 | f4fca47b67e6</a> | |
|
513 | 513 | a |
|
514 | 514 | </div> |
|
515 | 515 | <div><em>test</em></div> |
|
516 | 516 | <div>parents: </div> |
|
517 |
<a href="/diff/ |
|
|
518 |
<a href="/rev/ |
|
|
517 | <a href="/diff/f4fca47b67e6/primes.py">diff</a> | |
|
518 | <a href="/rev/f4fca47b67e6">changeset</a> | |
|
519 | 519 | </div> |
|
520 | 520 | </td> |
|
521 | 521 | <td class="source followlines-btn-parent"><a href="#l13"> 13</a> <span class="c"># It is important to yield *here* in order to stop the</span></td> |
@@ -525,14 +525,14 b' hgweb fileannotate, html' | |||
|
525 | 525 | |
|
526 | 526 | <div class="annotate-info"> |
|
527 | 527 | <div> |
|
528 |
<a href="/annotate/ |
|
|
529 | 1af356141006</a> | |
|
528 | <a href="/annotate/f4fca47b67e6/primes.py#l14"> | |
|
529 | f4fca47b67e6</a> | |
|
530 | 530 | a |
|
531 | 531 | </div> |
|
532 | 532 | <div><em>test</em></div> |
|
533 | 533 | <div>parents: </div> |
|
534 |
<a href="/diff/ |
|
|
535 |
<a href="/rev/ |
|
|
534 | <a href="/diff/f4fca47b67e6/primes.py">diff</a> | |
|
535 | <a href="/rev/f4fca47b67e6">changeset</a> | |
|
536 | 536 | </div> |
|
537 | 537 | </td> |
|
538 | 538 | <td class="source followlines-btn-parent"><a href="#l14"> 14</a> <span class="c"># infinite recursion.</span></td> |
@@ -542,14 +542,14 b' hgweb fileannotate, html' | |||
|
542 | 542 | |
|
543 | 543 | <div class="annotate-info"> |
|
544 | 544 | <div> |
|
545 |
<a href="/annotate/ |
|
|
546 | 1af356141006</a> | |
|
545 | <a href="/annotate/f4fca47b67e6/primes.py#l15"> | |
|
546 | f4fca47b67e6</a> | |
|
547 | 547 | a |
|
548 | 548 | </div> |
|
549 | 549 | <div><em>test</em></div> |
|
550 | 550 | <div>parents: </div> |
|
551 |
<a href="/diff/ |
|
|
552 |
<a href="/rev/ |
|
|
551 | <a href="/diff/f4fca47b67e6/primes.py">diff</a> | |
|
552 | <a href="/rev/f4fca47b67e6">changeset</a> | |
|
553 | 553 | </div> |
|
554 | 554 | </td> |
|
555 | 555 | <td class="source followlines-btn-parent"><a href="#l15"> 15</a> <span class="kn">yield</span> <span class="n">p</span></td> |
@@ -559,14 +559,14 b' hgweb fileannotate, html' | |||
|
559 | 559 | |
|
560 | 560 | <div class="annotate-info"> |
|
561 | 561 | <div> |
|
562 |
<a href="/annotate/ |
|
|
563 | 1af356141006</a> | |
|
562 | <a href="/annotate/f4fca47b67e6/primes.py#l16"> | |
|
563 | f4fca47b67e6</a> | |
|
564 | 564 | a |
|
565 | 565 | </div> |
|
566 | 566 | <div><em>test</em></div> |
|
567 | 567 | <div>parents: </div> |
|
568 |
<a href="/diff/ |
|
|
569 |
<a href="/rev/ |
|
|
568 | <a href="/diff/f4fca47b67e6/primes.py">diff</a> | |
|
569 | <a href="/rev/f4fca47b67e6">changeset</a> | |
|
570 | 570 | </div> |
|
571 | 571 | </td> |
|
572 | 572 | <td class="source followlines-btn-parent"><a href="#l16"> 16</a> <span class="n">ns</span> <span class="o">=</span> <span class="n">ifilter</span><span class="p">(</span><span class="kn">lambda</span> <span class="n">n</span><span class="p">:</span> <span class="n">n</span> <span class="o">%</span> <span class="n">p</span> <span class="o">!=</span> <span class="mi">0</span><span class="p">,</span> <span class="n">ns</span><span class="p">)</span></td> |
@@ -576,14 +576,14 b' hgweb fileannotate, html' | |||
|
576 | 576 | |
|
577 | 577 | <div class="annotate-info"> |
|
578 | 578 | <div> |
|
579 |
<a href="/annotate/ |
|
|
580 | 1af356141006</a> | |
|
579 | <a href="/annotate/f4fca47b67e6/primes.py#l17"> | |
|
580 | f4fca47b67e6</a> | |
|
581 | 581 | a |
|
582 | 582 | </div> |
|
583 | 583 | <div><em>test</em></div> |
|
584 | 584 | <div>parents: </div> |
|
585 |
<a href="/diff/ |
|
|
586 |
<a href="/rev/ |
|
|
585 | <a href="/diff/f4fca47b67e6/primes.py">diff</a> | |
|
586 | <a href="/rev/f4fca47b67e6">changeset</a> | |
|
587 | 587 | </div> |
|
588 | 588 | </td> |
|
589 | 589 | <td class="source followlines-btn-parent"><a href="#l17"> 17</a> <span class="kn">for</span> <span class="n">n</span> <span class="ow">in</span> <span class="n">sieve</span><span class="p">(</span><span class="n">ns</span><span class="p">):</span></td> |
@@ -593,14 +593,14 b' hgweb fileannotate, html' | |||
|
593 | 593 | |
|
594 | 594 | <div class="annotate-info"> |
|
595 | 595 | <div> |
|
596 |
<a href="/annotate/ |
|
|
597 | 1af356141006</a> | |
|
596 | <a href="/annotate/f4fca47b67e6/primes.py#l18"> | |
|
597 | f4fca47b67e6</a> | |
|
598 | 598 | a |
|
599 | 599 | </div> |
|
600 | 600 | <div><em>test</em></div> |
|
601 | 601 | <div>parents: </div> |
|
602 |
<a href="/diff/ |
|
|
603 |
<a href="/rev/ |
|
|
602 | <a href="/diff/f4fca47b67e6/primes.py">diff</a> | |
|
603 | <a href="/rev/f4fca47b67e6">changeset</a> | |
|
604 | 604 | </div> |
|
605 | 605 | </td> |
|
606 | 606 | <td class="source followlines-btn-parent"><a href="#l18"> 18</a> <span class="kn">yield</span> <span class="n">n</span></td> |
@@ -610,14 +610,14 b' hgweb fileannotate, html' | |||
|
610 | 610 | |
|
611 | 611 | <div class="annotate-info"> |
|
612 | 612 | <div> |
|
613 |
<a href="/annotate/ |
|
|
614 | 1af356141006</a> | |
|
613 | <a href="/annotate/f4fca47b67e6/primes.py#l19"> | |
|
614 | f4fca47b67e6</a> | |
|
615 | 615 | a |
|
616 | 616 | </div> |
|
617 | 617 | <div><em>test</em></div> |
|
618 | 618 | <div>parents: </div> |
|
619 |
<a href="/diff/ |
|
|
620 |
<a href="/rev/ |
|
|
619 | <a href="/diff/f4fca47b67e6/primes.py">diff</a> | |
|
620 | <a href="/rev/f4fca47b67e6">changeset</a> | |
|
621 | 621 | </div> |
|
622 | 622 | </td> |
|
623 | 623 | <td class="source followlines-btn-parent"><a href="#l19"> 19</a> </td> |
@@ -627,14 +627,14 b' hgweb fileannotate, html' | |||
|
627 | 627 | |
|
628 | 628 | <div class="annotate-info"> |
|
629 | 629 | <div> |
|
630 |
<a href="/annotate/ |
|
|
631 | 1af356141006</a> | |
|
630 | <a href="/annotate/f4fca47b67e6/primes.py#l20"> | |
|
631 | f4fca47b67e6</a> | |
|
632 | 632 | a |
|
633 | 633 | </div> |
|
634 | 634 | <div><em>test</em></div> |
|
635 | 635 | <div>parents: </div> |
|
636 |
<a href="/diff/ |
|
|
637 |
<a href="/rev/ |
|
|
636 | <a href="/diff/f4fca47b67e6/primes.py">diff</a> | |
|
637 | <a href="/rev/f4fca47b67e6">changeset</a> | |
|
638 | 638 | </div> |
|
639 | 639 | </td> |
|
640 | 640 | <td class="source followlines-btn-parent"><a href="#l20"> 20</a> <span class="n">odds</span> <span class="o">=</span> <span class="n">ifilter</span><span class="p">(</span><span class="kn">lambda</span> <span class="n">i</span><span class="p">:</span> <span class="n">i</span> <span class="o">%</span> <span class="mi">2</span> <span class="o">==</span> <span class="mi">1</span><span class="p">,</span> <span class="n">count</span><span class="p">())</span></td> |
@@ -644,14 +644,14 b' hgweb fileannotate, html' | |||
|
644 | 644 | |
|
645 | 645 | <div class="annotate-info"> |
|
646 | 646 | <div> |
|
647 |
<a href="/annotate/ |
|
|
648 | 1af356141006</a> | |
|
647 | <a href="/annotate/f4fca47b67e6/primes.py#l21"> | |
|
648 | f4fca47b67e6</a> | |
|
649 | 649 | a |
|
650 | 650 | </div> |
|
651 | 651 | <div><em>test</em></div> |
|
652 | 652 | <div>parents: </div> |
|
653 |
<a href="/diff/ |
|
|
654 |
<a href="/rev/ |
|
|
653 | <a href="/diff/f4fca47b67e6/primes.py">diff</a> | |
|
654 | <a href="/rev/f4fca47b67e6">changeset</a> | |
|
655 | 655 | </div> |
|
656 | 656 | </td> |
|
657 | 657 | <td class="source followlines-btn-parent"><a href="#l21"> 21</a> <span class="kn">return</span> <span class="n">chain</span><span class="p">([</span><span class="mi">2</span><span class="p">],</span> <span class="n">sieve</span><span class="p">(</span><span class="n">dropwhile</span><span class="p">(</span><span class="kn">lambda</span> <span class="n">n</span><span class="p">:</span> <span class="n">n</span> <span class="o"><</span> <span class="mi">3</span><span class="p">,</span> <span class="n">odds</span><span class="p">)))</span></td> |
@@ -661,14 +661,14 b' hgweb fileannotate, html' | |||
|
661 | 661 | |
|
662 | 662 | <div class="annotate-info"> |
|
663 | 663 | <div> |
|
664 |
<a href="/annotate/ |
|
|
665 | 1af356141006</a> | |
|
664 | <a href="/annotate/f4fca47b67e6/primes.py#l22"> | |
|
665 | f4fca47b67e6</a> | |
|
666 | 666 | a |
|
667 | 667 | </div> |
|
668 | 668 | <div><em>test</em></div> |
|
669 | 669 | <div>parents: </div> |
|
670 |
<a href="/diff/ |
|
|
671 |
<a href="/rev/ |
|
|
670 | <a href="/diff/f4fca47b67e6/primes.py">diff</a> | |
|
671 | <a href="/rev/f4fca47b67e6">changeset</a> | |
|
672 | 672 | </div> |
|
673 | 673 | </td> |
|
674 | 674 | <td class="source followlines-btn-parent"><a href="#l22"> 22</a> </td> |
@@ -678,14 +678,14 b' hgweb fileannotate, html' | |||
|
678 | 678 | |
|
679 | 679 | <div class="annotate-info"> |
|
680 | 680 | <div> |
|
681 |
<a href="/annotate/ |
|
|
682 | 1af356141006</a> | |
|
681 | <a href="/annotate/f4fca47b67e6/primes.py#l23"> | |
|
682 | f4fca47b67e6</a> | |
|
683 | 683 | a |
|
684 | 684 | </div> |
|
685 | 685 | <div><em>test</em></div> |
|
686 | 686 | <div>parents: </div> |
|
687 |
<a href="/diff/ |
|
|
688 |
<a href="/rev/ |
|
|
687 | <a href="/diff/f4fca47b67e6/primes.py">diff</a> | |
|
688 | <a href="/rev/f4fca47b67e6">changeset</a> | |
|
689 | 689 | </div> |
|
690 | 690 | </td> |
|
691 | 691 | <td class="source followlines-btn-parent"><a href="#l23"> 23</a> <span class="kn">if</span> <span class="n">__name__</span> <span class="o">==</span> <span class="s">"__main__"</span><span class="p">:</span></td> |
@@ -695,14 +695,14 b' hgweb fileannotate, html' | |||
|
695 | 695 | |
|
696 | 696 | <div class="annotate-info"> |
|
697 | 697 | <div> |
|
698 |
<a href="/annotate/ |
|
|
699 | 1af356141006</a> | |
|
698 | <a href="/annotate/f4fca47b67e6/primes.py#l24"> | |
|
699 | f4fca47b67e6</a> | |
|
700 | 700 | a |
|
701 | 701 | </div> |
|
702 | 702 | <div><em>test</em></div> |
|
703 | 703 | <div>parents: </div> |
|
704 |
<a href="/diff/ |
|
|
705 |
<a href="/rev/ |
|
|
704 | <a href="/diff/f4fca47b67e6/primes.py">diff</a> | |
|
705 | <a href="/rev/f4fca47b67e6">changeset</a> | |
|
706 | 706 | </div> |
|
707 | 707 | </td> |
|
708 | 708 | <td class="source followlines-btn-parent"><a href="#l24"> 24</a> <span class="kn">import</span> <span class="nn">sys</span></td> |
@@ -712,14 +712,14 b' hgweb fileannotate, html' | |||
|
712 | 712 | |
|
713 | 713 | <div class="annotate-info"> |
|
714 | 714 | <div> |
|
715 |
<a href="/annotate/ |
|
|
716 | 1af356141006</a> | |
|
715 | <a href="/annotate/f4fca47b67e6/primes.py#l25"> | |
|
716 | f4fca47b67e6</a> | |
|
717 | 717 | a |
|
718 | 718 | </div> |
|
719 | 719 | <div><em>test</em></div> |
|
720 | 720 | <div>parents: </div> |
|
721 |
<a href="/diff/ |
|
|
722 |
<a href="/rev/ |
|
|
721 | <a href="/diff/f4fca47b67e6/primes.py">diff</a> | |
|
722 | <a href="/rev/f4fca47b67e6">changeset</a> | |
|
723 | 723 | </div> |
|
724 | 724 | </td> |
|
725 | 725 | <td class="source followlines-btn-parent"><a href="#l25"> 25</a> <span class="kn">try</span><span class="p">:</span></td> |
@@ -729,14 +729,14 b' hgweb fileannotate, html' | |||
|
729 | 729 | |
|
730 | 730 | <div class="annotate-info"> |
|
731 | 731 | <div> |
|
732 |
<a href="/annotate/ |
|
|
733 | 1af356141006</a> | |
|
732 | <a href="/annotate/f4fca47b67e6/primes.py#l26"> | |
|
733 | f4fca47b67e6</a> | |
|
734 | 734 | a |
|
735 | 735 | </div> |
|
736 | 736 | <div><em>test</em></div> |
|
737 | 737 | <div>parents: </div> |
|
738 |
<a href="/diff/ |
|
|
739 |
<a href="/rev/ |
|
|
738 | <a href="/diff/f4fca47b67e6/primes.py">diff</a> | |
|
739 | <a href="/rev/f4fca47b67e6">changeset</a> | |
|
740 | 740 | </div> |
|
741 | 741 | </td> |
|
742 | 742 | <td class="source followlines-btn-parent"><a href="#l26"> 26</a> <span class="n">n</span> <span class="o">=</span> <span class="nb">int</span><span class="p">(</span><span class="n">sys</span><span class="o">.</span><span class="n">argv</span><span class="p">[</span><span class="mi">1</span><span class="p">])</span></td> |
@@ -746,14 +746,14 b' hgweb fileannotate, html' | |||
|
746 | 746 | |
|
747 | 747 | <div class="annotate-info"> |
|
748 | 748 | <div> |
|
749 |
<a href="/annotate/ |
|
|
750 | 1af356141006</a> | |
|
749 | <a href="/annotate/f4fca47b67e6/primes.py#l27"> | |
|
750 | f4fca47b67e6</a> | |
|
751 | 751 | a |
|
752 | 752 | </div> |
|
753 | 753 | <div><em>test</em></div> |
|
754 | 754 | <div>parents: </div> |
|
755 |
<a href="/diff/ |
|
|
756 |
<a href="/rev/ |
|
|
755 | <a href="/diff/f4fca47b67e6/primes.py">diff</a> | |
|
756 | <a href="/rev/f4fca47b67e6">changeset</a> | |
|
757 | 757 | </div> |
|
758 | 758 | </td> |
|
759 | 759 | <td class="source followlines-btn-parent"><a href="#l27"> 27</a> <span class="kn">except</span> <span class="p">(</span><span class="ne">ValueError</span><span class="p">,</span> <span class="ne">IndexError</span><span class="p">):</span></td> |
@@ -763,14 +763,14 b' hgweb fileannotate, html' | |||
|
763 | 763 | |
|
764 | 764 | <div class="annotate-info"> |
|
765 | 765 | <div> |
|
766 |
<a href="/annotate/ |
|
|
767 | 1af356141006</a> | |
|
766 | <a href="/annotate/f4fca47b67e6/primes.py#l28"> | |
|
767 | f4fca47b67e6</a> | |
|
768 | 768 | a |
|
769 | 769 | </div> |
|
770 | 770 | <div><em>test</em></div> |
|
771 | 771 | <div>parents: </div> |
|
772 |
<a href="/diff/ |
|
|
773 |
<a href="/rev/ |
|
|
772 | <a href="/diff/f4fca47b67e6/primes.py">diff</a> | |
|
773 | <a href="/rev/f4fca47b67e6">changeset</a> | |
|
774 | 774 | </div> |
|
775 | 775 | </td> |
|
776 | 776 | <td class="source followlines-btn-parent"><a href="#l28"> 28</a> <span class="n">n</span> <span class="o">=</span> <span class="mi">10</span></td> |
@@ -780,14 +780,14 b' hgweb fileannotate, html' | |||
|
780 | 780 | |
|
781 | 781 | <div class="annotate-info"> |
|
782 | 782 | <div> |
|
783 |
<a href="/annotate/ |
|
|
784 | 1af356141006</a> | |
|
783 | <a href="/annotate/f4fca47b67e6/primes.py#l29"> | |
|
784 | f4fca47b67e6</a> | |
|
785 | 785 | a |
|
786 | 786 | </div> |
|
787 | 787 | <div><em>test</em></div> |
|
788 | 788 | <div>parents: </div> |
|
789 |
<a href="/diff/ |
|
|
790 |
<a href="/rev/ |
|
|
789 | <a href="/diff/f4fca47b67e6/primes.py">diff</a> | |
|
790 | <a href="/rev/f4fca47b67e6">changeset</a> | |
|
791 | 791 | </div> |
|
792 | 792 | </td> |
|
793 | 793 | <td class="source followlines-btn-parent"><a href="#l29"> 29</a> <span class="n">p</span> <span class="o">=</span> <span class="n">primes</span><span class="p">()</span></td> |
@@ -797,31 +797,31 b' hgweb fileannotate, html' | |||
|
797 | 797 | |
|
798 | 798 | <div class="annotate-info"> |
|
799 | 799 | <div> |
|
800 |
<a href="/annotate/ |
|
|
801 | 1af356141006</a> | |
|
800 | <a href="/annotate/f4fca47b67e6/primes.py#l30"> | |
|
801 | f4fca47b67e6</a> | |
|
802 | 802 | a |
|
803 | 803 | </div> |
|
804 | 804 | <div><em>test</em></div> |
|
805 | 805 | <div>parents: </div> |
|
806 |
<a href="/diff/ |
|
|
807 |
<a href="/rev/ |
|
|
806 | <a href="/diff/f4fca47b67e6/primes.py">diff</a> | |
|
807 | <a href="/rev/f4fca47b67e6">changeset</a> | |
|
808 | 808 | </div> |
|
809 | 809 | </td> |
|
810 | <td class="source followlines-btn-parent"><a href="#l30"> 30</a> <span class="kn">print</span> <span class="s">"The first </span><span class="si">%d</span><span class="s"> primes: </span><span class="si">%s</span><span class="s">"</span> <span class="o">%</span> <span class="p">(</span><span class="n">n</span><span class="p">,</span> <span class="nb">list</span><span class="p">(</span><span class="n">islice</span><span class="p">(</span><span class="n">p</span><span class="p">,</span> <span class="n">n</span><span class="p">)))</span></td> | |
|
810 | <td class="source followlines-btn-parent"><a href="#l30"> 30</a> <span class="kn">print</span><span class="p">(</span><span class="s">"The first </span><span class="si">%d</span><span class="s"> primes: </span><span class="si">%s</span><span class="s">"</span> <span class="o">%</span> <span class="p">(</span><span class="n">n</span><span class="p">,</span> <span class="nb">list</span><span class="p">(</span><span class="n">islice</span><span class="p">(</span><span class="n">p</span><span class="p">,</span> <span class="n">n</span><span class="p">))))</span></td> | |
|
811 | 811 | </tr> |
|
812 | 812 | <tr id="l31" class="thisrev"> |
|
813 | 813 | <td class="annotate parity0"> |
|
814 | 814 | |
|
815 | 815 | <div class="annotate-info"> |
|
816 | 816 | <div> |
|
817 |
<a href="/annotate/ |
|
|
818 | 1af356141006</a> | |
|
817 | <a href="/annotate/f4fca47b67e6/primes.py#l31"> | |
|
818 | f4fca47b67e6</a> | |
|
819 | 819 | a |
|
820 | 820 | </div> |
|
821 | 821 | <div><em>test</em></div> |
|
822 | 822 | <div>parents: </div> |
|
823 |
<a href="/diff/ |
|
|
824 |
<a href="/rev/ |
|
|
823 | <a href="/diff/f4fca47b67e6/primes.py">diff</a> | |
|
824 | <a href="/rev/f4fca47b67e6">changeset</a> | |
|
825 | 825 | </div> |
|
826 | 826 | </td> |
|
827 | 827 | <td class="source followlines-btn-parent"><a href="#l31"> 31</a> </td> |
General Comments 0
You need to be logged in to leave comments.
Login now