The Mental Game of Python - Raymond Hettinger

แชร์
ฝัง
  • เผยแพร่เมื่อ 12 ก.ค. 2024
  • This talk was presented at PyBay2019 - 4th annual Bay Area Regional Python conference. See pybay.com for more details about PyBay and click SHOW MORE for more information about this talk.
    Description
    or "Strategies learned from coaching, teaching, and StackOverflow"
    If you work with thousands of developers, ranging from the experienced to the aspirational, you can see what patterns of thought seem to confer success. Raymond shares what he’s seen that works best for developing problem solving skills, learning how to learn, how to get unstuck, and reliable strategies for managing complexity.
    The talk includes live coding examples to make these ideas concrete.
    Abstract
    Original slides:
    About the speaker
    Python core developer. Certified Public Accountant. Freelance programmer/consultant/trainer. Husband to Rachel. Father to Matthew.
    Sponsor Acknowledgement
    This and other PyBay2019 videos are via the help of our media partner AlphaVoice (www.alphavoice.io/)!
    #pybay #pybay2019 #python #python3
  • วิทยาศาสตร์และเทคโนโลยี

ความคิดเห็น • 105

  • @MrMartingale1
    @MrMartingale1 4 ปีที่แล้ว +251

    I am a simple man. I see Raymond Hettinger, I click like, play and save.

    • @SilvioFYT
      @SilvioFYT 4 ปีที่แล้ว +8

      Too many registers

    • @TheDragonAzz
      @TheDragonAzz 3 ปีที่แล้ว +7

      There must be a better way.

    • @chadwood7997
      @chadwood7997 2 ปีที่แล้ว

      Reliably, In that order.

    • @teamtoken
      @teamtoken 2 ปีที่แล้ว

      I ACTUALLY PREFER TO FAP

    • @RoamingAdhocrat
      @RoamingAdhocrat 2 ปีที่แล้ว

      i am a simple man. i see a rabbit, i catch it, i eat it. six months later i die of scurvy

  • @laggymax7098
    @laggymax7098 4 ปีที่แล้ว +74

    The occasional "uhh" is him running out of registers.

  • @DerekHohls
    @DerekHohls 4 ปีที่แล้ว +19

    There are teachers... and then there is Raymond!

  • @bernoulli9047
    @bernoulli9047 4 ปีที่แล้ว +38

    Holy heck, Raymond's talks are always jam packed with useful info--but the graph traversal idea at the end (1:04:57) deserves its own short lecture. What an awesome way of summarizing a strength of python.

  • @Diachron
    @Diachron 4 ปีที่แล้ว +119

    It's tragic that a great presentation about *reducing* cognitive load is impaired by the cognitive load *increase* induced by the video sync error.
    Edit: thanks to @Mathieu Loyer for calling out the corrected version:
    th-cam.com/video/Uwuv05aZ6ug/w-d-xo.html

    • @keshavnemeli
      @keshavnemeli 4 ปีที่แล้ว +1

      Lol the irony.

    • @ResonantFractal
      @ResonantFractal 4 ปีที่แล้ว

      so true

    • @Phoen1x883
      @Phoen1x883 4 ปีที่แล้ว +2

      @Mathieu Loyer absolute legend

    • @Phoen1x883
      @Phoen1x883 4 ปีที่แล้ว +3

      @Diachron, you should edit you comment to mention Mathieu's link in the replies. A lot of people might not expand the replies until well into the video, if ever.

    • @Diachron
      @Diachron 4 ปีที่แล้ว

      @@Phoen1x883 done. I wouldn't have noticed it if you didn't "@" me, thanks

  • @benwalsh2825
    @benwalsh2825 4 ปีที่แล้ว +52

    Chunking and Aliasing: 5:42
    Solve a related but simpler problem: 22:05
    Build classes independently: 36:03
    Repeat tasks manually until a pattern emerges: 47:27
    Consider OOP as a graph traversal -- Kaprekar Function: 1:04:25

  • @joseville
    @joseville 2 ปีที่แล้ว +1

    Watching this at 2x makes him sound like a game show host and I'm not complaining. Even more entertaining.

  • @EngIlya
    @EngIlya 4 ปีที่แล้ว +113

    Such a pity the code is out of sync with the speech. About 5 secs delayed.

    • @sentience2241
      @sentience2241 4 ปีที่แล้ว

      its fixed now :)

    • @sentience2241
      @sentience2241 4 ปีที่แล้ว

      @Anne Sofie Talleruphuus wauw im an idiot I read over the fact that the concern was with the code being out of sync instead of the audio. This indeed still is the case helas.

    • @tjk8007
      @tjk8007 4 ปีที่แล้ว

      @@sentience2241 Will this be fixed soon?

    • @sentience2241
      @sentience2241 4 ปีที่แล้ว

      @@tjk8007 Im not a staffer at pybay. The only solution I know would be to; first record the screen-share bit. second paste it in +-5 seconds after the start of the original video re-render and you should be fine.

    •  4 ปีที่แล้ว +4

      I find it interesting, looks like he has some kind of superpower. Writing code while keeping eye contact with the audience and checking the correctness here and there. (This level could have been probably achieved using a high amount of concentration)

  • @MultiSosnooley
    @MultiSosnooley 4 ปีที่แล้ว +20

    I don't understand why such great speakers have not enough time?! What is the reason to call them then?! Call James Powell, David Beazley and Raymond to one conference, give them a time and it will be a best day in your life. Speak talent counts A LOT!

    • @deadbeatffs
      @deadbeatffs 4 ปีที่แล้ว +11

      while i totally understand your point, I think that it is very crucial to give everybody the chance to have their equal share of time for the presentation. For professionals it is also required to read your own presentation, fit time limit and be aware of time limit to speed up, reduce the amount of jokes, or reduce the amount of input.

    • @foljs5858
      @foljs5858 4 ปีที่แล้ว +4

      "I think that it is very crucial to give everybody the chance to have their equal share of time for the presentation" WHY? Give presenters time based on the quality/value of their talk, not some a priori "equal share"

    • @heroe1486
      @heroe1486 3 หลายเดือนก่อน

      ​@@deadbeatffsNo it's not, the same you generally don't let rookies play the whole match in most sports. You give them a chance and if they're showing good results you may increase their play time. Same here.

    • @colinjacobs176
      @colinjacobs176 23 วันที่ผ่านมา

      @@heroe1486 I'm guessing you don't go to many conferences. Invited speakers usually get lots more time than contributed talks. But there is still a time limit and a schedule to keep. A professional practices the talk and makes sure to fit within the alotted time - be it 12 minutes, 30 or an hour.

  • @ArturdeSousaRocha
    @ArturdeSousaRocha 4 ปีที่แล้ว +27

    "I have come here to register and chunk... and I'm all out of registers."

  • @mujkocka
    @mujkocka 4 ปีที่แล้ว +5

    :-) best teacher ever! funny and so memorable.

  • @fandibataineh4586
    @fandibataineh4586 ปีที่แล้ว

    this lad is always amazing

  • @ericlifee7485
    @ericlifee7485 4 ปีที่แล้ว +2

    This is really good stuff, thank you.

  • @ashrasmun1
    @ashrasmun1 4 ปีที่แล้ว +2

    Fantastic lecture!
    BTW - you can tell he was stressed out because in the first 15 minutes his registers were on fire :)
    Example: 15:31 "there's too many, can I take it 0 to 1"

  • @medthehatta
    @medthehatta 4 ปีที่แล้ว +32

    Great talk! Too bad the demo video isn't synced with Raymond

    • @medthehatta
      @medthehatta 4 ปีที่แล้ว +5

      Played with it a bit, looks like like the demo video lags the audio by about 10 seconds, so if you wanna download and offset, that's approximately the value you need.

    • @techma82
      @techma82 3 ปีที่แล้ว +3

      @@medthehatta th-cam.com/video/Uwuv05aZ6ug/w-d-xo.html ;)

  • @SanataniAryavrat
    @SanataniAryavrat 4 ปีที่แล้ว +3

    every time i see the tutorials from him.... "Who Learned Something New", when he asks, in my mind I say, "I did, sir!"

  • @techma82
    @techma82 4 ปีที่แล้ว +25

    Here's a synced version: th-cam.com/video/Uwuv05aZ6ug/w-d-xo.html

    • @sadhlife
      @sadhlife 3 ปีที่แล้ว +1

      Underrated comment, thanks

    • @sameera11694
      @sameera11694 3 ปีที่แล้ว +2

      This is a saver man ! Thanks a ton !

  • @BreetaiZentradi
    @BreetaiZentradi 4 ปีที่แล้ว +7

    Learning much from it. The first section on chunking is also covered in the ancient book "Thinking FORTH". You build a program by giving each function a name, and creating functions with only 7 +/- 2 commands in them. The complexity is hidden in well named low level functions. Then all you do is speak a vocabulary of high-level functions.

    • @DrDeuteron
      @DrDeuteron 11 หลายเดือนก่อน

      I use the no scroll rule on function size

    • @BreetaiZentradi
      @BreetaiZentradi 11 หลายเดือนก่อน

      @@DrDeuteron An excellent way to flag you that your function may need to be refactored or you don't fully understand the problem at hand.

  • @eyebiofeedback
    @eyebiofeedback 4 ปีที่แล้ว +3

    Chunk it. Alias it. 7±2 Slots. This is great.

  • @vwwvwwwvwwwvwwvvwwvw
    @vwwvwwwvwwwvwwvvwwvw 3 ปีที่แล้ว

    The proposed solution in the Tree Walker example (around 23:00) is the function path_to(target, node) but path_to does not fully address the problem specification!
    The problem states: "Given a target find the path to it, starting with any node in a tree." The function path_to will only solve those problems when a target exists further down the tree than the given node; otherwise, path_to will not find the target!
    I propose changing the problem specification to "Given a target and a json document given as a Python object, find the path to it."

  • @sanjaymaniam
    @sanjaymaniam 4 ปีที่แล้ว +7

    There's an in-sync version on youtube: th-cam.com/video/Uwuv05aZ6ug/w-d-xo.html.

    • @MrMashyker
      @MrMashyker 4 ปีที่แล้ว

      Thank you very much!
      I just started fixing it on my own, but now I don't have to

    • @sanjaymaniam
      @sanjaymaniam 4 ปีที่แล้ว

      @@MrMashyker No problem!

    • @CodeOptimism
      @CodeOptimism 4 ปีที่แล้ว

      This comment needs to be pinned.

  • @mujkocka
    @mujkocka 11 หลายเดือนก่อน

    Love Feynman!

  • @DrDeuteron
    @DrDeuteron 11 หลายเดือนก่อน

    Nice to see a demo with no type hints i 2023

  • @user-zi2zv1jo7g
    @user-zi2zv1jo7g 4 หลายเดือนก่อน

    Watching all these does make me feel like I know something without actually doing anything lol

  • @nathanaeltrimm2720
    @nathanaeltrimm2720 ปีที่แล้ว +2

    If he’d watch Magnus Carlson or Hikaru play chess he’d know the top chess players think far more than 10 moves ahead.

    • @FoobsTon
      @FoobsTon 9 หลายเดือนก่อน

      They do in some complex situations but generally it's around 10 moves ahead. Rarely more than 15.

    • @heroe1486
      @heroe1486 3 หลายเดือนก่อน

      ​@@FoobsTonI'd say it might be the opposite, 15 moves in a complex position might be harder than 15 more or less forced moves in a final

    • @heroe1486
      @heroe1486 3 หลายเดือนก่อน

      Ok chat beshop C3 then rook e8 check check check check check check check check check check check check then king b2 rook b3 mate

  • @20x
    @20x ปีที่แล้ว

    I can't find the schedule but at the end they cut Raymond off. He's into it. The audience is into it. But sure, whatever, let's respect the next speaker's time.
    However, after his talk ends, the MC says to turn your chairs around but now it's time for a break? I really wish I could've got more insight on the graph traversal concepts at the end.
    PyBay doesn't exist on the web at the moment (April 2023 in case I have to edit this in a few years or whatever), so I cannot find this conference schedule and confirm this talk ended right before a break.
    I'll reply to my own comment if I ever find a Raymond Hettinger talk that goes into more depth on OOP as a graph!

  • @88fjoe
    @88fjoe 4 ปีที่แล้ว +9

    There’s gotta be a better way!

  • @thefunnybuddy4138
    @thefunnybuddy4138 4 ปีที่แล้ว +3

    5:53 Jigabytes
    I'm not alone.

  • @rupen42
    @rupen42 ปีที่แล้ว

    Oh damn, I really wanted to see him talk about sets and dicts over pandas.

  • @alexandarjelenic2880
    @alexandarjelenic2880 4 ปีที่แล้ว +12

    10 views and no likes yet? Come on guys! Raymond is our champion.

    • @atlantic_love
      @atlantic_love 3 ปีที่แล้ว

      Because the guy rambles on and on and on, that's why. He also acts like he's talking to children. Maybe he thinks his jokes are funny?

    • @alexandarjelenic2880
      @alexandarjelenic2880 3 ปีที่แล้ว

      Steven and Kristy , he is funny and he is heroic. We are kids compared to him.

  • @anibaldk
    @anibaldk 2 ปีที่แล้ว

    Raymond: "Can I get another minute and a half"
    Me: Jezzz...give him another full hour, please!!!

  • @C-Swede
    @C-Swede 4 ปีที่แล้ว +1

    It's very ironic that the video of a great talk about how to ease your mental load turned out to use an immense amount of registers because of a simple editing mistake. As it is, with the code lagging behind the audio and video, it's very hard to follow along.

  • @felipealvarez1982
    @felipealvarez1982 2 ปีที่แล้ว

    💣 THERE MUST BE A BETTER WAY

  • @laurentdorel8354
    @laurentdorel8354 2 ปีที่แล้ว

    Why R. Hettinger wrote {value!r} and not just {value} in his formatted print (around minute 40 for example) ?

    • @alpo789
      @alpo789 2 ปีที่แล้ว +1

      I'm assuming it is to handle values that are not convertable to str. Using !r it uses repr of value instead of its string conversion. The repr is of objects is also usually more informative than a string conversion (for example, repr of a string includes quotation marks around it), so the error message becomes more clear about what is being passed as the invalid argument.

  • @meowsqueak
    @meowsqueak ปีที่แล้ว

    Thoughts on TDD tho?

  • @graham8316
    @graham8316 3 ปีที่แล้ว

    anyone know if he's finished explaining these ideas somewhere else?

    • @foljs5858
      @foljs5858 3 ปีที่แล้ว

      He has several good presentations online

  • @SanataniAryavrat
    @SanataniAryavrat 4 ปีที่แล้ว

    I wish to have brain and teaching style like prof. Raymond Hettinger has.... sir, you make me feel jealous... unfortunately... 😊

  • @arsegorov
    @arsegorov 4 ปีที่แล้ว +1

    Always liked Ray Liotta but didn't know he was also coding under a pseudonym

  • @heroe1486
    @heroe1486 3 หลายเดือนก่อน

    Useful but I'm not sure you're always reducing load by using some of those std lib methods, it's the opposite of what they do in golang where they want the code to be self descriptive, [choice(foo) for i in range (10)] is faster to process than choices(foo,k=10) for most people I guess. Sure it deoends on the environment and if the other ones succeptible to read the code are python wizards or more general developers but where is the limit ? Especially when chaining those

  • @officialspamaccount
    @officialspamaccount 3 ปีที่แล้ว

    "Heck no!" - Raymond Hettinger.

  • @thePocketWatch45
    @thePocketWatch45 4 ปีที่แล้ว

    are you telling me Python is designed to do everything in 7 lines of code or lease?! mind blown

  • @ShubhamBhushanCC
    @ShubhamBhushanCC 3 ปีที่แล้ว

    Atleast let people have enough time to complete their talks. It's so frustrating to have an interesting talk cut short.

  • @smanzoli
    @smanzoli 4 ปีที่แล้ว

    Nice! Please imagine this program:
    a = [1]
    b = [1]
    b[0] = 2
    print(a, b)
    out: 1 2 (perfect)
    Then this variation, that should be the same:
    a = [1]
    b = a
    b[0] = 2
    print(a, b)
    out: 2 2 (WHY???? why a is changed as well???)

    • @ravabat5841
      @ravabat5841 4 ปีที่แล้ว

      Read about lists in documentation

    • @feddeschaeffer7116
      @feddeschaeffer7116 4 ปีที่แล้ว +2

      The statement
      b = a
      reads as “let the name *b* refer to the same thing as the name *a* ”. If you then ask that thing to to change its contents, it doesn't really matter whether you call it *a* or *b* . I would like to suggest using the list constructor:
      b = list(a)
      That reads as “let the name *b* refer to a new list with the same items as *a* ”.

    • @smanzoli
      @smanzoli 4 ปีที่แล้ว

      Thank you, Fedde!
      Didn’t know lists behave like this, different from non-lists, like a simple integer, flot or string. Great!

    • @feddeschaeffer7116
      @feddeschaeffer7116 4 ปีที่แล้ว +1

      ​@@smanzoli, the word you may find in the docs for that difference is that Python's lists are _mutable_ objects: you can ask them to change themselves in place. Anything you can do to ‘change’ a string (for example), just gives you a different string, even if you then decide to refer to that new string by the name you previously used for the old one. (a = a.capitalize())

    • @kossboss
      @kossboss 3 ปีที่แล้ว

      * basically in the second form a and b are the same thing, a points at list1 and now b points to the same list1... so changing b[0] is the same as changing a[0]
      this is called a soft copy.. you did a soft copy of a into b.
      * in the first form a points to list1 and b points to a different list1 (might as well call it list2 but coincidentally has the same content).
      this is not copy
      * there is a third variation which will have the same output as the first form but looks like the 2nd form.. this will show hard copy
      a = [1]
      b = list(a) # you hard copy a to b, this will make a new list
      b[0] = 2
      print(a, b)
      out: 1 2
      note that hard copys take more space but behave more like you are used to
      note that soft copys take less space but you have to be careful because other variables might change

  • @KenyanJohn-lt9ul
    @KenyanJohn-lt9ul 3 ปีที่แล้ว

    code is out of sync with speech

  • @javierlopez5877
    @javierlopez5877 4 ปีที่แล้ว

    Sadly code out of sync

  • @jvsonyt
    @jvsonyt 4 ปีที่แล้ว

    I didn't realize the developer of python was also a wizard.

  • @-taz-
    @-taz- 4 ปีที่แล้ว +1

    I keep thinking he's going to try to sell me a Sham-Wow.

    • @janusztarnowski115
      @janusztarnowski115 ปีที่แล้ว

      Hi. what do you think about it? https: //www.youtube.com/watch? v = xdmijinrk-w

  • @Gi0vanH
    @Gi0vanH 4 ปีที่แล้ว

    A great presentation ruined by video desync and SF Python neglecting to correct the issue.