1<!DOCTYPE html> 2<html> 3<head> 4 <meta charset="utf-8"> 5<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"> 6 7 8 9<title> 10 11 Tag: FPT 12 13</title> 14 15<meta property="og:type" content="website"> 16<meta property="og:title"> 17<meta property="og:url" content="http://mpkocher.github.io/tags/FPT/index.html"> 18<meta property="og:site_name"> 19<meta property="og:locale" content="en_US"> 20<meta name="twitter:card" content="summary"> 21<meta name="twitter:creator" content="@https://twitter.com/ElevenPhonons"> 22 23 24 <link rel="alternative" href="/atom.xml" title="" type="application/atom+xml"> 25 26 27 28 <link rel="icon" href="/favicon.png"> 29 30 31 32<link rel="stylesheet" href="/perfect-scrollbar/css/perfect-scrollbar.min.css"> 33 34 35<link rel="stylesheet" href="/styles/main.css"> 36 37 38 39 <!-- Google Analytics --> 40
40<script type="text/javascript">
vendor: 349 bytes, lines 40-46
40 41 (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ 42 (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), 43 m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) 44 })(window,document,'script','//www.google-analytics.com/analytics.js','ga'); 45 46 ga('create', '
46UA-141397134-1
vendor: 43 bytes, lines 46-49
46', 'auto'); 47 ga('send', 'pageview'); 48 49
49</script>
49 50 <!-- End Google Analytics --> 51 52 53 54 55 56<meta name="generator" content="Hexo 6.2.0"></head> 57<body 58 59 class="monochrome" 60 61 > 62 <div class="mobile-header"> 63 <button class="sidebar-toggle" type="button"> 64 <span class="icon-bar"></span> 65 <span class="icon-bar"></span> 66 <span class="icon-bar"></span> 67 </button> 68 <a class="title" href="/"></a> 69</div> 70 71 <div class="main-container"> 72 <div class="sidebar"> 73 <div class="header"> 74 <h1 class="title"><a href="/"></a></h1> 75 76 <div class="info"> 77 <div class="content"> 78 79 80 </div> 81 82 <div class="avatar"> 83 84 <a href="/2017/09/04/About"><img src="https://avatars3.githubusercontent.com/u/868552?v=4&s=460"></a> 85 86 </div> 87 88 </div> 89 </div> 90 <div class="body"> 91 92 93 <ul class="nav"> 94 95 96 <li class="tag-list-container"> 97 <a href="javascript:;">Tag</a> 98 <ul class="tag-list" itemprop="keywords"><li class="tag-list-item"><a class="tag-list-link" href="/tags/FPT/" rel="tag">FPT</a><span class="tag-list-count">5</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/functional/" rel="tag">functional</a><span class="tag-list-count">5</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/lbl/" rel="tag">lbl</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/materials-project/" rel="tag">materials-project</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/mypy/" rel="tag">mypy</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/pacbio/" rel="tag">pacbio</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/python/" rel="tag">python</a><span class="tag-list-count">10</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/scala/" rel="tag">scala</a><span class="tag-list-count">2</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/scala-cli/" rel="tag">scala-cli</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/series/" rel="tag">series</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/zio/" rel="tag">zio</a><span class="tag-list-count">1</span></li></ul> 99 </li> 100 101 102 103 <li class="archive-list-container"> 104 <a href="javascript:;">Archive</a> 105 <ul class="archive-list"><li class="archive-list-item"><a class="archive-list-link" href="/archives/2022/">2022</a><span class="archive-list-count">1</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2019/">2019</a><span class="archive-list-count">9</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2017/">2017</a><span class="archive-list-count">3</span></li></ul> 106 </li> 107 108 109 </ul> 110 111 <ul class="nav"> 112 113 114 <li> 115 <a href="/" title="Homepage" external="false">Homepage</a> 116 </li> 117 118 119 120 <li> 121 <a href="/archives" title="By Year" external="false">By Year</a> 122 </li> 123 124 125 126 <li> 127 <a href="/2019/03/01/Functional-Programming-Techniques-In-Python-Series/" title="Functional Programming Techniques in Python" external="false">Functional Programming Techniques in Python</a> 128 </li> 129 130 131 </ul> 132 133 <ul class="nav"> 134 135 136 <li> 137 <a href="/2017/09/04/About/" title="About" external="false">About</a> 138 </li> 139 140 141 142 <li> 143 <a href="https://github.com/mpkocher/cv/blob/master/academic/cv.pdf" title="CV" target="_blank" rel="noopener">CV</a> 144 </li> 145 146 147 148 <li> 149 <a href="https://github.com/mpkocher" title="Github" target="_blank" rel="noopener">Github</a> 150 </li> 151 152 153 154 <li> 155 <a href="https://gist.github.com/mpkocher" title="Gists" target="_blank" rel="noopener">Gists</a> 156 </li> 157 158 159 160 <li> 161 <a href="https://www.linkedin.com/in/michael-kocher-b4bba5122/" title="LinkedIn" target="_blank" rel="noopener">LinkedIn</a> 162 </li> 163 164 165 166 <li> 167 <a href="https://twitter.com/ElevenPhonons" title="Twitter" target="_blank" rel="noopener">Twitter</a> 168 </li> 169 170 171 172 <li> 173 <a href="/2017/09/04/Now" title="Now" external="false">Now</a> 174 </li> 175 176 177 178 <li> 179 <a href="/atom.xml" title="RSS" external="false">RSS</a> 180 </li> 181 182 183 </ul> 184 185 186 </div> 187</div> 188 189 <div class="main-content"> 190 191 <div style="max-width: 1000px"> 192 193 <h1>FPT</h1> 194 195 196 197 198 <div class="post-list"> 199 200 201 <div class="post-list-item article"> 202 <h3 class="article-header"> 203 <a href="/2019/03/01/Functional-Programming-Techniques-In-Python-Series/" > 204 Series: Functional Programming Techniques In Python 205</a> 206 207 </h3> 208 209 210 <div class="article-info"> 211 <a href="/2019/03/01/Functional-Programming-Techniques-In-Python-Series/"><span class="article-date"> 212 2019-03-01 213</span> 214</a> 215 216 217 218 <span class="article-tag tagcloud"> 219 <ul class="article-tag-list" itemprop="keywords"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/FPT/" rel="tag">FPT</a></li><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/functional/" rel="tag">functional</a></li><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/python/" rel="tag">python</a></li><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/series/" rel="tag">series</a></li></ul> 220 </span> 221 222 223 </div> 224 <div class="article-entry"> 225 226 <p>This is a 4 Part Series that explores functional centric design style and patterns in Python.</p>
227<script src="//gist.github.com/9896022.js"></script>
227 228 229<p><a href="https://mpkocher.github.io/2019/01/30/Functional-Python-Part-1/">Part 1</a> (<a target="_blank" rel="noopener" href="https://gist.github.com/mpkocher/d1948e54c7863b1548ec4639df44b954">notebook</a>) starts with different mechanisms of how to define functions in Python and quickly moves to using <a target="_blank" rel="noopener" href="https://en.wikipedia.org/wiki/Closure_(computer_programming)">closures</a> and <code>functools.partial</code>. We then move on to adding <code>functools.reduce</code> and composition with <a target="_blank" rel="noopener" href="https://gist.github.com/mpkocher/9896022">compose</a> to our toolbox. Finally, we conclude with adding lazy <code>map</code> and <code>filter</code> to our toolbox and create a data pipeline that takes a stream of records to compute common statics using a max heap as the reducer. </p> 230<p>In <a href="https://mpkocher.github.io/2019/02/02/Functional-Python-Part-2/">Part 2</a> (<a target="_blank" rel="noopener" href="https://gist.github.com/mpkocher/517d9e72536346de505bff47199a9b24">notebook</a>), we explore building a REST client using functional-centric design style. Using an iterative approach, we build up a REST client using small functions leveraging clsoures and passing functions as first class citizens to methods. To conclude, we wrap the API and expose the REST client via a simple Python class.</p> 231<p><a href="https://mpkocher.github.io/2019/02/28/Functional-Python-Part-3/">Part 3</a> (<a target="_blank" rel="noopener" href="https://gist.github.com/mpkocher/4e261b38d8b1c76a7f6dd8e9a95a4873">notebook</a>) follows similarly to spirit to Part 2. We build a commandline interface leveraging <code>argparse</code> from the Python standard library. Sometimes libraries such as argparse can have rough edges or friction points in the API that introduce duplication or design issues. Part 3 focuses on iterative building up an expressive commandline interface to a subparser commandline tool using closures and functions to smooth out the rough edges of <code>argparse.</code>. Thereâs also examples of using a Strategy-ish pattern with type annotated functions to enable configuring logging as well as custom error handling. </p> 232<p><a href="https://mpkocher.github.io/2019/03/01/Functional-Python-Part-4/">Part 4</a> (<a target="_blank" rel="noopener" href="https://gist.github.com/mpkocher/88f01a6237df44a8a01b51fb58cbb544">notebook</a>) concludes with some gotchas with regards to scope in closures, a brief example of decorators and a few suggestions for leverging function-centric designs in your APIs or applications. </p> 233<p>If youâre a OO wizard, a Data Scientist/Analysist, or a backend dev, this series can be useful to add another design approach in your toolbelt to designing APIs or programs. </p> 234<p>Best to you and your Pythonâing!</p> 235 236 237 </div> 238 </div> 239 240 241 </div> 242 243 244 245 246 <div class="post-list"> 247 248 249 <div class="post-list-item article"> 250 <h3 class="article-header"> 251 <a href="/2019/03/01/Functional-Python-Part-4/" > 252 Functional Programming Techniques in Python Part 4 253</a> 254 255 </h3> 256 257 258 <div class="article-info"> 259 <a href="/2019/03/01/Functional-Python-Part-4/"><span class="article-date"> 260 2019-03-01 261</span> 262</a> 263 264 265 266 <span class="article-tag tagcloud"> 267 <ul class="article-tag-list" itemprop="keywords"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/FPT/" rel="tag">FPT</a></li><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/functional/" rel="tag">functional</a></li><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/python/" rel="tag">python</a></li></ul> 268 </span> 269 270 271 </div> 272 <div class="article-entry"> 273 274 <p><a target="_blank" rel="noopener" href="https://gist.github.com/mpkocher/88f01a6237df44a8a01b51fb58cbb544">Functional Programming Techniques in Python Part 4</a></p>
275<script src="//gist.github.com/88f01a6237df44a8a01b51fb58cbb544.js"></script>
275 276 277 278 </div> 279 </div> 280 281 282 </div> 283 284 285 286 287 <div class="post-list"> 288 289 290 <div class="post-list-item article"> 291 <h3 class="article-header"> 292 <a href="/2019/02/28/Functional-Python-Part-3/" > 293 Functional Programming Techniques in Python Part 3 294</a> 295 296 </h3> 297 298 299 <div class="article-info"> 300 <a href="/2019/02/28/Functional-Python-Part-3/"><span class="article-date"> 301 2019-02-28 302</span> 303</a> 304 305 306 307 <span class="article-tag tagcloud"> 308 <ul class="article-tag-list" itemprop="keywords"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/FPT/" rel="tag">FPT</a></li><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/functional/" rel="tag">functional</a></li><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/python/" rel="tag">python</a></li></ul> 309 </span> 310 311 312 </div> 313 <div class="article-entry"> 314 315 <p><a target="_blank" rel="noopener" href="https://gist.github.com/mpkocher/4e261b38d8b1c76a7f6dd8e9a95a4873">Functional Programming Techniques in Python Part 3</a></p>
316<script src="//gist.github.com/4e261b38d8b1c76a7f6dd8e9a95a4873.js"></script>
316 317 318 319 </div> 320 </div> 321 322 323 </div> 324 325 326 327 328 <div class="post-list"> 329 330 331 <div class="post-list-item article"> 332 <h3 class="article-header"> 333 <a href="/2019/02/02/Functional-Python-Part-2/" > 334 Functional Programming Techniques in Python Part 2 335</a> 336 337 </h3> 338 339 340 <div class="article-info"> 341 <a href="/2019/02/02/Functional-Python-Part-2/"><span class="article-date"> 342 2019-02-02 343</span> 344</a> 345 346 347 348 <span class="article-tag tagcloud"> 349 <ul class="article-tag-list" itemprop="keywords"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/FPT/" rel="tag">FPT</a></li><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/functional/" rel="tag">functional</a></li><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/python/" rel="tag">python</a></li></ul> 350 </span> 351 352 353 </div> 354 <div class="article-entry"> 355 356 <p><a target="_blank" rel="noopener" href="https://gist.github.com/mpkocher/517d9e72536346de505bff47199a9b24">Functional Programming Techniques in Python Part 2</a></p>
357<script src="//gist.github.com/517d9e72536346de505bff47199a9b24.js"></script>
357 358 359 360 361 </div> 362 </div> 363 364 365 </div> 366 367 368 369 370 <div class="post-list"> 371 372 373 <div class="post-list-item article"> 374 <h3 class="article-header"> 375 <a href="/2019/01/30/Functional-Python-Part-1/" > 376 Functional Programming Techniques in Python Part 1 377</a> 378 379 </h3> 380 381 382 <div class="article-info"> 383 <a href="/2019/01/30/Functional-Python-Part-1/"><span class="article-date"> 384 2019-01-30 385</span> 386</a> 387 388 389 390 <span class="article-tag tagcloud"> 391 <ul class="article-tag-list" itemprop="keywords"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/FPT/" rel="tag">FPT</a></li><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/functional/" rel="tag">functional</a></li><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/python/" rel="tag">python</a></li></ul> 392 </span> 393 394 395 </div> 396 <div class="article-entry"> 397 398 <p><a target="_blank" rel="noopener" href="https://gist.github.com/mpkocher/d1948e54c7863b1548ec4639df44b954">Functional Programming Techniques in Python Part 1</a></p>
399<script src="//gist.github.com/d1948e54c7863b1548ec4639df44b954.js"></script>
399 400 401 402 403 404 405 406 407 408 409 </div> 410 </div> 411 412 413 </div> 414 415 416 417 418 419 420 421 <div class="main-footer"> 422 423 © 2022 - Powered by <a href="http://hexo.io" target="_blank">Hexo</a> - Theme <a href="https://github.com/denjones/hexo-theme-chan" target="_blank">Chan</a> 424 425</div> 426 427 428 </div> 429 430 </div> 431 </div> 432
433<script src="//apps.bdimg.com/libs/jquery/2.1.4/jquery.min.js"></script>
433 434 435 436 437<link rel="stylesheet" href="/PhotoSwipe/photoswipe.css"> 438 439 440<link rel="stylesheet" href="/PhotoSwipe/default-skin/default-skin.css"> 441 442 443 <!-- Root element of PhotoSwipe. Must have class pswp. --> 444 <div class="pswp" tabindex="-1" role="dialog" aria-hidden="true"> 445 446 <!-- Background of PhotoSwipe. 447 It's a separate element as animating opacity is faster than rgba(). --> 448 <div class="pswp__bg"></div> 449 450 <!-- Slides wrapper with overflow:hidden. --> 451 <div class="pswp__scroll-wrap"> 452 453 <!-- Container that holds slides. 454 PhotoSwipe keeps only 3 of them in the DOM to save memory. 455 Don't modify these 3 pswp__item elements, data is added later on. --> 456 <div class="pswp__container"> 457 <div class="pswp__item"></div> 458 <div class="pswp__item"></div> 459 <div class="pswp__item"></div> 460 </div> 461 462 <!-- Default (PhotoSwipeUI_Default) interface on top of sliding area. Can be changed. --> 463 <div class="pswp__ui pswp__ui--hidden"> 464 465 <div class="pswp__top-bar"> 466 467 <!-- Controls are self-explanatory. Order can be changed. --> 468 469 <div class="pswp__counter"></div> 470 471 <button class="pswp__button pswp__button--close" title="Close (Esc)"></button> 472 473 <button class="pswp__button pswp__button--share" title="Share"></button> 474 475 <button class="pswp__button pswp__button--fs" title="Toggle fullscreen"></button> 476 477 <button class="pswp__button pswp__button--zoom" title="Zoom in/out"></button> 478 479 <!-- Preloader demo http://codepen.io/dimsemenov/pen/yyBWoR --> 480 <!-- element will get class pswp__preloader--active when preloader is running --> 481 <div class="pswp__preloader"> 482 <div class="pswp__preloader__icn"> 483 <div class="pswp__preloader__cut"> 484 <div class="pswp__preloader__donut"></div> 485 </div> 486 </div> 487 </div> 488 </div> 489 490 <div class="pswp__share-modal pswp__share-modal--hidden pswp__single-tap"> 491 <div class="pswp__share-tooltip"></div> 492 </div> 493 494 <button class="pswp__button pswp__button--arrow--left" title="Previous (arrow left)"></button> 495 496 <button class="pswp__button pswp__button--arrow--right" title="Next (arrow right)"></button> 497 498 <div class="pswp__caption"> 499 <div class="pswp__caption__center"></div> 500 </div> 501 </div> 502 </div> 503 </div> 504 505
506<script src="/PhotoSwipe/photoswipe.js"></script>
506 507 508
509<script src="/PhotoSwipe/photoswipe-ui-default.js"></script>
509 510 511 512 513
514<script src="/perfect-scrollbar/js/min/perfect-scrollbar.min.js"></script>
514 515 516
517<script src="/scripts/main.js"></script>
517 518 519 520</body> 521</html>
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.