[ python-Bugs-1353793 ] Error in documentation for os.walk

SourceForge.net noreply at sourceforge.net
Sat Nov 12 00:41:29 CET 2005


Bugs item #1353793, was opened at 2005-11-11 10:28
Message generated for change (Comment added) made by mgeisler
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1353793&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Documentation
Group: Not a Bug
Status: Closed
Resolution: Invalid
Priority: 5
Submitted By: Martin Geisler (mgeisler)
Assigned to: Nobody/Anonymous (nobody)
Summary: Error in documentation for os.walk

Initial Comment:
There's a mistake in the example given for os.walk on
this page:

  http://docs.python.org/lib/os-file-dir.html

The line with sum should read

  print sum([getsize(join(root, name)) for name in files]),

with square brackets.  Otherwise, thanks for the
excellent documentation!

----------------------------------------------------------------------

>Comment By: Martin Geisler (mgeisler)
Date: 2005-11-12 00:41

Message:
Logged In: YES 
user_id=1264592

Ups, I'm sorry for the noise then...

----------------------------------------------------------------------

Comment By: Tim Peters (tim_one)
Date: 2005-11-11 15:50

Message:
Logged In: YES 
user_id=31435

Your URL is for the Python 2.4.2 docs, where the example 
works fine as given.  If you're using an earlier version of 
Python, the example will not work as given (it relies on 
generator expressions, which were introduced in 2.4).

For example, if you're using Python 2.3.5, you should look at 
the docs for 2.3 instead:

http://www.python.org/doc/2.3.5/lib/os-file-dir.html

Note that square brackets _are_ in that example, because 
Python 2.3.5 required them.  Current Pythons (2.4+) do not, 
so I'm closing this as Not-A-Bug.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1353793&group_id=5470


More information about the Python-bugs-list mailing list