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 54
54
55
55
< body >
56
56
< header >
57
- < aside > August 1 , 2023</ aside >
57
+ < aside > August 2 , 2023</ aside >
58
58
< a href ="https://gto76.github.io " rel ="author "> Jure Šorn</ a >
59
59
</ header >
60
60
476
476
<el> = choice(<sequence>) < span class ="hljs-comment "> # Keeps the sequence intact.</ span >
477
477
</ code > </ pre > </ div >
478
478
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 >
480
480
<int> = int(< span class ="hljs-string "> '±<bin>'</ span > , < span class ="hljs-number "> 2</ span > ) < span class ="hljs-comment "> # Or: int('±<hex>', 16)</ span >
481
481
<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 >
482
482
<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
2930
2930
2931
2931
2932
2932
< footer >
2933
- < aside > August 1 , 2023</ aside >
2933
+ < aside > August 2 , 2023</ aside >
2934
2934
< a href ="https://gto76.github.io " rel ="author "> Jure Šorn</ a >
2935
2935
</ footer >
2936
2936
Original file line number Diff line number Diff line change @@ -44,6 +44,12 @@ const TOC =
44
44
'}\n' +
45
45
'</code></pre>\n' ;
46
46
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
+
47
53
const LRU_CACHE =
48
54
'<span class="hljs-keyword">from</span> functools <span class="hljs-keyword">import</span> lru_cache\n' +
49
55
'\n' +
@@ -800,6 +806,7 @@ function fixClasses() {
800
806
}
801
807
802
808
function fixHighlights ( ) {
809
+ $ ( `code:contains(<int> = ±0b<bin>)` ) . html ( BIN_HEX ) ;
803
810
$ ( `code:contains(@lru_cache(maxsize=None))` ) . html ( LRU_CACHE ) ;
804
811
$ ( `code:contains(@debug(print_result=True))` ) . html ( PARAMETRIZED_DECORATOR ) ;
805
812
$ ( `code:contains(print/str/repr([<el>]))` ) . html ( REPR_USE_CASES ) ;
You can’t perform that action at this time.
0 commit comments