[Python-checkins] python/dist/src/Modules _iconv_codec.c,NONE,1.1

Hye-Shik Chang perky@fallin.lv
Tue, 28 Jan 2003 20:55:07 +0900


On Tue, Jan 28, 2003 at 12:30:33PM +0100, Walter D?rwald wrote:
> Martin v. L?wis wrote:
> 
> >Walter D?rwald <walter@livinglogic.de> writes:
> >
> >>This interprets negative indizes as being relative to the
> >>end of the input. All other encoders treat <0 as ==0.
> >
> >
> >Hmm. This appears to be unspecified in the PEP. What is the rationale
> >for equating <0 to =0?
> 
> It just was the simplest solution.

I'd like raising IndexError than regarding <0 as =0

> 
> >It appears that this indicates a bug in the
> >error callback, which should not pass silently.
> 
> So would a position that is beyond the end of the input.
> 
> >In any case, I'ld like to request that the documentation is clarified
> >in this aspect (preferable, the "proper" documentation, not (just) the
> >PEP). Once that clarification is added, the incorrect codecs should be
> >corrected.
> 
> So how should we handle these cases?
> 
> a) Treat negative positions as relative to the end

+1

> b) Treat negative positions as 0

-1

> c) Clip out of bounds positions to the length of the input

-0

> d) Raise an exception

+0

> 
> I'd vote for a) + d)
> 
> If that's what we want to do I'll update the PEP, the documentation
> and the implemenation.
> 
> Bye,
>    Walter D?rwald
> 
> 


Regards,

    Hye-Shik =)