[issue11360] In documentation of getopt, advertise argparse instead of optparse
New submission from Daniel Haertle : At the beginning of http://docs.python.org/dev/library/getopt.html the line "A more convenient, flexible, and powerful alternative is the optparse module." routes the user to optparse. Since optparse is deprecated in favor of argparse, this line is no more up-to-date. The best is to remove this line completely, since there already is a note routing to argparse. -- assignee: docs@python components: Documentation messages: 129753 nosy: Danh, docs@python priority: normal severity: normal status: open title: In documentation of getopt, advertise argparse instead of optparse versions: Python 3.2, Python 3.3 ___ Python tracker <http://bugs.python.org/issue11360> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11354] argparse: nargs could accept range of options count
Daniel Haertle added the comment: Hi Wojciech, in your tests, at def test_add_argument10(self): "nargs = (0, 1) => optimized to '?'" opt = self.add_argument(1, None) self.assertEqual(opt.nargs, argparse.ONE_OR_MORE) you should change "argparse.ONE_OR_MORE" to "argparse.OPTIONAL". -- nosy: +Danh ___ Python tracker <http://bugs.python.org/issue11354> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue5419] urllib.request.open(someURL).read() returns a bytes object so writing it requires binary mode
Daniel Haertle added the comment: I got struck by the same feature. In addition, currently the docs are wrong in the examples (at http://docs.python.org/dev/py3k/library/urllib.request.html#examples the output of f.read() is a string instead of bytes). There I propose the change from >>> import urllib.request >>> f = urllib.request.urlopen('http://www.python.org/') >>> print(f.read(100)) >> import urllib.request >>> f = urllib.request.urlopen('http://www.python.org/') >>> print(f.read(100).decode('utf-8')) http://www.w3.org/TR/xhtml1/DTD/xhtm The other examples need to be corrected in a similar way. Even more importantly, the "HOWTO Fetch Internet Resources Using The urllib Package" needs to be corrected too. In the documentation of urllib.request.urlopen I propose to add a sentence (after the paragraph "This function returns a file-like object...") explaining that reading the object returns bytes that need to be decoded to a string: "Note that the method read() returns bytes that need to be decoded to a string using decode()." -- nosy: +Danh versions: +Python 3.2, Python 3.3 ___ Python tracker <http://bugs.python.org/issue5419> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com