[docs] bug in range function in python 3.2-3.3

Andrew Svetlov andrew.svetlov at gmail.com
Wed Dec 26 20:22:58 CET 2012


Hi. In python3 range() call returns iterablerange object, not list.

On Sun, Dec 23, 2012 at 12:59 PM, Rahul <rahulkay at hotmail.com> wrote:
> Hi,
>
>     I am Rahul. This is my first letter to you. I have been tinkering with
> 'Python' from days of ver2.2. Though I am not any professional programmer
> yet I like this Language & like to play with it. Recently I downloaded the
> latest ver3.2 on my machine which runs on "Linux" while I was writing a
> program. I noticed that one of my function was misbehaving as I ran the
> program again & again, discovered that the built in function "range()" was
> not doing what it was supposed to do. Forcing me to revert back to "Python
> ver2.7x".
>     I tried both of your versions 3.3 on 'windows' & 3.2 on 'Mint Linux'. I
> noticed the same bug. I don't know any intricacies of python but things
> worked just right after falling back to older version. As this is a basic
> function I thought worth of reporting it.
>     What it normally does is generate a 'list' within the bound range of
> mentioned arguments. While older versions(2.7x) had no problem & worked fine
> but newer versions(3.2-3.3) did not.
>     This is normal output of the function,
>
>         >>> range(5)
>         >>> [0, 1, 2, 3, 4]
>
>     but later version does it like this,
>
>         >>> range(5)
>         >>> [1,5]
>     What is that?
>     Even better,
>
>         >>> range(1,5,1)
>         >>> range(1,5)                    # that is the actual output of
> interpreter.
>
>     I tried this on two different machines & in different OSes (Windows/
> windows7/ mint Linux). Showing same results. I also tried in 'IDLE' &
> 'command line' but to no avail.
>
>     May be I don't know if there are any additional libraries have been
> added & I need to import them.
>     I would be very obliged if you people can point out the mistake & guide
> me, or if it is really a bug I would like it to be gone. This a really an
> easy to learn, yet powerful OOP based language. I like to see it grow &
> remain that way.
>
> Thankfully,
>
> Rahul
> rahulkay at hotmail.com
> _______________________________________________
> docs mailing list
> docs at python.org
> http://mail.python.org/mailman/listinfo/docs



-- 
Thanks,
Andrew Svetlov


More information about the docs mailing list