File tree Expand file tree Collapse file tree 2 files changed +10
-3
lines changed
Expand file tree Collapse file tree 2 files changed +10
-3
lines changed Original file line number Diff line number Diff line change 5454
5555< body >
5656 < header >
57- < aside > August 1 , 2023</ aside >
57+ < aside > August 2 , 2023</ aside >
5858 < a href ="https://gto76.github.io " rel ="author "> Jure Šorn</ a >
5959 </ header >
6060
476476<el> = choice(<sequence>) < span class ="hljs-comment "> # Keeps the sequence intact.</ span >
477477</ code > </ pre > </ div >
478478
479- < div > < h3 id ="binhex "> Bin, Hex</ h3 > < pre > < code class ="python language-python hljs "> <int> = ±< span class ="hljs-number "> 0 </ span > b <bin> < span class ="hljs-comment "> # Or: ±0x<hex></ span >
479+ < div > < h3 id ="binhex "> Bin, Hex</ h3 > < pre > < code class ="python language-python hljs "> <int> = ±< span class ="hljs-number "> 0b </ span > <bin> < span class ="hljs-comment "> # Or: ±0x<hex></ span >
480480<int> = int(< span class ="hljs-string "> '±<bin>'</ span > , < span class ="hljs-number "> 2</ span > ) < span class ="hljs-comment "> # Or: int('±<hex>', 16)</ span >
481481<int> = int(< span class ="hljs-string "> '±0b<bin>'</ span > , < span class ="hljs-number "> 0</ span > ) < span class ="hljs-comment "> # Or: int('±0x<hex>', 0)</ span >
482482<str> = bin(<int>) < span class ="hljs-comment "> # Returns '[-]0b<bin>'.</ span >
@@ -2930,7 +2930,7 @@ <h3 id="format-2">Format</h3><div><h4 id="forstandardtypesizesandmanualalignment
29302930
29312931
29322932 < footer >
2933- < aside > August 1 , 2023</ aside >
2933+ < aside > August 2 , 2023</ aside >
29342934 < a href ="https://gto76.github.io " rel ="author "> Jure Šorn</ a >
29352935 </ footer >
29362936
Original file line number Diff line number Diff line change @@ -44,6 +44,12 @@ const TOC =
4444 '}\n' +
4545 '</code></pre>\n' ;
4646
47+ const BIN_HEX =
48+ '<int> = ±<span class="hljs-number">0b</span><bin> <span class="hljs-comment"># Or: ±0x<hex></span>\n' +
49+ '<int> = int(<span class="hljs-string">\'±<bin>\'</span>, <span class="hljs-number">2</span>) <span class="hljs-comment"># Or: int(\'±<hex>\', 16)</span>\n' +
50+ '<int> = int(<span class="hljs-string">\'±0b<bin>\'</span>, <span class="hljs-number">0</span>) <span class="hljs-comment"># Or: int(\'±0x<hex>\', 0)</span>\n' +
51+ '<str> = bin(<int>) <span class="hljs-comment"># Returns \'[-]0b<bin>\'.</span>\n' ;
52+
4753const LRU_CACHE =
4854 '<span class="hljs-keyword">from</span> functools <span class="hljs-keyword">import</span> lru_cache\n' +
4955 '\n' +
@@ -800,6 +806,7 @@ function fixClasses() {
800806}
801807
802808function fixHighlights ( ) {
809+ $ ( `code:contains(<int> = ±0b<bin>)` ) . html ( BIN_HEX ) ;
803810 $ ( `code:contains(@lru_cache(maxsize=None))` ) . html ( LRU_CACHE ) ;
804811 $ ( `code:contains(@debug(print_result=True))` ) . html ( PARAMETRIZED_DECORATOR ) ;
805812 $ ( `code:contains(print/str/repr([<el>]))` ) . html ( REPR_USE_CASES ) ;
You can’t perform that action at this time.
0 commit comments