Tiny Mouse

Author's details

Name: Tiny Mouse
Date registered: October 5, 2010

Latest posts

  1. So you want to mock python’s open. — September 24, 2014
  2. Must Read This Later — February 29, 2012
  3. Bad Error Message is Unhelpful — August 29, 2011
  4. __new__ vs. __init__ — July 21, 2011
  5. I’m going to waste so much time with this — July 6, 2011

Most commented posts

  1. PyCon2011 Proposal — 3 comments
  2. Playing with Google AppEngine (part 1) — 1 comment
  3. Way to go SanFran! — 1 comment
  4. PyCon Talk Declined — 1 comment

Author's posts listings


So you want to mock python’s open.

It’s kind of silly. You can’t use the decorator form of mock.patch since this version doesn’t return anything, so you have to use the context manager version. mock_open = mock.mock_open() with mock.patch(‘your.module.path.open’, mock_open, create=True): thing.you_are_testing_that_uses_open(your, params, here) mock_open.assert…


Must Read This Later

A comparison of scripting languages.


Bad Error Message is Unhelpful

So, I’m still learning Django and have a long ways to go, but the following error is extremely unhelpful: “TemplateSyntaxError: Invalid block tag: ‘else’, expected ‘else’ or ‘endif’” The problem is, Django doesn’t do else if, but my editor does highlight it as if it’s correct. You then get this error message, but have to …

Continue reading »


__new__ vs. __init__

While running around debugging some timeouts with a coworker we came across __new__. Of course we were then curious as to what __new__ was and how it was different than __init__.  There was a good explanation on StackOverflow.  Although I understand it now, I’m not sure when I would need to subclass an immutable type.  …

Continue reading »


I’m going to waste so much time with this

http://www.incredibox.fr/bigbox_en.swf IT MAKES MUSIC!!!


The Balloonist

Not my joke, but hilarious: A woman in a hot air balloon realized she was lost. She reduced altitude and spotted a man below. She descended a bit more and shouted: ‘Excuse me, can you help me? I promised a friend I would meet him an hour ago but I don’t know where I am..’ …

Continue reading »


MacVim BClose

There are two ways to close buffers in MacVim: 1) :bd (Buffer Delete) This deletes one buffer, but the problem is, it won’t open it again during that session. 2) :q (quit) This closes ALL the buffers and the app. Neither does what I want most of the time, but I found this: http://vim.wikia.com/wiki/Deleting_a_buffer_without_closing_the_window It’s …

Continue reading »


Git Is Finicky

So, we have a release happening soon, and I needed to cherry-pick a few essential changes into the release candidate and upon trying to push them, I was told everything was up to date. ORLY NAO? Apparently, every now and again Git decides it wants to mess with me, and today is one of those …

Continue reading »


Tweepy – Python Twitter Library

It‘s pretty awesome and easy to use.  The whole oauth circle is a nice thing to know, but it’s major headache the first time around.  Tweepy hides a lot of the not so fun parts and sets up a simple interface.  So, I’ll assume we can forward past the whole registering a Twitter account in …

Continue reading »


MacVim PEP-8 Helper

To follow along with PEP-0008 standards, there is a command that will highlight any characters beyond the 79 char limit.  It’s a useful little reminder that you’ve reached your limit. :match ErrorMsg ‘\%>79v.\+’

Older posts «