Unicode strings as arguments to exceptions

2014-01-16 Thread Ernest Adrogué
Hi, There seems to be some inconsistency in the way exceptions handle Unicode strings. For instance, KeyError seems to not have a problem with them >>> raise KeyError('a') Traceback (most recent call last): File "", line 1, in KeyError: 'a' >>> raise KeyError(u'ä') Traceback (most recent call

Re: how do I write a scliceable class?

2010-02-13 Thread Ernest Adrogué
Hi, Thanks a lot for your comments. I think I've got enough information to make a decision now. 13/02/10 @ 15:16 (+0100), thus spake Peter Otten: > Ernest Adrogué wrote: > > > I'm designing a container class that supports slicing. > > The problem is that I do

how do I write a scliceable class?

2010-02-13 Thread Ernest Adrogué
Hello everybody, I'm designing a container class that supports slicing. The problem is that I don't really know how to do it. class MyClass(object): def __init__(self, input_data): self._data = transform_input(input_data) def __getitem__(self, key):