mikemadden42 / beyond-the-basic-stuff

Companion to the Beyond the Basic Stuff with Python book

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

beyond-the-basic-stuff

Companion to the Beyond the Basic Stuff with Python book

“The two hardest problems in computer science are naming things, cache invalidation, and off-by-one errors.” - Leon Bambrick

The name data is a terrible, generic variable name, because literally all variables contain data. The same goes for naming variables var, which is a bit like naming your pet dog “Dog.” The name temp is common for variables that temporarily hold data but is still a poor choice: after all, from a Zen perspective, all variables are temporary.

Just as the smell of gas can indicate a gas leak or the smell of smoke could indicate a fire, a code smell is a source code pattern that signals potential bugs.

Print debugging is deceptively quick and simple. But it often requires multiple iterations of rerunning the program before you display the information you need to fix your bug.

“Thing to help people escape really fast if there’s a problem and everything is on fire, so they decide not to go to space” might be easier to understand for a lay audience than “Launch Escape System.” But it’s too verbose for NASA engineers to say in their day-to-day work. Sweigart, Al. Beyond the Basic Stuff with Python (p. 107). No Starch Press. Kindle Edition. https://xkcd.com/1133/

Functions are first-class objects in Python, meaning you can store them in variables, pass them as arguments in function calls, return them from function calls, and do anything else you can do with an object. Sweigart, Al. Beyond the Basic Stuff with Python (p. 121). No Starch Press. Kindle Edition.

Expressions are the instructions made up of operators and values that evaluate to a single value. Sweigart, Al. Beyond the Basic Stuff with Python (p. 122). No Starch Press. Kindle Edition.

Statements do not evaluate to a value. Sweigart, Al. Beyond the Basic Stuff with Python (p. 122). No Starch Press. Kindle Edition.

Variables are simply names that refer to objects. Attributes are, to quote the official documentation, “any name following a dot” Sweigart, Al. Beyond the Basic Stuff with Python (p. 124). No Starch Press. Kindle Edition.

A function is a collection of code that runs when called. A method is a function that is associated with a class, just as an attribute is a variable associated with an object. Sweigart, Al. Beyond the Basic Stuff with Python (p. 124). No Starch Press. Kindle Edition.

About

Companion to the Beyond the Basic Stuff with Python book

License:MIT License


Languages

Language:Python 100.0%