The wonderful KatieKodes wrote a piece on making her minimum viable build tutorials. The process includes staying as far away as possible from the magic keywords inherent in site generators, CMSs, and systems of all types. Words like:
Most tutorials use the generic variable name
file for reading/writing examples. Something like:
with open('input.txt', 'r') as file: # do something with `file`
That’s always bugged me. First, I try to make meaningful names. Second,
file feels like it should be a reserved word. It’s not, but it feels like it should be. Anyways, what she did was preface it with an underscore.
with open('input.txt', 'r') as _file: # do something with `_file`
I love it.
In python, the leading underscore is used to let developers know the variable is meant for internal use. That’s great and all, but I love the visual distinction it makes about not being a keyword.
Combining that and Katie’s piece got me thinking about using underscores to de-magic keywords. Instead of using leading underscores (which have implicit meaning in Python), I was thinking of a trailing ones. Turns out, this is not an original thought. It’s explicitly listed in Python’s PEP 8 style guide.
But, after playing with them, I’m not sure I like the look:
Feels like I didn’t finish writing the variable name. It also feels like there’s meaning associated with it. Like it’s a type of keyword on it’s own. Not unreasonable since double underscores in things like
__init__ are meaningful.
So, what if we use the underscore, but in a different place? What if we put it after the first character? We get something like this:
Or, maybe before the last one:
Of course, you could also do every letter:
That looks nicer, but it’s super tedious to type.
So, what about prefacing with a letter:
a even provides a little meaning. Or, at least, it’s not inaccurate even if it’s redundant from a naming perspective.
Or, maybe, use
I really like that one.
Whatever the case, I hadn’t thought about these options before.
Definitely something to play with.
Random Related Links
Not to end the night on a downer. It's going to be Friday in 21 min. which means only 8 or so hours of work will the weekend.
I saw Dilert a few times when I was in College. Didn't find it funny at all. I now work in a fairly corporate environment and find it…
Some thoughts on digital gardening. You don't have to have things totally edited to post them. For example, I'd normally spend a big chunk…
New Music: Mike Doughty
Just came up on random. Mike Doughty 's track "Looking at the World from the Bottom of a Well" which is on the album Haughty Melodic. If…
... like a dog
According to this page the etymology of working like a dog isn't that exotic which is a little disappointing. Never the less, I feel like…
Musician Josh Rouse
Heard an NPR interview this morning with Josh Rouse about his album that is about to come out. Really liked both the interview and the…
The Clicky Sound
Okay. Just make the clickly sound. clickity, click This isn't the start. It's just making the sound. clickity, clickity, click Don't worry…
I really get a kick out of the show "Mythbusters" on the Discovery channel. Problem solving, science, not infrequent explosions and urban…
Google Site Search Bookmarklet
I use Firefox. I use Google. Often while I'm browsing a web site in Firefox, I want to use Google to search that site (and only that site…
Why don't washing machines have buzzers?
Just about ever dryer I've seen has one, but the washing machines don't. Best thing I can come up with is "they" figure you will hear the…
Blog may go bye bye for a bit
I'm about to move my site from one host to another. In this process, I'm probably going to break lots of stuff, including the blog. So, it…
Someday, I'll get to Inbox Zero
I should make Inbox Zero a higher priority. Ironically, I feel like I have too much going on right now to mess with the way I work.
Hi Ted (plus Battlestar)
Hello back to you Ted. Good to hear from you. Or, read from you, or whatever. Chalk another one up for the internet on the reconnecting…
Checking web page efficiency
This is more a note for myself so that I can find it later. But if you ever want to see more about what's going on when your web browser…
Apparently I need to keep an extra belt in the trunk of my car for those time when I forget to put one on. Like today.
Back to Mac
After several years of working on Windows XP machines, I've recently made the switch back to Mac. The difference is profound and makes me…
Weapon of Choice: Dune
Just figured this one out. In Fatboy Slims' " Weapon of Choice " (you know, the one with Christoper Walken), on of the lines is something…
I don't know about you, but I'm tired of the Terror
I'm hoping that eventually the "always looking for the next thing" spirit will move us away from the constant Terror, Terror, Terror thing…
New quiet case
I've been trying to make my computer as quite as possible for a while now. Just got a new case to help the cause. It's an Antec P180 that…
Ad that keeps your attention
Vonage has an ad going right now that does a great job of holding your attention. In the foreground is a guy standing outside a building…
April Fool's Day lasts for years on the web
The web has its own version of the time/space continuum. It's kinda two dimensional when you look at it on a screen, but those dimensions…
That Guy In Saving Private Ryan Looks Really Familiar
Spoiler Alert: If you haven't seen "Saving Private Ryan", a minor plot point is referenced below. You've been warned. Also, you are way, way…
Quick E-mail Backup Hack
I just saw something about a hack that I use and wanted to pass it on. If you have some files that you need to have backed that are way more…
Fun with SpellCheck
Okay, so in the post about not shopping about Best Buy I ran a spell check. Apparently I didn't hit "Ignore All" when it didn't know what…
The tornado missed me
I was in ATL again this week. Spent a few days this go round including Friday night when a tornado hit downtown including the Georgia Dome…
Just watched V for Vendetta. Moving aside for a moment the fact that I find Natalie Portman mesmerizing, I think the film is wonderful…
New Hard Drive..... and the cable
Just got a new hard drive to get some more room on my computer. This one is the first "SATA" hard drive I've bought. Only problem so far is…
Damn good TV. The Wire on HBO came back after a long ass time. Love that show. If you haven't watched it, I recommend renting the DVDs and…
Create High Quality GIFs with ffmpeg
TL;DR This command uses ffmpeg to convert a video into a high quality GIF: This is the same thing, but it clips out a section of the video…