Talk: Conor Hoekstra - Beautiful Python Refactoring

  Рет қаралды 24,470

PyCon US

PyCon US

Күн бұрын

Presented by:
Conor Hoekstra
Refactoring can lead to absolutely beautiful code. Not only this, but the refactoring itself can be a thing of beauty. This talk demonstrates taking an example with a double-digit number of lines of code down to a single-digit number of lines of code. This talk will show how to identify certain anti-patterns that can be replaced with more expressive and declarative code. This is a simple talk that can be understood by all, but when applied to one’s daily work can make a significant difference.
Talk slides and code: github.com/codereport/Talks/t...

Пікірлер: 28
@BernardCarney
@BernardCarney 4 жыл бұрын
Awesome talk! I went through a project I had been working on, and while I'm familiar with enumerate and comprehension, I fell for the same anti-patterns you had mentioned. Really thought this was a great talk for people at any level of programming.
@code_report
@code_report 4 жыл бұрын
Thanks! Glad you enjoyed the talk! I see this anti-pattern in code all the time. Many tutorials are written this way and it is pervasive within many programming languages, not just Python. It is very satisfying for me when ever I can refactor some ITM code to use an algorithm or a function or a conditional expression or something else : )
@bahramaghaei339
@bahramaghaei339 4 жыл бұрын
Thank you very much, it was very informative and enjoyable.
@code_report
@code_report 4 жыл бұрын
Thanks!
@udianilbey
@udianilbey 2 жыл бұрын
isnumeric usage introduces a side effect as "12.0".isnumeric() evaluates to false while int(12.0) evaluates to 12
@harshpatel105
@harshpatel105 4 жыл бұрын
Its amazing video. :) Thanks a lot!
@dejavukun
@dejavukun 4 жыл бұрын
Great talk as always!
@code_report
@code_report 4 жыл бұрын
Thanks! Glad you enjoyed it :)
@ehsan_kia
@ehsan_kia 4 жыл бұрын
I believe you want to use .isdigit() instead of .isnumeric(). The latter matches numbers in other languages, which int() wouldn't digest well.
@laike9m101
@laike9m101 4 жыл бұрын
I wonder what tool did the speaker use to make code transformation animation, really cool.
@map-creator
@map-creator 4 жыл бұрын
PowerPoint
@eddyecko94
@eddyecko94 4 жыл бұрын
Very good, c++ is my language of choice yet the ITM is something I’ve leavened
@MrG895
@MrG895 4 жыл бұрын
Nice job! Loved the enumerate callout and the structuring of list comprehensions with lambdas and smart tabbing to make it readable. What did you use for the visualizations? I like the color scheme and the language icons, but adding the latter seems hard for matplotlib or other code-based viz libraries.
@code_report
@code_report 4 жыл бұрын
I just use Microsoft PowerPoint :)
@triforce42
@triforce42 4 жыл бұрын
I loved the transitions and the content. What did you use to animate the slides? Revealjs? Can we see an example/source code?
@code_report
@code_report 4 жыл бұрын
There is no source code. Just Microsoft Powerpoint 2019
@taritgoswami3957
@taritgoswami3957 4 жыл бұрын
Great! I heard that using long one-liners hampers readability. How you made the animation of rearranging the code to the next slide?
@code_report
@code_report 4 жыл бұрын
Thanks! The slide deck is made with Microsoft PowerPoint 2019.
@ehsan_kia
@ehsan_kia 4 жыл бұрын
My personal rule is, it's okay to be a one-liner if it represents a single idea. Like a sentence. Sometimes I will actually explicitly split something into two statements if they read as separate actions. For example one in the video I don't agree with is merging `col[i][1].append` with the ternary operator. Converting the data and adding it to the column are two separate actions in my mind, and make more sense as two statements.
@kora5
@kora5 4 жыл бұрын
Beautiful transitions and animation. How do you create it?
@code_report
@code_report 4 жыл бұрын
Thanks! Microsoft Powerpoint 2019
@pybob
@pybob 4 жыл бұрын
@@code_report those animations are awesome, which feature of MS PP is that please?
@albertosanchez789
@albertosanchez789 4 жыл бұрын
Nice presentation and slides. The function names comparison between different languages (like the one in the minute 8:40) was taken from a public site?
@code_report
@code_report 4 жыл бұрын
It is a program that I personally wrote that I will be turning into a website within the next year.
@akshayjoshi4411
@akshayjoshi4411 4 жыл бұрын
What would you suggest to avoid ITM anti-pattern while fetching frames from webcam ?
@Glowackos
@Glowackos 3 жыл бұрын
What's the website from 8:53?
Talk: Dustin Ingram - Static Typing in Python
21:50
PyCon US
Рет қаралды 16 М.
Talk: Aly Sivji - If Statements are a Code Smell
30:38
PyCon US
Рет қаралды 13 М.
A little girl was shy at her first ballet lesson #shorts
00:35
Fabiosa Animated
Рет қаралды 15 МЛН
Can A Seed Grow In Your Nose? 🤔
00:33
Zack D. Films
Рет қаралды 23 МЛН
Beautiful Python Refactoring II - Conor Hoekstra - code::dive 2022
54:06
code::dive conference
Рет қаралды 4 М.
Talk: Harry Percival - Stop Using Mocks (for a while)
44:51
PyCon US
Рет қаралды 13 М.
Talk: Anthony Shaw - Why is Python slow?
32:52
PyCon US
Рет қаралды 21 М.
Keynote: The big leap of Python 3.13 - Łukasz Langa
30:56
PyCon Thailand
Рет қаралды 11 М.
A little girl was shy at her first ballet lesson #shorts
00:35
Fabiosa Animated
Рет қаралды 15 МЛН