Lindsey Kuper (lindseykuper) wrote,
Lindsey Kuper
lindseykuper

"Accordian" Patience

Well, yesterday Seamus conform threw down and did another one of these problems, so I decided to give it a shot as well (without looking at his solution). I was just getting started when Alex oniugnip looked over my shoulder.

"What are you going to use to represent cards and decks?"
"Uh..."
"I think those want to be classes."

Famous last words. A day later, I finally finished my ridiculously object-oriented solution. (And it works, too!) Seriously, you guys: I'm getting excited about Python. I started digging in hard because I'm trying to prepare for an interview, but I'm finding that I actually really, really like it. For example, the for ... in ... construct: give it a list, and it knows you want to iterate over elements. Give it a string, and it knows you want characters. A dictionary? It knows you want keys! A frickin' filehandle? It knows you want lines in the file! See what I mean? It's smart enough to understand you! Or actually, maybe what I'm trying to say that it's smart enough to be exactly dumb enough to understand you, because anything that implements the iteration interface is fine. See? See? Isn't it cool? If this had been how I had learned about polymorphism when I was in school, it wouldn't have made me want to drive nails into my head!

Tags: programming
Subscribe

  • Unknown knowns

    Last night I went to see my friend Peter Alvaro give a talk based on Joseph Halpern's paper "Using Reasoning about Knowledge to Analyze…

  • My dissertation abstract

    So I need to write an abstract for my dissertation. Anyone wanna glance over this and tell me what you think? If you suggest any edits, keep in…

  • Gertrude Stein on distributed replicas

    There are many that I know and they know it, they are all of them repeating and I hear it, sometimes I tell it, mostly I tell it, there are many…

  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

  • 21 comments

  • Unknown knowns

    Last night I went to see my friend Peter Alvaro give a talk based on Joseph Halpern's paper "Using Reasoning about Knowledge to Analyze…

  • My dissertation abstract

    So I need to write an abstract for my dissertation. Anyone wanna glance over this and tell me what you think? If you suggest any edits, keep in…

  • Gertrude Stein on distributed replicas

    There are many that I know and they know it, they are all of them repeating and I hear it, sometimes I tell it, mostly I tell it, there are many…