Documentation bug in glob examples
Sir/Madame, I believe there is a bug in the documentation for the glob module accessed through the following url on 2011/10/05: http://docs.python.org/library/glob.html Currently the example demonstrates the output of a series of globbing patterns in a directory with files 1.gif, 2.gif, and card.gif. The results returned are incorrect. They read:
import glob glob.glob('./[0-9].*') ['./1.gif', './2.txt'] glob.glob('*.gif') ['1.gif', 'card.gif'] glob.glob('?.gif') ['1.gif']
However, the results should be as follows: $python Python 2.6.5 (r265:79063, Apr 26 2010, 12:52:32) [GCC 4.4.3] on linux2 Type "help", "copyright", "credits" or "license" for more information.
import glob glob.glob('./[0-9].gif') ['./1.gif', './2.gif'] glob.glob('*.gif') ['1.gif', 'card.gif', '2.gif'] glob.glob('?.gif') ['1.gif', '2.gif']
Yours, Ewan Higgs NB: This email was written based on advice found here: http://docs.python.org/bugs.html
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On 10/05/11 17:04, Ewan Higgs wrote:
Sir/Madame, I believe there is a bug in the documentation for the glob module accessed through the following url on 2011/10/05: http://docs.python.org/library/glob.html
Currently the example demonstrates the output of a series of globbing patterns in a directory with files 1.gif, 2.gif, and card.gif. The results returned are incorrect. They read:
import glob glob.glob('./[0-9].*') ['./1.gif', './2.txt'] glob.glob('*.gif') ['1.gif', 'card.gif'] glob.glob('?.gif') ['1.gif']
However, the results should be as follows:
$python Python 2.6.5 (r265:79063, Apr 26 2010, 12:52:32) [GCC 4.4.3] on linux2 Type "help", "copyright", "credits" or "license" for more information.
import glob glob.glob('./[0-9].gif') ['./1.gif', './2.gif'] glob.glob('*.gif') ['1.gif', 'card.gif', '2.gif'] glob.glob('?.gif') ['1.gif', '2.gif']
Hi Ewan, it seems to me that the example is correct: note that the second file is called "2.txt", not "2.gif". cheers, Georg -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.18 (GNU/Linux) iEYEARECAAYFAk6Mfn0ACgkQN9GcIYhpnLCyCACfc3BcT6AoXqv5EcbgOIedalQX 0rAAn2zYsYpSSf3mCEbM7bBUARL8DL8D =eN8J -----END PGP SIGNATURE-----
How embarassing! Sorry to have wasted your time. Yours, Ewan ________________________________ From: Georg Brandl <georg@python.org> To: Ewan Higgs <ewan_higgs@yahoo.co.uk> Cc: "docs@python.org" <docs@python.org> Sent: Wednesday, 5 October 2011, 16:57 Subject: Re: [docs] Documentation bug in glob examples -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On 10/05/11 17:04, Ewan Higgs wrote:
Sir/Madame, I believe there is a bug in the documentation for the glob module accessed through the following url on 2011/10/05: http://docs.python.org/library/glob.html
Currently the example demonstrates the output of a series of globbing patterns in a directory with files 1.gif, 2.gif, and card.gif. The results returned are incorrect. They read:
import glob glob.glob('./[0-9].*') ['./1.gif', './2.txt'] glob.glob('*.gif') ['1.gif', 'card.gif'] glob.glob('?.gif') ['1.gif']
However, the results should be as follows:
$python Python 2.6.5 (r265:79063, Apr 26 2010, 12:52:32) [GCC 4.4.3] on linux2 Type "help", "copyright", "credits" or "license" for more information.
import glob glob.glob('./[0-9].gif') ['./1.gif', './2.gif'] glob.glob('*.gif') ['1.gif', 'card.gif', '2.gif'] glob.glob('?.gif') ['1.gif', '2.gif']
Hi Ewan, it seems to me that the example is correct: note that the second file is called "2.txt", not "2.gif". cheers, Georg -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.18 (GNU/Linux) iEYEARECAAYFAk6Mfn0ACgkQN9GcIYhpnLCyCACfc3BcT6AoXqv5EcbgOIedalQX 0rAAn2zYsYpSSf3mCEbM7bBUARL8DL8D =eN8J -----END PGP SIGNATURE-----
participants (2)
-
Ewan Higgs -
Georg Brandl