Correct (I wasn't saying it was used on the lhs operand :-).

I find it important to use that API since anything that wants to
behave like a (small) int should be acceptable. Can you suggest a
better way to formulate the error from that API?

--Guido

On 2/25/07, Neil Schemenauer <[EMAIL PROTECTED]> wrote:
> On Sun, Feb 25, 2007 at 05:40:12PM -0600, Guido van Rossum wrote:
> > Thomas is correct. You can only assign ints in range(256) to a single
> > index.
>
> Yes, I understand that.  I think the error message is bad though.
>
> > The error comes from the call to PyNumber_AsSsize_t() in
> > bytes_setitem(), which apparently looks for __index__ or the tp_index
> > slot.
>
> I think PyNumber_AsSsize_t is being used on the RHS operand.  That's
> perhaps convenient but makes for a confusing message.  There was
> nothing wrong with the value I was using for an index.
>
>   Neil
>


-- 
--Guido van Rossum (home page: http://www.python.org/~guido/)
_______________________________________________
Python-3000 mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-3000
Unsubscribe: 
http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com

Reply via email to