Still this seems like a bad thing to break backward compatibility with.
However I cannot really provide a use-case apart from what Benjamin
has said -> Teaching. It is not a common use-case to equate ranges
in code and that is bad coding anyway.

Hopefully, this will be well documented at 3.0 release. Currently
that "whats new" page does not mention anything about the range
type and how it breaks backward compatibility.

The NEWS page for 3.0 a4 does say this however.

"range() now returns an iterator rather than a list.  Floats are not allowed.
  xrange() is no longer defined."

I guess more information can be added here to actually specify
that range() returns not just any iterator, but an iterator which is a new
type and how it is different.

As regarding education, the following example can be used to
illustrate why things are different now.

>>> l=[1,2,3,4,5]
>>> l2=[1,2,3,4,5]
>>> iter(l2)
<list_iterator object at 0xb7d5066c>
>>> iter(l2)==iter(l)
False
>>>

Since range() is an iterator type, this should explain why
we cannot equate two range objects anymore.

Thanks

--Anand

On Wed, Apr 9, 2008 at 3:48 AM, Guido van Rossum <[EMAIL PROTECTED]> wrote:
> On Tue, Apr 8, 2008 at 2:49 PM, Benjamin Peterson
>  <[EMAIL PROTECTED]> >  range is one of the first functions
>  introduced in teaching Python.
>
>  That's only because educators were raised on Pascal for loops.
>
>  --
>
> --Guido van Rossum (home page: http://www.python.org/~guido/)
>
>
> _______________________________________________
>  Python-3000 mailing list
>  Python-3000@python.org
>  http://mail.python.org/mailman/listinfo/python-3000
>  Unsubscribe: 
> http://mail.python.org/mailman/options/python-3000/abpillai%40gmail.com
>



-- 
-Anand
_______________________________________________
Python-3000 mailing list
Python-3000@python.org
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