Notes on Learning Python by Mark Lutz Chapter 1-4

Introduction on the types of Python is good, but not great for novices to the language, probably a little distracting.  Still cool.

Page 39, Turning code into frozen binaries:

this is likely obvious to experienced programmers but makes it a revelation for me to get some small scripts into the hands of coworkers.  Will try PyInstaller in due time.

Page 59, Command-Line Usage Variations:

> python script1.py > saveit.txt

is a cool way to output files, particularly for the text parsing I want to do.  Very useful for easier sharing to share with clients and not even have to give a self-installing executable.  I’m happy to say I remembered a little of command line navigation to get this to work.

Page 66-68: Modules.

“every file of Python source code whose name ends in a .py extension is a module.”

“imports are too expensive an operation to repeate more than once per file, per program run..imports must find files, compile them to byte code, and run the code.”

“modules are mostly just a package of variable names, known as a namespace, and names within that package are called attributes.”

Page 93: Python Conceptual Hierarchy

Programs are composed of modules. Modules contain statements. Statements contain expressions. Expression create and process objects.

Page 120: Iteration and Optimization

“keep in mind that every Python tool that scans an object from left to right uses the iteration protocol”s

Page 124: can use struct to “both create and unpack binary data”

skipping over the encode/decode section re: Unicode characters but alarmed at the note on 126 may need this for the web.

Page 126: output differences with the book and my IDLE in 2.7 shows book using 3.3?  Use of Set command interesting: I can see possible real world usage.

Page 128-9: discussion of types: but care what an object does, not what an object is.  This is a big difference from C

Just OK introduction to classes: MIT MOOC was better here.  “lists and dictionaries obviate most of the work you do to support collections and searching in lower level languages.” (p 130-1)

 

 

 

Leave a Reply