Python decorators for object-oriented method behaviors

& (verbiage overflow)Tue 15 November 2016RSSSearchSubscribe

Python supplies special decorators for a number of tools common in object-oriented programming. Their functionality is implemented as ordinary built-in functions, but they are made available as decorators for easier application.

Below I first list them and then discuss them one by one under numbered headings.

Functionality for restricting access to a property (attribute) of a class:

Functionality for methods of a class:

  1. Making a method “static” — available whether its class has been instantiated or not:

    • as function: staticmethod(function)
    • as decorator: @staticmethod
  2. Making a method “abstract” — available only for subclassing.

    • as function: abc.abstractmethod(funcobj)
    • as decorator: @abc.abstractmethod

Functionality to modify attributes of a class, to take effect in all future instantiations:

(A decorator appears on the line before before a function definition, as seen in the examples below. It seems at first to modify that function. In reality, the decorator incorporates the function into some other piece of code, built-in or otherwise, behind the scenes.)

1. Python public and private methods

The “dunder” (double underscore, __) prefix prevents access to attributes, except through the accessors @property, @attr.setter, and @attr.deleter.

class C():
    def __init__(self):
        self.__attr = 0

    @property              # This is a "getter", though not so named explicitly.
    def attr(self):
        """The doc-string for the whole property goes here."""
        return self.__attr

    def attr(self, value):
        self.__attr = value

    def attr(self):
        del self.__attr

The @property decorator is always required here, even if some of the others are omitted. It allows a docstring to be associated with the whole property attr. Technically, @property subsumes the function of @attr.getter, although the two can be used separately:

class C():
    def __init__(self):
        self.__attr = 0

    def attr(self):
        """Supply getter functionally for property "attr"."""
        return None

    def attr(self):
        return self.__attr

Some examples:

>>> f = C()                           # Instantiate the object, to begin.

>>> f.__attr                          # Not directly accessible.
AttributeError: 'C' object has no attribute '__attr'

>>> '__attr' in f.__dir__()           # Not listed by __dir__()

>>> f.__getattribute__('__attr')      # Not listed by __getattribute__()
AttributeError: 'C' object has no attribute '__attr'

>>> f.attr                            # Accessible by the implemented getter.

>>> f.attr = 'Presto'                 # Can be set by the implemented setter.

>>> f.attr

>>> f.__attr = 'Tricky?'              # Can we set it explicitly?

>>> f.attr                            # No. By doing that we have created a
'Presto'                              #   new and different attribute.
>>> f.__attr                          #   The dunder is a part of that 
'Tricky?'                             #   attribute's name.

>>> f = C()                           # Let's start again, so we can test del.

>>> del f.__attr                      # Not directly delible.
AttributeError: __attr

>>> del f.attr                        # Delete f.attr
>>> f.attr                            # Now it's gone.
AttributeError: 'C' object has no attribute '_C__attr'

(Actually, there is a way to access a “private” property while circumventing the @property functionality. Let’s use i to represent the instance name, cls the class name, and a the private attribute name. The private property can be read and assigned directly using the form i._cls__a.)

2. Static vs. class vs. abstract methods

2a. Bound instance methods are the default

Examples here are for Python 3; Python 2 behaves somewhat differently.

Methods are functions that are “bound” by default in Python 3: they are normally called on an instance of the class in which they are defined. That instance may be assigned to a variable:

class Example:
    def default(self):
        return '子程式'

>>> e = Example()
>>> e.default()

Or the class may be instantiated on the fly, by instantiating Example (as Example()) but not assigning it to a persistent variable.

>>> Example().default()

We can show that default is bound to a particular instance in either case, because we can ask for that instance’s memory location using the __self__ attribute:

>>> Example().default.__self__
<__main__.Example at 0x10c0ce588>

>>> e.default.__self__
<__main__.Example at 0x10c073780>

But it can’t be called on the uninstantiated class itself — here, Example without ():

>>> Example.default()
TypeError: default() missing 1 required positional argument: 'self'

Here, when the interpreter says it requires the argument self it means it needs a particular instance of Example in order to call default on. It needs an instance because default was defined with self as its first parameter. But there is no such instance:

>>> Example.default.__self__
AttributeError: 'function' object has no attribute '__self__'

2b. Static methods: methods without an instance

To call a method without having to have an instance, use the @staticmethod decorator, and omit the self argument:

class Example:
    def static():                       # Note: no "self" argument
        return 'no instance required'

    def default(self):                  # Note: "self" argument present
        return 'instance definitely required'

>>> Example.static()
'no instance required'

>>> Example.default()
AttributeError: type object 'Example' has no attribute 'default'

In Python 3, a static method can be called on the class itself or on an instance. If you simply omit self, the method can be called on the class. Though, it cannot be called on an instance — self represents that instance itself.

class Example:
    def default():                      # Note: no "self" argument
        return 'can be called on class but not on instance'

    def default2(self):                 # Note: "self" argument present
        return 'can be called on instance but not on class'

    def default3():                     # Note: no "self" argument
        return 'can be called on class or instance'

Here are examples called on an uninstantiated class Example itself:

>>> Example.default()
'can be called on class but not on instance'

>>> Example.default2()
TypeError: default2() missing 1 required positional argument: 'self'

>>> Example.default3()
'can be called on class or instance'

And here are examples called on an instance of the class, created non-persistently with Example():

>>> Example().default()
TypeError: default() takes 0 positional arguments but 1 was given

>>> Example().default2()
'can be called on instance but not on class'

>>> Example().default3()
'can be called on class or instance'

(Note: In Python 2, Example.default() and Example.default2() are not allowed — an instance method must have that instance passed to it. Example.default() can’t receive the instance because has no self parameter at all, and Example.default2() has self but no instance is being passed to it.)

2c. Class method: method called on a class itself, without instances

This differs from a regular method that has no self parameter: it must have a cls parameter, which refers to the class itself, not the method.

This parameter can be used to access attributes of the class and modify them for all future instantiations:

class Example:
    x = 'original'

    def sample(self):
        """Output the instance and the attribute x, as found."""
        print('instance: {}, x: {}'. format(self, self.x))

    def class_method(cls, x=None):
        """Modify the class attribute x."""
        cls.x = x
        print('x: {}'.format(cls.x))

>>> Example().sample()    # first instantiation
'instance: <__main__.Example object at 0x10c1605f8>, x: original'

>>> Example().sample()    # second instantiation
'instance: <__main__.Example object at 0x10c1591d0>, x: original'

>>> Example().sample()    # third instantiation
'instance: <__main__.Example object at 0x10c159320>, x: original'

>>> Example.class_method('changed by user')
'x: changed by user'

>>> Example().sample()    # fourth instantiation; attribute changed!
'instance: <__main__.Example object at 0x10c159400>, x: changed by user'

Without this cls parameter, a class method does not seem to be callable at all:

class Example:
    def class_method(cls):
        return 'cls: {}'.format(cls)

    def uncallable():
        return 'cannot be called'

>>> Example.class_method()
"cls: <class '__main__.Example'>"

>>> Example().class_method()
"cls: <class '__main__.Example'>"

>>> Example.uncallable()
TypeError: uncallable() takes 0 positional arguments but 1 was given

>>> Example().uncallable()
TypeError: uncallable() takes 0 positional arguments but 1 was given

2d. Abstract method: leave implementation for creation or modification only by inheritance

A method can be prepared for future implementation implicitly using pass or return as the dummy body, or explicitly using @abc.abstractmethod. Explicitly declaring a method to be abstract means that it cannot be called directly, and a class that contains only abstract methods cannot be instantiated at all, although it can be subclassed.

An explicit abstract method requires you to import the abc module and specify a special argument metaclass=abc.ABCMeta in the class definition:

import abc

class C(metaclass=abc.ABCMeta):
    def an_abstract_method(self):

Even with the @abc.abstractmethod decorator, some sort of nominal body seems to be needed in the method: a docstring or pass, for instance:

class C(metaclass=abc.ABCMeta):
    def an_abstract_method(self):
        """(dummy docstring)"""

The decorators @classmethod and @abc.abstractmethod can be composed, in order to create an abstract class method. @classmethod is applied after @abc.abstractmethod — in other words, @classmethod appears before @abc.abstractmethod:

import abc

class C(metaclass=abc.ABCMeta):
    def abstract_class_method(cls):
        """(dummy docstring)"""


All articles

  1. What goes in a README?
  2. Self-segregation
  3. Python decorators for object-oriented method behaviors
  4. The English Level of This Year's Principal Presidential Candidates
  5. Chao on Wenyan
  6. Face 面子
  7. Some Questions about the Recurse Center
  8. De-duplicate Apple Calendars on Mavericks
  9. Transcribing Voice Recordings on OS X, 3 — another example
  10. Transcribing Voice Recordings on OS X, 2 — more examples
  11. Transcribing Voice Recordings on OS X
  12. Interview with Rachel Vincent
  13. The Pre-Morse Origin of Two Morse Code Symbols
  14. “The Man Who Knew Infinity” — 2015 movie about Ramanujan
  15. Why does Python have two ways to filter a comprehension?
  16. There is no ternary operator in Python
  17. Does Fortran have a two-way decision function?
  18. Debugging the Art Museum
  19. Learning to Throw Books Away
  20. About Me
  21. Walter Murch on Standing at Work
  22. “Our Kind of Story”
  23. Revisiting the Taiwan national anthem
  24. Review of Button, Phonetic Ambiguity in the Chinese Script
  25. Importing Modules under Pytest
  26. Two Git Accounts on One Computer
  27. Pytest parametrization — passing multiple data-items to a single test
  28. Markdown Basic References
  29. Two Curious Things about screen.width and screen.height on Mobile Firefox and under iOS.
  30. Where Do I Stand on Digital Advertising?
  31. Progressing to the Next Level after Two Years at Hacker School
  32. Health Insurance $5,600/year ⇨ $12,600/year to Keep Our Doctor
  33. Always Use Dry-run Options If Possible
  34. Basic Interaction with Man-pages
  35. Taiwanese Cantillation Prosody and the Standard Tradition of Regulated Verse
  36. Automated Transcription of a Lyric’s Melody
  37. Quote-Unquote: Quick Python Conversion to and from URI Standard Format
  38. Literate Code in Crista Lopes’s Exercises in Programming Style
  39. Special Computer Help for an Uncooperative Person in Need
  40. Richard Bellman on Multistage Decision Processes
  41. Contradictory Advice from Kenkō about Studying after Mid-life
  42. Deceit for my Mother’s Sake
  43. New York State’s Law on Intercoms
  44. Our Relationship with Unwelcome Callers
  45. Reasons to Keep a Landline Phone
  46. Chinese (Pinyin) Tone Marks on Macintosh
  47. Suicide by Holding the Breath in the Greek Classics
  48. Transcribing a Solo Voice Recording to Western Musical Notation
  49. Surprise Text Message Sent by Google Voice
  50. Trimming a Git Repo before Moving It to GitHub
  51. The Sage Chilōn on Gesticulation
  52. Examining the Identity of a “Whole-Sliced” Python Sequence
  53. Pagerank after Completing the Move of My Blog
  54. Haydn on Originality
  55. Stages of Life
  56. Linguistic Naturalism in Behavior-Driven Development
  57. Some Advice on Interviewing in China
  58. The AARP on Ageism
  59. The Cash Value of a Lost Moment
  60. How Did 釁 Get Into My Computer? A Talk at CSTUY
  61. I Knock My Head on the Ground: Review of Richter, Letters and Epistolary Culture in Early Medieval China
  62. Two Pair of Suspenders Back to Amazon
  63. Knuth on the Direction of the Tree in Computer Science
  64. Py3K Versions of Networking Programs for the Rhodes and Goerzen Book
  65. A Fake Monk in Times Square
  66. Werner Herzog on the jungle’s “articulate obscenity”, “misery”, and “sort of harmony of collective murder”
  67. Hacker School and How we Learn
  68. Hacker School Sees “The Internet’s Own Boy”
  69. Two Chinese manifestations of black cardamom
  70. A natural-language URL shortener
  71. Recovering Web and Search visibility after Leaving WordPress
  72. Greedy evaluation in Python's default dictionary
  73. Trying to Change Google Pagerank after Moving my Blog
  74. Ensuring my blog is indexed by Google, using Webmaster Tools
  75. 'Dependency' in programming means the opposite of its traditional meaning
  76. Experimenting with a Site-Analytics Tracker
  77. Unexpected Behavior from the Python 3 Built-In Hash Function
  78. Rote learning and programming
  79. r0ml on the workspace-based, image-oriented programming paradigm
  80. In technology, knowing your vulnerabilities is a desirable strength
  81. The Lingering Puzzle of yán 焉
  82. My grandmother’s diaries
  83. Scholarly Presentation: Arousing something other than polite interest
  84. Friedrich Gulda's Beethoven
  85. Reaction to Jaron Lanier Talk at Cooper Union
  86. Yuen Ren Chao on Chanting Chinese Poetry
  87. The legal requirement of having a camera inside a NYC taxicab
  88. This blog has moved
  89. "Web of Trust" in Chinese and Japanese
  90. Taking the larger view of frustrations with technology
  91. Reflecting on Bernard Baruch, on the need for character and thinking
  92. Dinner with a Bletchley Park cryptographer
  93. Karl Popper on conflict between your basic assumptions and those of your interlocutor (1965)
  94. My Hacker School Pairing Interview
  95. Thirty political parties fielding candidates in New York City this election
  96. The world's only speaker of standard Mandarin in 1923
  97. Data within literal curly brackets using Python format()
  98. The Imperative Style in Commits and Docstrings
  99. Git overwrites file metadata including creation and modification date
  100. Two complaints and one word of praise about GitHub Flavored Markdown
  101. Lǐ Bái on time (8th century)
  102. Two bits of trivia from the Institute for Advanced Study
  103. Karl Popper against foundations of knowledge (1965)
  104. George Orwell on falsification of fact (1946)
  105. Loss of innocence for "ggg"
  106. George Orwell against uniformity of political principles (1946)
  107. Library technology at the Institute for Advanced Study
  108. Richard Feynman on scientific integrity (1974)
  109. Richard Feynman on ignorance of science (1964)
  110. Tense in Git Commit Messages
  111. A better plan is needed for transporting equipment in the subway
  112. "Premature optimization" as phrased by Musashi
  113. Finding and returning zero or one of a marked sub-expression in Python regex
  114. A faster Python sort
  115. A question about time complexity when testing membership in a Python nested sequence
  116. Rendering a matrix as a linear array
  117. Attempting a generic SQL INSERT statement in Python
  118. Welsh bwg 'bogey': an alternate proposal about the origin of "computer bug"
  119. Using python str.format(*args) when the cardinality of *args is unknown
  120. Compelled by forces I can no longer resist…
  121. Highlights of the July, 2013, NY Tech Meetup
  122. Review of Zádrapa posted
  123. Now filtering (> /dev/null) some spam before it reaches the Gmail Spam folder
  124. Isaac Newton, creationist
  125. Freeman-Halton 3x3 exact test
  126. Conjure me: reentering the zone of proximal development
  127. Python extend() without a list comprehension
  128. The name "Hacker School"
  129. The benefits of Hacker School
  130. Another two subway rules of thumb illustrated
  131. Short-circuiting and (and ==) instead of if in Python
  132. Quintilian on time and study
  133. Kenkō on time and study
  134. George Orwell on keeping a diary to cultivate dispassionate thinking
  135. A bon mot of Quintilian on theory
  136. Growth of outlook at Hacker School
  137. Nakamoto Satoshi, the name of Bitcoin's inventor
  138. The psychology of pairing and code review at Hacker School
  139. Computer science and rugelach
  140. Is Hacker School like graduate school?
  141. Why do I work so hard at Hacker School?
  142. Hacker School compared with studying computer science at City College
  143. Differences between code and natural language
  144. Hacker School after six weeks
  145. Pairing at Hacker School
  146. The Norman Manchu dictionary has reached Seattle
  147. Jerry Norman's Manchu dictionary has appeared
  148. Two things I am thinking about as Hacker School begins
  149. The white powder on the pages of library books
  150. Non-math uses of LaTeX
  151. Hacker School
  152. Hacker School (dojo/recruiter for programmers) begins in four days
  153. Dependencies for scipy and matplotlib not handled by pip
  154. The National Do Not Call Registry no longer works well
  155. Early evidence of a dislike of Christmas music?
  156. Plinyesque Christmas wishes to all
  157. Getting the Android GridView sample code to work
  158. A small triumph of explicitly readable code
  159. Godfrey Reggio on technology in life (2002)
  160. Max Weber: "science is the affair of an intellectual aristocracy" (1918)
  161. First day of Android coding: two problems solved
  162. Black optimism explained
  163. Talking across the pre- and post-computer border
  164. Getting used to the disappearance of old institutional models
  165. Anything less than perfect is a failing grade
  166. Recovering from hurricane Sandy
  167. Max Weber on meritocracy in academia (1918)
  168. Our state of things in New York right now (after hurricane Sandy)
  169. Max Weber on the "strange intoxication" of a passionate vocational devotion (1918)
  170. LaTeX's extract package, used for isolating the contents of environments and commands
  171. Fellini movie "Broadway Bomb" being filmed in my neighborhood
  172. Does Apple view an "iPhone" phone number as something different from a "mobile" phone number?
  173. Columbia University Libraries finally removing the card catalog
  174. One more rule of thumb for the New York subway
  175. Two further rules of thumb for the New York subway
  176. Two inches taller in two years
  177. Alternate ways to say "pop" and "push" in computer science
  178. Poulenc's Dialogues des Carmélites at the Dell' Arte Opera Ensemble
  179. Andrew Nathan on Doh Chull Shin on Confucianism and Democratization (2012)
  180. Proofreading poorly OCRed material
  181. New York State redistricting maps on line at CUNY's Center for Urban Research
  182. Karl Berry on free software (2005)
  183. The SEC on the utility of Python as a secure and accessible tool for generating official reports (2010)
  184. Hill Country
  185. Yogurt whey-starter pickled (soured) mackerel
  186. Images (figures) on facing pages in a LaTeX document
  187. Just what is being centrally limited in the "Central Limit Theorem"?
  188. Reloading modified code when using the Ipython interactive shell
  189. Alistair Cooke on H. L. Mencken's typing (1956, 1977)
  190. Jerry Norman (1936–2012)
  191. Ptisan issues
  192. Elia Kazan on the need for selfishness
  193. "Neither side took prisoners" — Japanese and American atrocities in the Pacific theater of World War II
  194. Surprise! You have a different Congressman now but no one thought you needed to know.
  195. Another notice of the bureaucratization of academia
  196. Bogusław Jackowski on "worldwide licensing madness" (2008)
  197. Accommodating the Chinese hunger for official seals on official documents.
  198. Bond Street and a story about a smartphone
  199. Another bond to Apple is lost as MobileMe Sync is discontinued
  200. Charles Ives (1874–1954) on his life in business (1933)
  201. "Taikonaut" and the new Cold War
  202. James Lang on improving understanding and retention by increasing "cognitive disfluency" (2012)
  203. Lǔ Xùn 魯迅 (1881–1936) on the truth behind Confucian morality (1918)
  204. Ray Bradbury (1920–2012) on cars (1963)
  205. Ray Bradbury (1920–2012) on success in the arts (1963)
  206. Chinatown breakfast offerings
  207. Zed Shaw on why to use C (2011)
  208. A step in my Chinese education
  209. Age and the MBA
  210. Useful Python time formats for dealing with HTTP headers
  211. An encounter with Google's security rules
  212. HTML headers for keeping track of updated webpages
  213. William Hung 洪業 (1893–1980) on Confucianism (1980)
  214. David Daniels on one's "other voice" (1998)
  215. Elia Kazan and questions of betrayal
  216. Advice on preparing herring
  217. Two limitations of call-forwarding on Google Voice
  218. Student protests in Montréal and thoughts about tuition
  219. Call-screening in Google Voice has a problem
  220. Cortlandt Alley's Chinese name
  221. Chinatown shorthand
  222. "Download statusbar" add-on for Firefox
  223. The ceremonial gateways of Montréal's Chinatown
  224. Nailset = chasse-clou
  225. Restaurant Mai Xiang Yuan [Màixiāngyuán cānguǎn 麥香園餐館] in Montréal
  226. A bon mot of Peter Carey about reviews of one's work (2012)
  227. A bon mot of Peter Carey about New York (2012)
  228. Identifying the active bridge adapter for use with a headless virtual machine on VirtualBox
  229. Doubts about l'affaire Chén Guāngchéng 陳光誠
  230. Military officers who cannot count
  231. Parallel text and vocabulary in LaTeX
  232. A stricture on Google Voice
  233. Resolving VirtualBox error VERR_INTNET_FLT_IF_NOT_FOUND
  234. Ubuntu 12.04LTS (Precise Pangolin) on VirtualBox
  235. Recordings for Classical Chinese
  236. Arthur Luehrmann on "computer literacy" (1972)
  237. The origin of the symbol Θ (big theta) in asymptotic notation
  238. Being censored in China
  239. The experience of learning vim commands
  240. How should I rate this movie on Netflix?
  241. Netflix miscalculation — Hugo
  242. Curious vim behavior: treats date range as subtraction
  243. Alexandra Lord on the myth of the academic career (2012)
  244. Elia Kazan on getting along in society (1974)
  245. ssh unavailable over Amtrak's wifi network
  246. Tricked again by Python's mutable objects
  247. Is blocking ads theft of service?
  248. A poor analogy on intellectual property rights
  249. A mutton chop at Keen's Steakhouse
  250. An anecdote about William Hung (Hóng Yè 洪業, 1893-1980)
  251. Sorting a list of Unicode strings in Python, case-insensitively and ignoring diacritics
  252. Avoid deleting the contents of a file in Python through sloppy use of "write" mode
  253. Reloading a Python module after modifying it
  254. Frank Mittelbach on documentation (2006)
  255. Frank Mittelbach on collaboration (2006)
  256. Frank Mittelbach's "moral obligation" license for the LaTeX multicol package
  257. Keith Whalen records scales and patterns from the Slonimsky Thesaurus
  258. Calligraphy in Chinatown
  259. Manchu dictionary done
  260. Bernard Shaw (1856–1950) on the damage done by immaturity in politics
  261. Gotham breakneck to Chinatown
  262. Calculus III progresses
  263. Some Western recipe-names as transformed by the Taiwanese linguistic experience
  264. Class war against the banking and financial industry
  265. Avoiding the Emailyama
  266. Adblock Plus is the most useful piece of shareware I've ever had
  267. A less painful way to install Adblock Plus filter-subscriptions in Firefox
  268. Tales from Calculus III
  269. Jack Cheng on "the technology I grew up with" (2012)
  270. Distribution of fonts: competing models are coexisting
  271. MoinMoin for notebook-wiki (and WordPress, you are trying the patience of my affections)
  272. generate native MATLAB code from finished figures, for study
  273. Quintilian on laziness and difficulty in one's studies
  274. Guide to Gwoyeu Romatzyh 國語羅馬字 (tonal spelling for Mandarin)
  275. Guide to the radicals of the traditional Chinese dictionary
  276. Origins of the Mandarin Phonetic Symbols (注音符號/ㄅㄆㄇㄈ)
  277. Installing UCC certificate for multiple domain names hosted virtually on a single server
  278. QuickTime Pro easily concatenates .m4v video files
  279. Columbia to Chinatown walk, 20120122
  280. A local custom without the corresponding exotic saying in rural Taiwan
  281. HTTPS being rejected at Yahoo hosting
  282. Classical Chinese syllabus posted; using Landslide for markdown-to-HTML5
  283. Phonosymbolism, etymology, and the nebulous Chinese word family
  284. Simple meal at Shui Mei Café (嘎嘎叫, 67A East Broadway, NYC), formerly So Go Café)
  285. Are cell phones and bananas radioactive?
  286. LaTeX and electronic documents
  287. New definition of “algorithm”
  288. Materials used in paper bank statements
  289. Finally making progress with Vim
  290. Kenneth S. Wherry on American influence in China (1940)
  291. Propagation of a meme and a metameme
  292. Against the single time zone
  293. Hamish Milne on transcriptions of Bach (2005)
  294. Choosing a suitable site for fieldwork, and working with illiterate informants in China
  295. Yuen Ren Chao (1892–1982) urging Americans to resist Chinese telephantasmia (1921)
  296. The brown German flour of Przasnysz
  297. Recollection of the traditional bagel in central Poland before World War I
  298. Vaclav Havel (1936–2011) on doing good work (1978)
  299. Vaclav Havel (1936–2011) on the "dictatorship of technology" (1978)
  300. Vaclav Havel (1936–2011) on ideological enslavement (1978)
  301. Vaclav Havel (1936–2011) on law (1978)
  302. Vaclav Havel (1936–2011) on responsibility and a "post-democratic" system (1978)
  303. Vaclav Havel (1936–2011) on "opposition" and "dissident" (1978)
  304. Vaclav Havel (1936–2011) on ideology (1978)
  305. 'Factorial' in Chinese (jiēchéng 階乘/阶乘)
  306. Leibniz’s theodicy, dynamic programming, and strategies for learning
  307. Emanuel Derman and Paul Wilmott on mathematical models and self-delusion (2009)
  308. Y. R. Chao and Henry Sheffer added to the Mathematics Genealogy Project
  309. Two more rules of thumb for the New York subway
  310. Math in the Movies
  311. Jim Coplien on reflection and problem-solving (2011)
  312. Richard Feynman on practical applications of the theory of gravitation (1964)
  313. Karl Popper on understanding a problem (1963)
  314. Galileo on "reason conquering sense" (1632)
  315. Apparent error in Python's priority queue and heapq
  316. Literacy book finally out
  317. Y. R. Chao on his dissertation (1974)
  318. Doctoral pedigrees
  319. Lack of stable sort in Python's priority queue
  320. Suitable pots for making turmeric tea
  321. Neuro-plasticity and strategies for improving cognitive functioning: "The Brain Fitness Program" (2007)
  322. Code-switching between comfortable cognitive aptitudes and the main aptitudes used in math and coding
  323. Wishes for the Orthodox Nativity Season (began 15 November this year)
  324. Two rules of thumb about transportation in New York
  325. Pípá yā 琵琶鴨 (Frisbee Duck)
  326. Testing the reliability of the Python priority queue
  327. Edsger Dijkstra on programming as an intellectual discipline (2001)
  328. Edsger Dijkstra on the name of the field Computer Science (2001)
  329. Edsger Dijkstra on anthropomorphizing computers (2001)
  330. Edsger Dijkstra on mastery of one's native tongue as a vital programming skill (2001)
  331. Edsger Dijkstra on the origin of his shortest path algorithm (2001)
  332. Efrem Podgaits's New York Mass (2001)
  333. Anecdotal report on experimenting with creatine as a study aid
  334. "Suppose" for math proofs, in LaTeX
  335. A rule of thumb in teaching
  336. Graphing flowcharts and automata in LaTeX
  337. Perception of time and suspension of finality (studying math)
  338. Suddenly perceiving the cantus firmus in a Bach chorus
  339. Two of Elvira's arias from Don Giovanni
  340. Identifying robots among human beings
  341. Apparent misspelling in LaTeX command set: \guillemotleft and \guillemotright
  342. Table of contents in a LaTeX book: make the TOC entry different from the actual chapter headings in the text
  343. Competition and sharing in academia
  344. Kuhn and Popper
  345. Herb Gross's calculus lectures
  346. The abbreviation UTC as an acronym
  347. Clyde Haberman on validating one's authenticity as a New Yorker (2011)
  348. The era of lost words
  349. Never odd or even
  350. William Deresiewicz on multitasking and solitude (2009)
  351. Bjarne Stroustrup's advice to up-and-coming programmers (2008)
  352. Chet Ramey's advice to up-and-coming programmers (2008)
  353. Bjarne Stroustrup on the name C++ and common criticisms of the language
  354. Steve Bourne, advice to up-and-coming programmers (2009)
  355. Alfred Aho on the origins of awk (2008)
  356. Leslie Lamport on thinking first and on commenting code (2007)
  357. Pens of choice for linguistic fieldwork
  358. How I learned LaTeX
  359. Some bons mots from Edsger Dijkstra (1984)
  360. Non-paean to Steve Jobs
  361. Annotations of Cormen et al.'s algorithm for a Red-Black Tree (delete and delete-fixup functions only)
  362. John McCarthy on "Generality in Artificial Intelligence" (1987)
  363. Brian Kernighan's summary thoughts on scripting languages
  364. Changes to the inventory of IPython magic commands (v. 0.10 to 0.11)
  365. One man's calm reflection on Java-think in Python
  366. mdfind as a substitute for locate on Mac OS X
  367. Reconsider P. T. Barnum's reputation
  368. LaTeX macro for circling answers on math problem sets
  369. View of the Mariana Trench
  370. Simulating private variables in Python
  371. Choice of formats for basic code documentation
  372. Dennis Ritchie on Computer Science and Commerce (1984)
  373. Inconsistent results of the same seed in random.seed() on different Python installations
  374. An opinion on vi configuration
  375. The virtue of Vim (or: why I do not remap copy and paste)
  376. Shark fin and the economics of Chinese "face"
  377. Two funerary practices and the end of a good story
  378. An important skill for instructors
  379. p::c
  380. Twice-a-day mail delivery
  381. Portmanteau characters in Chinese (abstract)
  382. A math professor I enjoyed
  383. The state of my Netflix patronage
  384. Longevity vs. versatility of code
  385. A new kind of noise in the subway
  386. Router VI is dead
  387. Tinker Tailor remake
  388. Automated upward pricing spiral
  389. Break-in?
  390. Telephantasmia, one of the great gifts of Chinese culture
  391. September 11th sensations
  392. Whether to take a small loss or consent to the devaluation of the US dollar
  393. City checkpoint chaos
  394. Continuing opportunity for techno-elitism
  395. A worry of Donald Knuth's
  396. An opinion of TeX
  397. Advice on teaching English in China if you lack a TEFL degree
  398. "The Highline" Park
  399. Plutarch on the sensitivity and versatility of the human mind
  400. Plutarch's praise of the "fox" temperament
  401. Unagi hitsumabushi 鰻櫃まぶし
  402. My mother and me, at work on the Early China index, 20110526
  403. juémíngzǐ 決明子 tisane
  404. Brillat-Savarin on the pleasures of the fast
  405. University of Maryland, (College Park) general education rated D in a national survey
  406. The EMACS meta key and the standing desk
  407. A rule of thumb in choosing one's tools
  408. Dr. Johnson on the "fox" temperament
  409. Carl Elliott reviews Ginsberg, Fall of the Faculty (WSJ)
  410. Hard copy vs. electronic copy
  411. Deborah Ball's article on the opposition to standardizing the Romansh language (WSJ)
  412. Boris Veytsman's review of Kottwitz, LaTeX Beginner's Guide
  413. Why even 212 phone numbers calling in-area have to dial 212 first
  414. Dr. Johnson on keeping a diary
  415. Against object-oriented design (except in scripting languages)
  416. Worrying about inadequate memory to hold program and debugger (1973)
  417. Consequences of a compiler defect
  418. The Internet and scripting languages
  419. Newton's own suffering at math
  420. Fresh turmeric-root tea
  421. Appreciation of awk
  422. "Computer Science, Modern Languages Most Gender-Polarized Majors"
  423. Food issues during the Siege of Leningrad
  424. Starting a blog