Skip to main content

Programming, Day 47

Late start to the day today.
Was busy moving a table from mum’s place to mine.
This should help my back a lot!

Updates:

  • 7p, Getting better with gtypist.
  • 8.15p, Done with Vim
  • 8.20p, No Python Apps tonight
  • 22.33, Just understood the difference between generic sequence operations and methods (my aha for the day!)
    You can run generic sequence operation across the core object types. For e.g. I can run the len function on strings, or numbers or lists.
    Methods, are object specific. I can only run numeric methods on numbers and string methods on strings.
    This probably is why you run generic operations in front of a type, like type(s) and methods as a .whatever like s.isupper.
    Lutz shows me another quick rule of thumb; when you run the dir function on an object it should list the generic operations with underscores e.g. __len__ and methods just show up as plain attributes later in the listing e.g. swapcase
  • 11.57p, Done with Chapter 4 of the Lutz book.
    • Final big insight for future reference.
      Polymorphism means that the meaning of an operation (like a +) depends on the objects being operated upon. This turns out to be a key idea (perhaps the key idea) behind using Python well—not censtraining code to specific types makes that code automatically applicable to many types.

gtypist screenshot