The Mental Game of Python - Raymond Hettinger

แชร์
ฝัง
  • เผยแพร่เมื่อ 28 ธ.ค. 2024

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

  • @MrMartingale1
    @MrMartingale1 5 ปีที่แล้ว +256

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

    • @ItsaPastaboy
      @ItsaPastaboy 5 ปีที่แล้ว +8

      Too many registers

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

      There must be a better way.

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

      Reliably, In that order.

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

      I ACTUALLY PREFER TO FAP

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

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

  • @benwalsh2825
    @benwalsh2825 5 ปีที่แล้ว +51

    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

  • @bernoulli9047
    @bernoulli9047 5 ปีที่แล้ว +39

    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.

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

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

  • @adjbutler
    @adjbutler 5 หลายเดือนก่อน

    Raymond Hettinger is just the best....

  • @EngIlya
    @EngIlya 5 ปีที่แล้ว +114

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

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

      its fixed now :)

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

      @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 5 ปีที่แล้ว

      @@sentience2241 Will this be fixed soon?

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

      @@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.

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

      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)

  • @laggymax7098
    @laggymax7098 5 ปีที่แล้ว +80

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

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

    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

  • @DerekHohls
    @DerekHohls 5 ปีที่แล้ว +20

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

  • @Drkttv-b2d
    @Drkttv-b2d 4 หลายเดือนก่อน +1

    That was exquisite.

  • @MultiSosnooley
    @MultiSosnooley 5 ปีที่แล้ว +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 5 ปีที่แล้ว +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 5 ปีที่แล้ว +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 9 หลายเดือนก่อน

      ​@@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 6 หลายเดือนก่อน

      @@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.

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

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

    • @medthehatta
      @medthehatta 5 ปีที่แล้ว +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 4 ปีที่แล้ว +3

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

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

    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."

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

    this lad is always amazing

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

    Nice to see a demo with no type hints i 2023

  • @BreetaiZentradi
    @BreetaiZentradi 5 ปีที่แล้ว +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 ปีที่แล้ว

      I use the no scroll rule on function size

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

      @@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.

  • @alexandarjelenic2880
    @alexandarjelenic2880 5 ปีที่แล้ว +11

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

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

      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 4 ปีที่แล้ว

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

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

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

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

    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 !

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

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

  • @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.

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

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

  • @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"

  • @heroe1486
    @heroe1486 9 หลายเดือนก่อน +1

    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

  • @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!

  • @nathanaeltrimm2720
    @nathanaeltrimm2720 2 ปีที่แล้ว +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 ปีที่แล้ว

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

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

      ​@@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 9 หลายเดือนก่อน

      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

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

    Thoughts on TDD tho?

  • @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.

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

    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.

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

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

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

    There’s gotta be a better way!

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

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

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

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

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

    Love Feynman!

  • @ericlifee7485
    @ericlifee7485 5 ปีที่แล้ว +1

    This is really good stuff, thank you.

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

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

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

    5:53 Jigabytes
    I'm not alone.

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

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

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

      He has several good presentations online

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

    code is out of sync with speech

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

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

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

    💣 THERE MUST BE A BETTER WAY

  • @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 4 ปีที่แล้ว

      * 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

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

    Sadly code out of sync

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

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

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

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

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

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

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

    "Heck no!" - Raymond Hettinger.

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

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

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

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

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

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