[issue28975] os.walk generator vs

2016-12-14 Thread Colin David Chen

New submission from Colin David Chen:

os.walk in 3.6rc1 (Windows) appears to generate different output depending on 
its invocation.

In the first invocation, I use the generator to yield one result at a time:
source = "C:\\cdchen_data\\downloads\\python-xlib-0.18\\"
texasranger = os.walk(Path(source))
roottree = [next(texasranger)]
roottree[0][0]
Output:
'C:\\cdchen_data\\downloads\\python-xlib-0.18'

The same result occurs when using the generator in a for loop.

In the second invocation, I generate the complete list first:
sourcetree = [x for x in os.walk(source)]
sourcetree[0][0]

Output:
'C:\\cdchen_data\\downloads\\python-xlib-0.18\\'

The particular behavior causing me trouble is the omission in the first result 
of the final '\\'. I checked in 2.7.6 and os.walk is consistent and I believe 
more correct in that it will yield equivalent results and includes the '\\'.

Not sure if earlier Python 3 implementations have this problem, I couldn't get 
3.5 to run this function without failing.

--
components: Library (Lib)
messages: 283221
nosy: Colin David Chen
priority: normal
severity: normal
status: open
title: os.walk generator vs
type: behavior
versions: Python 3.6

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



[issue28975] os.walk generator giving inconsistent results

2016-12-14 Thread Colin David Chen

Changes by Colin David Chen :


--
title: os.walk generator vs -> os.walk generator giving inconsistent results

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



[issue28975] os.walk generator giving inconsistent results

2016-12-14 Thread Colin David Chen

Colin David Chen added the comment:

Ah, you're correct. The behavior is consistent if you use strings in both 
invocations. The Path conversion strips the final '\\'. Doc examples do use the 
names of directories rather than a Path object.

I will close the issue. Thanks for the quick response!

--
resolution:  -> not a bug
status: open -> closed

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