[issue32242] loop in loop with with 'zip'ped object misbehaves in py3.6

2017-12-07 Thread Vishu Viswanathan

New submission from Vishu Viswanathan :

The file shows the results by running in Py3.6 and 2.7
In my opinion Py2.7 results matches what I expected.

In this bug or the zip function behaviour is changed with some purpose

--
files: py3.6_vs_py2.7.ipynb
messages: 307803
nosy: Vishu Viswanathan
priority: normal
severity: normal
status: open
title: loop in loop with with 'zip'ped object misbehaves in py3.6
type: behavior
versions: Python 3.6
Added file: https://bugs.python.org/file47328/py3.6_vs_py2.7.ipynb

___
Python tracker 
<https://bugs.python.org/issue32242>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue32242] loop in loop with with 'zip'ped object misbehaves in py3.6

2017-12-07 Thread Vishu Viswanathan

Vishu Viswanathan  added the comment:

Thanks for the fast response and clarification. Now I can run my code made
for  py2.7  also run in py3.6
I should search and read documentation before reporting.

Thanks

On Thu, Dec 7, 2017 at 8:03 PM, Steven D'Aprano 
wrote:

>
> Steven D'Aprano  added the comment:
>
> I decided to run the code in 3.5 and 2.7, and now that I know what I'm
> looking for, I can see the results buried in the Anaconda notebook.
>
> This is not a bug, zip has been changed in Python 3 to return an iterator
> instead of a list. To get the same results as Python 2.7, change the line:
>
> z = zip(j, k)
>
> to:
>
> z = list(zip(j, k))
>
> To get the same results in 2.7 as in 3, change it to:
>
> z = iter(zip(j, k))
>
> This is documented and is not a bug.
>
> https://docs.python.org/3.0/whatsnew/3.0.html#views-and-
> iterators-instead-of-lists
>
> https://docs.python.org/3/library/functions.html#zip
>
> --
>
> ___
> Python tracker 
> <https://bugs.python.org/issue32242>
> ___
>

--

___
Python tracker 
<https://bugs.python.org/issue32242>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com