Re: [Python-Dev] List insert at index that is well out of range - behaves like append

2014-09-15 Thread Tal Einat
On Mon, Sep 15, 2014 at 6:18 AM, Harish Tech wrote: > I had a list > > a = [1, 2, 3] > > when I did > > a.insert(100, 100) > > [1, 2, 3, 100] > > as list was originally of size 4 and I was trying to insert value at index > 100 , it behaved like append instead of throwing any errors as I was tryin

Re: [Python-Dev] List insert at index that is well out of range - behaves like append

2014-09-15 Thread Harish Tech
Hi , Sorry for that mistake . Now I have posted it in python-list mailing list . Thanks for your guidance. Harish On Mon, Sep 15, 2014 at 5:01 PM, Tal Einat wrote: > On Mon, Sep 15, 2014 at 6:18 AM, Harish Tech > wrote: > > I had a list > > > > a = [1, 2, 3] > > > > when I did > > > >

Re: [Python-Dev] namedtuples bug between 3.3.2 and 3.4.1

2014-09-15 Thread Antony Lee
FWIW I cannot reproduce the bug with Anaconda's Python 3.4.1 (from a miniconda install): $ python Python 3.4.1 |Continuum Analytics, Inc.| (default, Sep 2 2014, 14:00:37) [GCC 4.4.7 20120313 (Red Hat 4.4.7-1)] on linux Type "help", "copyright", "credits" or "license" for more information. >>> fro

Re: [Python-Dev] Multilingual programming article on the Red Hat Developer blog

2014-09-15 Thread Jim J. Jewett
On Sat Sep 13 00:16:30 CEST 2014, Jeff Allen wrote: > 1. Java does not really have a Unicode type, therefore not one that > validates. It has a String type that is a sequence of UTF-16 code units. > There are some String methods and Character methods that deal with code > points represented

Re: [Python-Dev] List insert at index that is well out of range - behaves like append

2014-09-15 Thread Mark Shannon
On 15/09/14 12:31, Tal Einat wrote: On Mon, Sep 15, 2014 at 6:18 AM, Harish Tech wrote: I had a list a = [1, 2, 3] when I did a.insert(100, 100) [1, 2, 3, 100] as list was originally of size 4 and I was trying to insert value at index 100 , it behaved like append instead of throwing an

Re: [Python-Dev] List insert at index that is well out of range - behaves like append

2014-09-15 Thread Mark Lawrence
On 15/09/2014 23:29, Mark Shannon wrote: On 15/09/14 12:31, Tal Einat wrote: On Mon, Sep 15, 2014 at 6:18 AM, Harish Tech wrote: I had a list a = [1, 2, 3] when I did a.insert(100, 100) [1, 2, 3, 100] as list was originally of size 4 and I was trying to insert value at index 100 , it

Re: [Python-Dev] List insert at index that is well out of range - behaves like append

2014-09-15 Thread Antoine Pitrou
On Mon, 15 Sep 2014 23:46:03 +0100 Mark Lawrence wrote: > > I assume it's based on the concepts of slicing. From the docs > "s.insert(i, x) - inserts x into s at the index given by i (same as > s[i:i] = [x])". Although shouldn't that read s[i:i+1] = [x] ? No, the latter would replace the con

Re: [Python-Dev] List insert at index that is well out of range - behaves like append

2014-09-15 Thread Ethan Furman
On 09/15/2014 03:46 PM, Mark Lawrence wrote: On 15/09/2014 23:29, Mark Shannon wrote: I think this is an OK forum for this question. It isn't. ;) If someone isn't sure if something is a bug or not, then why not ask here before reporting it on the bug tracker? The first stop should still

Re: [Python-Dev] List insert at index that is well out of range - behaves like append

2014-09-15 Thread Guido van Rossum
This functionality has existed since the earliest days of Python, and even if we all agreed it was wrong we couldn't change it -- it would just break too much existing code. I can't quite remember why I did it that way but it was definitely a conscious choice; probably some symmetry or edge case. (

Re: [Python-Dev] List insert at index that is well out of range - behaves like append

2014-09-15 Thread Guido van Rossum
On Mon, Sep 15, 2014 at 3:46 PM, Mark Lawrence wrote: > > I assume it's based on the concepts of slicing. From the docs > "s.insert(i, x) - inserts x into s at the index given by i (same as s[i:i] > = [x])". Ah, right. It matches thigs like s[100:] which is the empty string if s is shorter tha

Re: [Python-Dev] Multilingual programming article on the Red Hat Developer blog

2014-09-15 Thread Stephen J. Turnbull
Jim J. Jewett writes: > In terms of best-effort, it is reasonable to treat the smuggled bytes > as representing a character outside of your unicode repertoire I have to disagree. If you ever end up passing them to something that validates or tries to reencode them without surrogateescape, BOOM

Re: [Python-Dev] Multilingual programming article on the Red Hat Developer blog

2014-09-15 Thread Chris Angelico
On Tue, Sep 16, 2014 at 1:34 PM, Stephen J. Turnbull wrote: > Jim J. Jewett writes: > > > In terms of best-effort, it is reasonable to treat the smuggled bytes > > as representing a character outside of your unicode repertoire > > I have to disagree. If you ever end up passing them to something th