views:

165

answers:

1

On Mac OS X I can’t enter a pound sterling sign (£) into the Python interactive shell.

* Mac OS X 10.5.5
* Python 2.5.1 (r251:54863, Jan 17 2008, 19:35:17)
* European keyboard (£ is shift-3)

When I type shift-3 in the Python interactive shell, I seem to invoke the previous word function, i.e. the cursor will move to the start of the last “word” (i.e. space-delimited item) typed on the line. When I’m back in the bash shell, typing shift-3 just produces a £, as expected.

This version of Python apparently uses editline for its interactive shell, as opposed to readline. I’m guessing that one of the default editline key bindings binds shift-3 (or whatever editline sees when I type shift-3) to the ed-prev-word command.

I’ve tried a few things in my ~/.editrc file to remove this binding, and they don’t have any effect:

  • bind -r £
  • bind -r \243
  • bind -r \156

And another that causes a bus error:

  • bind £ \243

Any ideas?

+1  A: 

This may be an editline issue; libedit may not accept UTF-8 characters:

Paul D. Waite