File tree Expand file tree Collapse file tree 2 files changed +10
-4
lines changed Expand file tree Collapse file tree 2 files changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -2144,8 +2144,10 @@ sorted_by_second = sorted(<collection>, key=op.itemgetter(1))
2144
2144
sorted_by_both = sorted (< collection> , key = op.itemgetter(1 , 0 ))
2145
2145
product_of_elems = functools.reduce(op.mul, < collection> )
2146
2146
union_of_sets = functools.reduce(op.or_, < coll_of_sets> )
2147
- last_el = op.methodcaller(' pop' )(< list > )
2147
+ last_element = op.methodcaller(' pop' )(< list > )
2148
2148
```
2149
+ * ** Functions and\_ () and or\_ () correspond to operators '&' and '|'.**
2150
+ * ** They only work on objects with defined and() and or() special methods, ie. ints and sets.**
2149
2151
2150
2152
2151
2153
Introspection
Original file line number Diff line number Diff line change 226
226
227
227
< body >
228
228
< header >
229
- < aside > November 17 , 2021</ aside >
229
+ < aside > November 19 , 2021</ aside >
230
230
< a href ="https://gto76.github.io " rel ="author "> Jure Šorn</ a >
231
231
</ header >
232
232
1916
1916
sorted_by_both = sorted(<collection>, key=op.itemgetter(< span class ="hljs-number "> 1</ span > , < span class ="hljs-number "> 0</ span > ))
1917
1917
product_of_elems = functools.reduce(op.mul, <collection>)
1918
1918
union_of_sets = functools.reduce(op.or_, <coll_of_sets>)
1919
- last_el = op.methodcaller(< span class ="hljs-string "> 'pop'</ span > )(<list>)
1919
+ last_element = op.methodcaller(< span class ="hljs-string "> 'pop'</ span > )(<list>)
1920
1920
</ code > </ pre >
1921
+ < ul >
1922
+ < li > < strong > Functions and_() and or_() correspond to operators '&' and '|'.</ strong > </ li >
1923
+ < li > < strong > They only work on objects with defined and() and or() special methods, ie. ints and sets.</ strong > </ li >
1924
+ </ ul >
1921
1925
< div > < h2 id ="introspection "> < a href ="#introspection " name ="introspection "> #</ a > Introspection</ h2 > < p > < strong > Inspecting code at runtime.</ strong > </ p > < div > < h3 id ="variables "> Variables</ h3 > < pre > < code class ="python language-python hljs "> <list> = dir() < span class ="hljs-comment "> # Names of local variables (incl. functions).</ span >
1922
1926
<dict> = vars() < span class ="hljs-comment "> # Dict of local variables. Also locals().</ span >
1923
1927
<dict> = globals() < span class ="hljs-comment "> # Dict of global variables.</ span >
3020
3024
3021
3025
3022
3026
< footer >
3023
- < aside > November 17 , 2021</ aside >
3027
+ < aside > November 19 , 2021</ aside >
3024
3028
< a href ="https://gto76.github.io " rel ="author "> Jure Šorn</ a >
3025
3029
</ footer >
3026
3030
You can’t perform that action at this time.
0 commit comments