Leaders Hanging on Like Grim Death in Moby-Dick

One in a series of blog posts about management lessons derived from the classic novel Moby-Dick

Those who haven’t read Moby-Dick for a while often forget how uproariously funny the book can be. That’s partly because, like Shakespeare, Melville can turn on a dime, making you guffaw one minute and pulling you into dark drama the next. The way he discusses the prideful leader is especially hilarious.

In Chapter 53, “The Gam,”  Ishmael goes for the wry humor, satirizing the details associated with “the gam” — that is, the meeting between two captains of whaleships.  The idea is that one captain must make the trip over to the other captain’s ship in order to have a conversation (“the gam” in question). The tricky part is that whaleboats of the era didn’t have any extra “seats” because they hosted a full crew of rowers and no tiller at all. So the captain was forced stand up in the boat as it carried him to the other ship.  Being cargo was no easy task, as Ishmael relates:

[O]ften you will notice that being conscious of the eyes of the whole visible world resting on him from the sides of the two ships, this standing captain is all alive to the importance of sustaining his dignity by maintaining his legs. Nor is this any very easy matter; for in his rear is the immense projecting steering oar hitting him now and then in the small of his back, the after-oar reciprocating by rapping his knees in front…[I]t would never do…for this straddling captain to be seen steadying himself the slightest particle by catching hold of anything with his hands; indeed, as token of his entire, buoyant self-command, he generally carries his hands in his trowsers’ pockets… Nevertheless there have occurred instances, well authenticated ones too, where the captain has been known for an uncommonly critical moment or two, in a sudden squall say — to seize hold of the nearest oarsman’s hair, and hold on there like grim death.

You’ve got to love this image of a leader jealously guarding his dignity even if it means tugging the tresses of some poor schmuck just trying to do his job.

Have things changed so much? Oh sure, there is (one likes to think) less literal hair pulling now, but maintaining dignity remains a high priority for your average leader, even at risk of metaphorically mangling an employee or two. I hear tell of an exec who, when speaking to the organization or even in front of groups of clients, would make fun of one of his high-level direct reports. The stories were often of how bumbling the other was, making that person look like the clown of the company. In this case, the exec wasn’t exactly trying to protect his own dignity (I imagine he thought it was good-natured ribbing), but he seemed to be trying to make himself look clever, both by his talent as a raconteur and by pitting himself in stark contrast with the purported clown. It was (reportedly) pretty awful. Even as that direct report chuckled along with the joke like a bullied kid in high school, others would just wince. A hair pull might have been preferable.

Sometimes the hair-pulling is more of a bus-throwing. When the infamous bridge closure scandal rocked the world of Governor Chris Chistie, the New York Daily News editorialized with this headline: “Gov. Chris Christie’s load of bull: Fired aide Bridget Kelly merely a patsy in attempt to shelter Port Authority cronies, himself”. If true, that goes well beyond the innocent if arrogant hair-pull. On the other hand, it would also be a classic case of a leader looking for somebody to take the heat off him, allowing him to stand again with dignity during a major squall. The News put it bluntly:

Christie needed blood to express his outrage to the public, so he drew it from deputy chief of staff Bridget Kelly for the sin, the governor said, of lying to him. Perhaps Kelly did lie, although it seems incredible that anyone would flat-out attempt to deceive an intense, emergency inquiry.

Christie is hardly the first or last leader to throw a direct report under the bus. Consider how many former employees one of our recent presidents tossed under a wide array wheels.

Sometimes, of course, the hair-pull is far more innocuous. How many of us have seen the example of a leader who, making some technology-related or other mistake during a presentation (or otherwise showing some area of ignorance), growls at some poor underling/handler who has been tasked with keeping him or her out of trouble? The inference is always that someone, anyone, is to blame for the hitch, certainly not the leader his or her self.

Then there’s the leader who goes out of his or her way to avoid any hair-pulling, preferring to stumble publicly than to grab at the nearest available head. Those leaders deserve a lot of credit, though I wonder how often they get it. Do they look weak as a result of allowing themselves to stumble? Do we, in fact, expect our leaders to be able to get away with a little hair-pulling now and then? Perhaps it’s all part of the leadership aura.

At any rate, Ishmael casts no particular blame in Moby-Dick. His is an amusing observation, not a sense of outrage. He indicates that like everyone else (and probably more so), leaders play their comic roles on life’s grand stage.

Melvillian Leadership Lesson of the Day: As a leader, try to avoid the hair pull. It does, in fact, make you look nearly as absurd as the stumble it is intended avoid. If you do wind up metaphorically pulling hair, be sure to apologize after the fact. If you’ve pulled hair literally, well, get a good attorney.

Featured image by Samuel Calvert (1828-1913) after sketch by William McMinn

The Gloriously Flawed Leader

One in a series of posts about leadership lessons derived from the classic novel Moby-Dick

In the business world, we love our legendary leaders. They are swash-buckling heroes who take over floundering corporate ships and set them to rights. Every decision they make sparkles like polished brass. Every course they set is true. No, every speech they make rings as brightly as a gold doubloon.

It’s all a bunch of crap, of course. In most cases, even leaders of successful enterprises have done lots of dumb things, from betting on the wrong business models to alienating key employees to engaging in quasi-unethical exploits. But as long as their companies have enjoyed lots of growth during their tenure, most of this gets swept under the proverbial rug, except by the very best business biographers. The flawed leader gets little press.

Melville is more honest about leaders than most of the existing biz lit. The leaders on the Pequod have some lousy qualities along with their good ones. Let’s take the second mate Stubb, for example. He has his fair share of flaws as a leader, but sometimes he makes us proud.

One of those moments occurs in the chapter “The Monkey Rope,” which starts with Ishmael’s noble cannibal buddy Queequeg doing the kind of job that would give your average OSHA official conniptions. Even as crew members with sharp blades strip the whale of its blubber, Queegueg — who is responsible for fixing the whale to the ship with a hook — tries to stand atop the gigantic carcass “half on the whale and half in the water, as the vast mass revolves like a tread-mill beneath him.”

There are lots of options for getting killed or maimed in this job. You can can be sliced with a blade, or smashed between the ship and the whale, or drowned underneath, or even chomped by sharks in a whale-devouring feeding frenzy:

Right in among those sharks was Queequeg; who often pushed them aside with his floundering feet. A thing altogether incredible were it not that attracted by such prey as a dead whale, the otherwise miscellaneously carnivorous shark will seldom touch a man.

It is, in short, a good day’s work, the kind of enterprise that makes your average death-defying harpooner a tad parched. But when the exhausted Queequeg “with blue lips and blood-shot eyes” at last climbs back on board the ship, the ship’s steward hands him a lukewarm cup of ginger and water.

This action sets our flawed leader Stubb off on one of the best libation-based rants in literary history. The following quote is just a portion of his diatribe:

“Ginger? Do I smell ginger?” suspiciously asked Stubb, coming near. “Yes, this must be ginger,” peering into the as yet untasted cup. Then standing as if incredulous for a while, he calmly walked towards the astonished steward slowly saying, “Ginger? ginger? and will you have the goodness to tell me, Mr. Dough-Boy, where lies the virtue of ginger? Ginger! is ginger the sort of fuel you use, Dough-boy, to kindle a fire in this shivering cannibal? Ginger!-what the devil is ginger?-sea-coal? firewood?-lucifer matches?-tinder?-gunpowder?-what the devil is ginger, I say, that you offer this cup to our poor Queequeg here.”

The beleaguered steward claims it was not his idea but that of Aunt Charity, the well-meaning sister of one of the owners of the Pequod. She had given him the ginger and “bade me never give the harpooneers any spirits, but only this ginger-jub-so she called it.”

The Pequod’s harpooners are, of course, all mighty men of the “heathen” (meaning non-Christian) and “savage” (meaning non-White) persuasion. However weirdly racist it may be, Aunt Charity no doubt thought she was doing her Christian duty in protecting the harpooners from the evils of drink. Stubb, to his credit as a leader, would have none of it.

Image by BrokenSphere. A US Navy grog measure cup, ca. 1850 on display at the Marines’ Memorial Hotel in San Francisco, California.

In a comradely show of respect for employee diversity (not to mention dauntlessness), Stubb went down and got a dark flask filled with “strong spirits” and handed it over to Queequeg as a reward for his dangerous work. He also got Aunt Charity’s tea-caddy of ginger and tossed the damned stuff overboard.

The Flawed Leader

Okay, maybe the fact that Stubb bellowed at, bullied and whacked at the order-following steward would disqualify him as Leader of the Year…. even in the 1800s.  And, I suppose that encouraging your employees to drink on the job is not exactly in the HR 101 handbook. Yet, with all his imperfections, Stubb displays a very leader-like quality in standing up for the rights of his talented harpooners to be rewarded after facing down the sharks at work. It should indeed be a right for us all.

Melvillian Leadership Lesson for the Day: By all means, stick up for the rights of your crew when you see them being infringed on, especially when their rights are linked to something as vile as racism. But avoid the kind of blustering and bullying that diminishes your good intentions.

Featured image: Whale Fishing Fac Simile of a wood cut in the cosmographie universelle thevit in polio paris 1574

What Moby-Dick Can Teach Us About Recruitment (Part II)

One in a series of blog posts about management lessons derived from the classic novel Moby-Dick

The Leader as Talent Magnet

Some management gurus have opined that one of a leader’s primary responsibilities is to serve as a “talent magnet” for their firms. If you think this is a modern insight, think again. Chapter 18 of Moby-Dick will set you straight.

This is when Ishmael’s bosom buddy Queequeg arrives on the wharf to sign up as a crew member aboard the fated Pequod. Ishmael, as you may recall, had already been grilled by the ship’s owners, the Abbott-and-Costello-like Captains Peleg and Bildad. He’d been accepted, however halfheartedly, as part of the crew.  Now it is Queequeg’s turn for an interview.

The start of that process was inauspicious enough to make any immigration hard-liner proud: “Captain Peleg in his gruff voice loudly hailed us from his wigwam, saying he had not suspected my friend was a cannibal, and furthermore announcing that he let no cannibals on board that craft, unless they previously produced their papers.”

But wait. Were there green cards back the early 1800s? No, actually, the two diversity-challenged ship owners are looking for proof that Queequeg has converted to Christianity. Ishmael, thinking fast on his feet, blows some smoke about how Queequeg is a member of the “lasting First Congregation of this whole worshiping world; we all belong to that; only some of us cherish some queer crotchets no ways touching the grand belief; in THAT we all join hands.”

Captain Peleg is in no way convinced by this little sermon, but he is amused enough by it to take the job interview to the next step.  So, Queequeg gets the job experience question that had so befuddled Ishmael. “Did you ever stand in the head of a whale-boat?” Peleg asks.

Being of the “show, don’t tell” school of thought, Queequeg jumps directly to the competency assessment part of the interview. Harpoon in hand, he takes aim at a small drop tar floating the water and lets fly: “he darted the iron right over old Bildad’s broad brim, clean across the ship’s decks, and struck the glistening tar spot out of sight.”

A normal interviewer might take it somewhat amiss when a tattooed candidate nearly skewers his partner’s head while demonstrating a skill set. Not Peleg, however. This is a leader with an eye for talent, however unconventionally it’s displayed. Not losing a beat, he shouts, “Quick, I say, you Bildad, and get the ship’s papers. We must have Hedgehog there, I mean Quohog, in one of our boats. Look ye, Quohog, we’ll give ye the ninetieth lay, and that’s more than ever was given a harpooneer yet out of Nantucket.”

Yep, paying well for star talent is nothing new either. Even though Peleg doesn’t know Queequeg’s name much less his religion or anything else, he wastes no time signing him up. Peleg is a talent magnet, alright, and he won’t be losing his chance to attract Queequeg’s iron, come hell or high water.

Melvillian Management Lesson: When you see terrific talent, put aside prejudice and be willing to look beyond conventions. Act quickly (though perhaps not quite as quickly as Peleg) and be willing to pay for that talent. It’ll be a bargain in the long run.

Feature image: Illustration from Moby-Dick - Ishmael and Queequeg are directed to the Pequod, by Augustus Burnham Shute

What Moby-Dick Can Teach Us About Recruitment (Part I)

One in a series of blog posts about management lessons derived from the classic novel Moby-Dick

Today’s Recruitment Lingo

In the 21st century, we breed buzzwords as surely as office cubicles breed germs and intrigue. Buzzwords help us believe in progress, in the idea that our modern management ideas are superior to those invented, say, a couple of centuries ago. Recruitment is a case in point, so let’s look at what Moby-Dick can teach us about recruitment.

We don’t just hire folks anymore, we recruit them. No, strike that. We engage in talent acquisition after burnishing the employer brand.

(Don’t get me wrong. I’m as likely to engage in such language as the next business writer–in fact, considerably more so. What’s more, some of these notions–and accompanying technologies–are quite helpful. Nonetheless, many the ideas themselves, if not the exact language, have been around a very long time.)

In the realm of recruitment, things are especially complicated right now amid the outcomes of the Covid-19 pandemic. We’ve had the so-called great resignation in which lots of employees have left their jobs in search of greener pastures (that is, new jobs, self employment, or no employment at all). This means there’s great pressure to become an employer of choice (i.e., a place where people actually like their jobs), engage in social recruiting (i.e., seek out employees through social media, sometimes leveraging employees’ networks), and tap into the talent community (i.e., groups where we think we can find a decent job candidate or two) via recruitment marketing strategies. It all sounds very modern.

So, should we find it comforting or disturbing to find that talent acquisition wasn’t all that different back in the days of sailing ships and whale-blubber-powered lighting?

Hiring the Clueless Neophyte

To get a feel for this, we can turn to the chapter in Moby-Dick called “The Ship”. There, our narrator Ishmael pokes around the wharf the same way a lot of modern job candidates poke around Indeed.com. Like a newly minted college graduate with a liberal arts degree, Ishmael isn’t that picky. He wants any whaling job that smells of steady income. He is, in short, not someone that employers are willing to engage in a war for talent over.

Like many of today’s prospects, he relies on serendipity as much as anything else. Ishmael chooses from among the three whaling ships that, as luck would have it, are at the docks. How does he make a decision about where to apply? He just “looked around [the ship called Pequod] for a moment, and then decided that this was the very ship for [him and his buddy Queequeg].” Then he stumbles into a tent like a new graduate stumbles into any first interview:

“Is this the Captain of the Pequod?” said I, advancing to the door of the tent.
“Supposing it be the captain of the Pequod, what dost thou want of him?” he demanded.
“I was thinking of shipping.”
“Thou wast, wast thou? I see thou art no Nantucketer—ever been in a stove boat?”
“No, Sir, I never have.”
“Dost know nothing at all about whaling, I dare say—eh?”
“Nothing, Sir; but I have no doubt I shall soon learn. I’ve been several voyages in the merchant service, and I think that—”
“Merchant service be damned. Talk not that lingo to me. Dost see that leg?—I’ll take that leg away from thy stern, if ever thou talkest of the marchant service to me again. Marchant service indeed! I suppose now ye feel considerable proud of having served in those marchant ships. But flukes! man, what makes thee want to go a whaling, eh?—it looks a little suspicious, don’t it, eh?—Hast not been a pirate, hast thou?—Didst not rob thy last Captain, didst thou?—Dost not think of murdering the officers when thou gettest to sea?”

Okay, today’s recruiters may be a tad more subtle and considerably less hilarious, but the nature of the grilling often seems — at least from an emotional, impressionistic viewpoint — similar to the subjective experience of many inexperienced job candidates when the job market is tough: “So, you want a job, eh, supplicant…l mean applicant. What kind of invaluable experience do you have for us? Hmm, yeah, well, that’s pretty unimpressive. So, you’ll learn on the job? I wish I had a doubloon for every time I’ve heard that one. Besides, you look a little shady to me. You know we’re doing to do a background check, don’t you? We’ve also got a few personality tests and integrity tests for you. One can’t be too careful these days…”

Managing Expectations…and Then Some

Then there’s another similarity to our modern age. Captain Peleg, one of the owners of the Pequod, asks Ishmael the hardest question of all. Why do you want this job? Or, as he puts it, “What takes thee a-whaling? I want to know that before I think of shipping ye.”

Like any not-super-attractive, neophyte job candidate, Ishmael knows not to state the obvious answer:  “Cause I need food and shelter.” He intuits Peleg is looking for something more, as we’d say today, aspirational,  so he responds, “Well, sir, I want to see what whaling is. I want to see the world.”

And this is where Peleg, like any good interviewer, delivers a dose of reality to this low-level applicant. Today, we call it “managing expectations.” Peleg orders a puzzled Ishmael to “take a peep over the weather-bow” and then report back to him. The baffled Ishmael takes a gander and then tells Peleg that he saw “nothing but water; considerable horizon though.”

This watery sight is all the world that Ishmael will see if he goes whaling, Peleg assures him. Ishmael is  “a little staggered” by this insight but perseveres in his job quest. Peleg finally hires him for a pittance after a wonderful good guy/bad guy discussion with his business partner, Captain Bildad. Together they teach us about recruitment circa 1800s.

As a leader/recruiter, Captain Peleg has done his job. He’s vetted a decent if desperate entry-level candidate even while making him feel a bit unworthy and downright lucky to land the job. (This is, of course, not recommended for today’s recruiters.)

He’s even done his best to disillusion the applicant about any unrealistic expectations.  After all, Peleg needs somebody who will fit the culture, as we’d say today. No manager wants to hire someone who will wind up feeling deceived and mutinous after the first week on the job.

As for Ishmael, notice that he never divulges the fact that he has been a schoolmaster. He doesn’t need the “you’re overqualified for this job” speech from Peleg. Some things are better left unsaid in the interview process. On the other hand, Ishmael does mention he has a friend who is also looking for a job.  “Fetch him along, and we’ll look at him,” says Captain Peleg, who knows full well the power of “social recruiting.”

Melvillian Management Lesson

The recruitment process was subject to stereotypes and satire back in the era of Ahab, and remains so. Much has changed but much remains similar. Recruitment is, by definition, a judgmental process, one that strikes many people as threatening. (The applicant is threatened he or she will be rejected and the recruiter is threatened that he or she will make the wrong decision or give the wrong impression and be blamed for it).

The trick for the recruiters and leaders of any organization is to make the process both more effective and more humane. At the moment, that’s all to the good. Many employers are hungry for employees. But what happens in the next recession? Sooner or later, many a job candidate will find out.

Featured image: Herman Melville, American author. Reproduction of photograph, frontispiece to Journal Up the Straits.

The ABCs of Python: “with,” “yield” and the magic of egg production

We arrive at our last two Python keywords: “with” and “yield”

We could get all esoteric on you with these two words, but we’ll try to keep it simple.


Be patient. There’s a payoff. The keyword with  “is used to wrap the execution of a block of code within methods defined by the context manager,” according to programiz. The official documentation states,  “[T]he ‘with‘ statement clarifies code that previously would use try…finally blocks to ensure that clean-up code is executed.”

Got it? If not, that’s okay. The bottom line is that you can use with to toss text into another file and then make sure that file is closed at the end of the process. Try this: create an ordinary text file called “write_to.txt” and put it in the same directory as your other python files. Close that file. Now, use your editor to write the following code and then run it.

with open('write_to.txt', 'w') as a_file:
    a_file.write('I am writing this into the write_to document')
    print("I wrote to 'write_to'")

In addition to printing “I wrote to ‘write_to'” into your shell, this code should print “I am writing this into the write_to document” into (you guessed it) that “write_to.txt” document you just created. To check, go open that doc up and see what’s there.



Okay, this is the last keyword on our list (yay!). Remember return? Well, yield is a more powerful return (sort of). When you use return in a function, you produce just one thing (even if it’s one long list). When you use yield, you can produce a virtual deluge of them if you like. BUT you produce them one at a time so you don’t wind up with some hellaciously large list.

If you’re confused, just hang on a sec. We’ll try to make it pretty concrete.

The keyword yield produces a doo-dad called a generator. A generator, as you might expect, generates stuff. Here’s an example that is modified but based on the elegant one provided by the programiz folks:

def generates_eggs():
    e = "egg "
    for i in range(20):
        yield i*e

g = generates_eggs()
for i in g:

If you run that, you get a lot lines made up of the word “egg.” Each line is a word longer than the previous one because the function using yield generates an ever larger number (up to 19, in this case) of eggs. Therefore, you should get something that looks like this:

egg egg
egg egg egg
egg egg egg egg
egg egg egg egg egg
egg egg egg egg egg egg
egg egg egg egg egg egg egg
egg egg egg egg egg egg egg egg
egg egg egg egg egg egg egg egg egg
egg egg egg egg egg egg egg egg egg egg
egg egg egg egg egg egg egg egg egg egg egg
egg egg egg egg egg egg egg egg egg egg egg egg
egg egg egg egg egg egg egg egg egg egg egg egg egg
egg egg egg egg egg egg egg egg egg egg egg egg egg egg
egg egg egg egg egg egg egg egg egg egg egg egg egg egg egg
egg egg egg egg egg egg egg egg egg egg egg egg egg egg egg egg
egg egg egg egg egg egg egg egg egg egg egg egg egg egg egg egg egg
egg egg egg egg egg egg egg egg egg egg egg egg egg egg egg egg egg egg
egg egg egg egg egg egg egg egg egg egg egg egg egg egg egg egg egg egg egg

Back in the day, you might have called that concrete poetry. But today we’ll just call it a whole heckova lot of eggs, brought to you by yield.

For a more sophisticated explanation of yield, check out How to Use Generators and yield in Python.

And for much fuller explanation of with, check out The Python “with” Statement by Example.

Featured image by Edithobayaa1: a crate of eggs in Ghana

The ABCs of Python: “not,” “or,” “and” in coded cummings

The Python keywords not, or and and (the last of which we already discussed  once here) are not just critical parts of the language but critical concepts in their own right. Together, these three are the foundation of Boolean logic, which extends well beyond the world of Python into other features of our modern technological landscape.

For example, periodical search engines tend to run on Boolean logic, allowing users to refine their searches through these three terms. And, in electronics there are Boolean-based logic gates that perform logical inputs in order to produce a single logical output.

In Python, Booleans work in much the same way. Using them in any given function as operators, you can handle all kinds of inputs that can be distilled into a single True or False statement.

By the way, beginners may get confused about how statements with these operators work. If you have a line such as “if dog and cat,” what you really mean is “if dog and cat are both True.” Python assumes the “are both True” part.

Let’s say, for example, that you create variables called “stars” and “sky” and assign them some value. Then, if you put down the line “if stars and sky,” Python will automatically recognize that statement as being True. Like so:

stars = 1000000000
sky = 1
if stars and sky:
    print("let there be light!")


An and is used for the process of conjunction, which means two or more things need to be True for a statement to be True, as in:

dog = True
cat = True
if dog and cat:
    print ("yep, you have a dog and a cat in your house")

#this will print "yep, you have a dog and a cat in your house"


Or signifies the process of disjunction. That is, only one of various statements needs to be True for the whole statement to be True.

dog = False
cat = True
if dog or cat:
    print ("yep, you have a dog or a cat in your house")

#this prints "yep, you have a dog or a cat in your house"


Not signifies the process of  negation, of course. In this case, negative statements are True, as counter-intuitive as that sounds.

dog = False
cat = False
if not dog or cat:
    print ("yep, you don't have either a dog or a cat in your house")

#this prints, "yep, you don't have either a dog or a cat in your house"

 While Not ee cummings

Remember “while”? Well, we can combine the Python keywords of “while” and “not” to create code that keeps looping back until we get something right.

I’m an ee cummings fan. He’s playful, lyrical, witty, experimental and devastatingly creative all at once. When I started thinking about Booleans, I was reminded of his poem “as freedom is a breakfast food”, which is jam-packed with “ands and “ors“. Then I thought maybe we could use “not” to play around with the poem. Here’s the poem’s first stanza:

as freedom is a breakfastfood

or truth can live with right and wrong

or molehills are from mountains made

—long enough and just so long

will being pay the rent of seem

and genius please the talentgang

and water most encourage flame

As an homage to cummings, I wrote the following function:

def cummings():
    freedom = ''
    truth = ''
    molehills = ''
    while not (freedom == "as freedom is a breakfast food"):
        print ("As freedom is a what?")
        freedom = input()
    while not (truth == "or truth can live with right and wrong"):
        print ("Or truth can live with what?")
        truth = input()
    while not (molehills == "or molehills are from mountains made"):
        print ("Or molehills are made from what?")
        molehills = input()
   print ("long enough and just so long")
   print ("will being pay the rent of seem")
   print ("and genius please the talentgang")
   print ("and water most encourage flame")


By combining “while” and “not,” you can create a function that continues to ask you questions until you get the answer right. That is, while you do not have the right answer, you keep getting the same query. That’s what “input ()” does.

Remember, you can use Control-C to get out of a loop if you’re stuck. When you run this code by calling the function (that is, by adding “cummings ()”), you need to type in the first three lines of the stanza correctly to get the rest of the stanza printed out. Here’s how the output looks in your IDLE shell:

As freedom is a what?
as freedom is a breakfast food
Or truth can live with what?
or truth can live with right and wrong
Or molehills are made from what?
or molehills are from mountains made
long enough and just so long
will being pay the rent of seem
and genius please the talentgang
and water most encourage flame

PS: By the way, for those inclined toward irony, there actually is a breakfast brand called Freedom these days. I imagine cummings would have been amused. Something about it reminds me of another cummings line: “The snow doesn’t give a soft white damn whom it touches.”

Featured image from New York World-Telegram and the Sun staff photographer: Albertin, Walter, photographer.

Editor’s Note

Editor’s Note

I can’t believe that you dare

turn this in to me.

I produce more (and better)

while reading the paper on the john

in the thin morning light.

Never again put such a paltry

sliver of labor on my plate.

I want a full slab,

something still bloody and

pulsing with the effort

of a full day’s toil.

I want both of us to know

you’ve swapped this fair

irretrievable day for

a valiant, stunning battle

against your own God-given mediocrity.

Life is too short

(you soulless lout)

for anything less

than sacrifice.

Editor’s Note was originally published in WRITERS’ Journal

For other of my fiction and poety, see Fiction/Poetry

Featured image: "Quarters of the news editor", one of a group of four photos in the 1900 brochure Seattle and the Orient, which was collectively captioned "The Seattle Daily Times — Editorial Department".

The ABCs of Python: “raise,” “return,” “while” and knowing when to quit

Here are three more Python keywords. I know they look like a bit of a hodgepodge. Perhaps I should have discussed raise when I discussed the other exception handling words and while when covering for and in.  But, at least this way I get to keep some semblance of alphabetical order. What’s more, as I wrote this, I realized there’s a common theme for all these keywords: that is, they help our code know when to quit.


Among Python keywords, raise is used to “raise” a virtual penalty flag for the user, telling them that there’s a problem.  You may remember our power_up_index function from before. We’re going to put it back into action, except we’ll engage the keyword raise.

def power_up_index(array, n):    

    Find Nth power of the element with index N.

    if len(array) < (n +1):
        raise IndexError
        return array[n]**n
print(power_up_index ([20, 12, 99, 15, 78], 3))
n is the number 3 in this case. So, you pick the third
number, which is 15 in this case, and multiply that 
number by itself three times.

print(power_up_index([1, 2, 3, 4], 2)) #you multiply the second number, which is 3 
                                       #since Python counts from 0, 
                                       #by itself two times so you get 9

print(power_up_index([1, 2], 3))
you get an error message -- specifically an IndexError -- 
because the computer cannot locate the third number in 
this array (which only has two numbers,
as you can see).

This code will produce something like this:

raise IndexError


When first learning to code in Python, there were few words more puzzling  to me than return.   I kept wanting to use print statements in lieu of return because I could see some results from print statements whereas not much seemed to be happening when I used return.  I didn’t quite grok its critical function. The depth of ignorance must seem bonkers to any seasoned coder.

So, when do you use return and what does it do? Here’s a metaphor. There’s a busy person who never goes to the post office or a public mail box to post a letter. Instead, she sticks her outgoing mail in her private mailbox when she is leaving to go to work in the morning. The postal worker picks up her outgoing mail and then posts it for her.

In a sense, this is how return works.  It only lives inside a function, as the woman lives in her house. It is used to exit the function and provide some sort of value. So, imagine the woman going to her mailbox and posting a letter with a single value on it. Maybe the value is a number or a string or a Boolean, but it’s something useful.  That message gets sent somewhere else (maybe to another function) where it becomes essential input. Failing to put the return in the function is sort of writing a letter and then forgetting to put it in the box. Nobody gets it.

It’s also sort of like posting a blank sheet of paper. That is, when you forget to add a return statement, the function will not know what to do and so just spit out the word None.

Of course, a simpler metaphor is that return hits the Enter key in your code. You’re not going to input much without hitting that key.

Anyway, here’s a quick example of how it works, an example inspired by the one in Programiz:

def send_letter():
    x = "letter"
    return x


def send_nothing():
    x = "letter"


If we run this code, we’ll see that the first print statement produces the word “letter”. The second one, however, will produce “None”. That’s because we forgot to “post the letter” — that is, forgot to add the return statement in that function.

I should note that there are cases of functions that don’t require a return, such as the on-the-fly functions produced with lambda.  And there is also code that only needs to do something (such as print a statement) without returning anything. But let’s keep things simple for now. Just remember that if you write a function without a return, then the function doesn’t produce a value (except for None) even if the rest of the code in your function is perfect.


We won’t dwell too much on the supremely powerful while keyword because I wrote a whole post on it before. Just remember that while is used to create loops and that those loops will continue to run until the condition (or conditions) for them no longer applies (or until the loop runs smack into a break statement).  If you write a while statement incorrectly (which is not so hard to do), your code will get stuck in an infinite loop that will ultimately crash your program (if that happens, use Control-C). Here’s a simple program that uses while.

numbers = list()
counter = 0
while (counter <= 20):
    counter = counter+2

You should end up with a list like this: [0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20]

Note that this program hinges on the line counter = counter+2. That line increases the value of counter until it is equal to or more than 20, thereby letting the code know when to stop  And knowing when to stop is one of the great secrets in life

For more information on Python keywords, I recommend Zetcode

The ABCs of Python: The Not-Nothingness of “None”

Another Python keyword. This time it’s a widely misunderstood and high-profile one:


None is not what your typical English-speaking, non-coder might expect. That is, None is not just another way of expressing zero (or zip, zilch, nada, bubkis, or diddly–squat, for that matter). In fact, None is not equal to zero at all. If we assert that None is equal to zero, Python will set us straight, as follows:

>>> None == 0

None is also not equal to an empty list:

>>> None == []

As we mentioned when discussing del, you don’t utterly eradicate something when you assign it to None. Rather, None indicates that something doesn’t have a specific value even though it exists as an object. It literally becomes a “Nonetype,” which is a unique ghost in the Python universe.

>>> x = None
>>> x
>>> type(x)
<class 'NoneType'>

So, what the heck does one do with a NoneType, anyway?

In a sense, your function will return None as a sort of last resort or shrug of the shoulders. It says, “Yeah, this is all I got and it’s pretty much bubkis” and then shoots out a None.  For example, try to call and print the following function:

def return_not_nothing():
    big = "a big fat bowl"
    nearly_null = " of not nothing"
    squat = big + nearly_null
    return squat

If we run this code, it produces “a big fat bowl of not nothing”

Now, run it again without officially returning anything (that is, without the last line of the function).

def return_not_nothing():
    big = "a big fat bowl"
    nearly_null = " of not nothing"
    squat = big + nearly_null

This time the code produces None.

Why? Because even though the code is doing something, it doesn’t actually produce a value. In lieu of a value, it automatically returns None.

Sometimes a function will usually return a value but occasionally return None. The function below, for example, will return a None about one out of 10 times. That’s because we haven’t told it to return anything in particular if random.randint selects a six.

import random
def re_turn_squat ():
   big = "big fat bowl"
   null = " of not nothing"
   if random.randint(1,10) != 6:
       squat = big + null
       return squat

So, is None the same as null in some other computer languages? Well, it can be a close cousin, but None is not the lack of an object (as a null reference can apparently be) but, as we mentioned, a kind of unique object. Using my best Zen-like thinking, I tend to think of it as the sound of one computer shrugging.

For a deeper look at None, I recommend the following:


The History of Python


Featured image is the enso, a symbol of Zen Buddhism,
 by Zenwhat

The ABCs of Python: The Silence of the “lambda”

Just for minute or so, forget what Python keyword “lambda” can do for you. Savor the sound of the word itself. The accent is on the first syllable. It has a sophisticated, round and educated sound to it.

It’s also a cool-looking word in English, partly because it’s redolent of various animals: lamb, lama, panda. You can just about envision its surreal advent through a shadowy forest.

The word also feels ancient, and so it is, being the 11th letter of the Greek alphabet. Some version of the lambda sound probably rolled off Homer’s tongue as he chanted his epic poems.  We can imagine Sophocles using it to write his tragedies, Herodotus his histories, Aristophanes his comedies, and Aristotle his philosophies.

Since the time of those famous ancients, this one letter name has taken on many other meanings. There is lambda as a type of calculus, and lambda the junction in the brain, lambda the uncharged and unstable elementary particle, and lambda the phage.

And then there’s lambda the Python keyword, the one that can be used to create small, anonymous functions and procedures that are often concocted on the fly, nearly as obscure, silent and subtle as the elementary particle or the bacterial virus.

Lambda is something Python beginners should learn, if only to be able to comprehend the more Pythonic lines of code written by the more practiced wielders of the form. There have been times when I’ve written programs of 20 lines or more, only to discover that the same purpose could be achieved in one or two written with the lambda. It’s simultaneously breath-taking and maddening. (I should note, though, that lambda isn’t magic. You can write very succinct code when using standard forms of functions, as well. But lambda can help condense and add flair.)

Here’s an example of a simple function with the familiar def:

def cubism (root):
    return root**3

Now here’s an example of lambda equivalent:

y = lambda x: x**3
print (y(10))

They do the same thing and get the same result (that is, 1000). We could even use the same terms, if we like. The lambda version is, however, a little less easy to read for the beginner unfamiliar with its syntax. That is due, in part, to the fact that lambda doesn’t need a return. Python automatically returns whatever expression is provided: in this case, x**3.

(By the way, an “expression” is code that returns some sort of value, as Python Conquers The Universe makes clear.  Lambda is more limited than a normal function in that it can only take one expression.)

Lambda often goes hand in hand with tools such as filter(), map() and sort(). Let’s use sort() on a list of the dwarves from The Hobbit to give you an idea of how it works. Here, we are using lambda to create three different functions on the fly that give us the list sorted by three different criteria:

We tell sorted to sort the tuples by a specific “key,” and that key is a lambda function. For example, in the first one, “lambda height” tells Python, “We are defining a quick function called ‘height’.” The next part, which is “height[1]”, works on the second item in each tuple in the list, all of which are indicators of the height of the dwarves.

Image by Rotox: Wikipedia
dwarves = [
('Fili', 126, 'blue'),
('Kili', 125, 'blue'),
('Oin', 134, 'brown'),
('Gloin', 136, 'brown'),
('Dwalin', 132, 'green'),
('Balin', 139, 'red'),
('Bifur', 137, 'yellow'),
('Bofur', 135, 'yellow'),
('Bombur', 140, 'green'),
('Dori', 141, 'purple'),
('Nori', 138, 'purple'),
('Ori', 133, 'grey'),
('Thorin Oakenshield', 145, 'blue')

print("A list of the Thorin's company sorted by height in cm: " 
+ str(sorted(dwarves, key=lambda height: height[1])))


print("A list of the Thorin's company sorted by name: " 
+ str(sorted(dwarves, key=lambda name: name[0])))


print("A list of the Thorin's company sorted by color of hood: " + str(sorted(dwarves, key=lambda hood: hood[2])))

We get the following:

A list of the Thorin’s company sorted by height in cm: [(‘Kili’, 125, ‘blue’), (‘Fili’, 126, ‘blue’), (‘Dwalin’, 132, ‘green’), (‘Ori’, 133, ‘grey’), (‘Oin’, 134, ‘brown’), (‘Bofur’, 135, ‘yellow’), (‘Gloin’, 136, ‘brown’), (‘Bifur’, 137, ‘yellow’), (‘Nori’, 138, ‘purple’), (‘Balin’, 139, ‘red’), (‘Bombur’, 140, ‘green’), (‘Dori’, 141, ‘purple’), (‘Thorin Oakenshield’, 145, ‘blue’)]

A list of the Thorin’s company sorted by name: [(‘Balin’, 139, ‘red’), (‘Bifur’, 137, ‘yellow’), (‘Bofur’, 135, ‘yellow’), (‘Bombur’, 140, ‘green’), (‘Dori’, 141, ‘purple’), (‘Dwalin’, 132, ‘green’), (‘Fili’, 126, ‘blue’), (‘Gloin’, 136, ‘brown’), (‘Kili’, 125, ‘blue’), (‘Nori’, 138, ‘purple’), (‘Oin’, 134, ‘brown’), (‘Ori’, 133, ‘grey’), (‘Thorin Oakenshield’, 145, ‘blue’)]

A list of the Thorin’s company sorted by color of hood: [(‘Fili’, 126, ‘blue’), (‘Kili’, 125, ‘blue’), (‘Thorin Oakenshield’, 145, ‘blue’), (‘Oin’, 134, ‘brown’), (‘Gloin’, 136, ‘brown’), (‘Dwalin’, 132, ‘green’), (‘Bombur’, 140, ‘green’), (‘Ori’, 133, ‘grey’), (‘Dori’, 141, ‘purple’), (‘Nori’, 138, ‘purple’), (‘Balin’, 139, ‘red’), (‘Bifur’, 137, ‘yellow’), (‘Bofur’, 135, ‘yellow’)]

Okay, there’s more to be said on the subject of lambda, but this gives you at least glimpse of the strange beast. For more on lambda, I recommend the following:

Yet Another Lambda Tutorial


Official Python Documentation on Lambda Expressions