Monday, July 21, 2008

Python debugging

So I just discovered the awesomeness that is ipython -- specifically, the awesomeness that is the ipython embedded shell.

Ever wished you could just stop at a given point in your program and start poking around using the handy dandy python shell? Here's how.

# We clear the args because arguments to your program will confuse IPython
import sys
sys.argv = []
# And now we embed a shell...
from IPython.Shell import IPShellEmbed
ipshell = IPShellEmbed()

This even works from in the midst of a GUI (I use it in the midst of my gtk program).

For a lazy programmer like me, this is a godsend. Now rather than reading back through my code to find out what I need to do, I can plop the below code wherever I'm in the midst of working, then find myself landed in a shell where I can inspect my objects, variables, etc., figure out just what I need to add to my code, and give it a test run.

Wednesday, July 16, 2008

D.A.R.E., fear-mongering, and a question about identity fear

So when I was in high school, it was a cliche to make fun of D.A.R.E. as a fear-mongering, ineffective program. I don't actually remember if I ever went through the D.A.R.E. program, so I can't comment on whether it was or was not effective or fear-mongering as a high school program, but I had an experience today where I was accosted by a D.A.R.E. representative on the street in my role as parent (I was with Grace), and I learned that our local D.A.R.E. folks were involved in a whole new kind of fear-mongering: working off of the fear of medical emergencies (and, oddly, identity theft).

What the D.A.R.E. representative tried to sell me on was not (as I would have guessed) donating to D.A.R.E. Instead, she wanted to sell me, for a mere forty dollars, an identity card for Grace that would include medical information about her and give permission to treat her in case of emergency. She showed me a sample card and explained that it was an "official" something-or-other. She then reassured me that the card wouldn't have Grace's full name on it, so if it fell into the wrong hands, I wouldn't have to worry.

This raised a number of questions for me. Some of them rhetorical, some genuine (actually, maybe they're all both rhetorical and genuine):
  1. If a child were to show up in an emergency with a treatable, life-threatening condition and no guardian present, would they deny treatment? I somehow feel like they wouldn't (it's also hard for me to imagine just how Grace could end up in such a scenario, but I understand that in order to get into the proper D.A.R.E. mind-set I am to imagine the worst of all scenarios in the worst of all worlds...)
  2. Is there in fact a subset of plastic-like-identity cards that are "official"? What makes them so?
  3. Why would I be afraid of someone finding out my daughter's name? Aren't names public information? Is there anything scary that can happen to her with her name known that couldn't happen to her with her name unknown? (I've heard the name worry come up in a web context. A number of students have told me they're allowed to have facebooks/myspaces/etc., so long as they don't use their full name, or their last name, or what have you. I presume that the fear behind this is that someone will see their picture, decide to stalk them, and then, knowing their name, be able to track down their home address, etc. Are there other things about names that I should be afraid of that I don't know?)
  4. Why is D.A.R.E. selling medical-alert-ish identity cards? (Note: I couldn't find anything about this on their website, nor could I find the cards -- is it possible the D.A.R.E. table in Arlington center was actually entirely a scam? seems unlikely...)
If anyone knows the answer to these questions, I'd be interested to hear them.

Fall from Grace

I am trying to write more, and it also occurs to me that I'd like to be blogging more. I thought about setting up a content-specific blog -- but it's hard to anticipate what I'll be writing about, so I'm hoping that the "labels" feature of blogger will enable me to categorize things usefully, so that someone interested in the teaching side of this blog can avoid my sentimental musings on parenting and so on.

Speaking of sentimental, let me start off this blog from a journal entry I wrote earlier today. This week I'm on solo-parenting duty while K takes a class at UMass Boston. I've gotten into the routine of taking Grace out for a walk for her first morning nap -- usually I end up at our local Starbucks or one of its competitors and it gives me time to read or write in my journal. Here's an excerpt from this morning's journal:

Back at the same table -- again, Grace asleep on my chest. Yesterday on the radio I heard a stroke survivor describing her stroke as an enlightenment-like experience. Her left brain was choked off in the stroke, leaving her mind thoroughly in the present and giving her a feeling of connectedness and unity (what James called a mystical experience). I dabbled in just enough Buddhism in college to intuit, along with the survivor, that this was a kind of ground of experience or being, though I realize there's no good reason to think that connectedness is any more fundamental to our sense of being than any other part of our psyche (say, the list-making or anxiety-generating functions of the brain). Still, she described her experience as a kind of return to infancy, and that struck me suddenly, the way nearly anything to do with childhood strikes me since I became a father.

I have been struck often by the sheer joy I see in Grace -- it's hard not to think that that boundless, unrestrained joy is in fact a default setting for humanness, a ground of being, what we feel when nothing stands in the way. And for now, for Grace, the obstacles to joy are small and generally easy to overcome -- she is hungry or tired or uncomfortable. It's hard not to imagine growing up as a kind of fall from grace, to think of consciousness as an accumulation of obstacles that stand between self and unadulterated joy.

Yet sometimes it is that very fall that makes my heart move as I see Grace the person emerging. More and more she cries not from hunger but from more unique wants -- there is something out of reach and she can't get it, or, try as she might to crawl, she just pushes herself further and further away from her destination -- her backwards crawling so cute to us until a pout quivers onto her face and slowly but surely breaks into tears of frustration.

There is an easy spiritual metaphor in that. Her desire, Desire itself, pushing her away from Joy, which is, ultimately, what she desires.

(And now I notice a teenager in line, glossy lipped, her hair teased out model-like, a pout planted firmly on her lips -- how many desires and anxieties tell the story of her crossed arms, her polished and painted nails, her mini-skirt, the words across her t-shirt, her dramatic stance -- how adult she looks, how thoroughly sad)

But surely this line of thought, the Golden Age, the Fall, leads ultimately to a kind of misanthropy. It is hard not to want to protect Grace from this (now she is waking up as I write this), but isn't the real thing to celebrate every little piece of being human as she discovers it--every tear, every grasp and frustration and laugh -- and now I'm starting to cry just watching her wake up in Starbucks -- isn't that the thing, even here, to wake up, to bring a tear.

I told you that would be sentimental. It's what's been happening to me lately. I cry at everything. I am so happy.