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