[issue12567] curses implementation of Unicode is wrong in Python 3
Changes by John Feuerstein j...@feurix.com: -- nosy: +john.feuerstein ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12567 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13152] textwrap: support custom tabsize
John Feuerstein j...@feurix.com added the comment: textwrap_tabsize_v2.diff: * Moved the tabsize parameter to the end of the parameter list * Added documentation update * Made the test case more obvious -- Added file: http://bugs.python.org/file23624/textwrap_tabsize_v2.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13152 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13365] str.expandtabs documentation is wrong
New submission from John Feuerstein j...@feurix.com: The documentation for str.expandtabs([tabsize]) is wrong: Return a copy of the string where all tab characters are replaced by one or more spaces, depending on the current column and the given tab size. [...] This should read zero or more spaces: 'a\tb'.expandtabs(0) 'ab' 'a\tb'.expandtabs(-1) 'ab' The description in Objects/unicodeobject.c does not include this error. -- assignee: docs@python components: Documentation files: expandtabs_doc.diff keywords: patch messages: 147222 nosy: docs@python, john.feuerstein priority: normal severity: normal status: open title: str.expandtabs documentation is wrong versions: Python 3.3 Added file: http://bugs.python.org/file23625/expandtabs_doc.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13365 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13152] textwrap: support custom tabsize
New submission from John Feuerstein j...@feurix.com: The textwrap module calls .expandtabs() to expand tabs to spaces. This patch adds support for a custom tabsize, so that .expandtabs(tabsize) is called instead. Includes test case. -- components: Library (Lib) files: textwrap_tabsize.diff keywords: patch messages: 145341 nosy: jfeuerstein priority: normal severity: normal status: open title: textwrap: support custom tabsize type: feature request versions: Python 3.3 Added file: http://bugs.python.org/file23376/textwrap_tabsize.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13152 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12941] add random.pop()
John Feuerstein j...@feurix.com added the comment: r.pop(random.randrange(0, len(r))) So seq[random.randrange(0, len(seq))] suddenly makes random.choice(seq) obsolete? There is no functional reasoning here, it's convenience for a common operation. Not all the sequences have a .pop() method. Not all sequences support indexing or item assignment either: random.choice({1, 2}) TypeError: 'set' object does not support indexing random.shuffle(abc) TypeError: 'str' object does not support item assignment ... I'd rather see random.choice support sets: ... But that's another (rejected) issue; see issue 7522. So the implicit requirement for random.choice() is support for indexing. The implicit requirement for random.shuffle() is support for indexing and item assignment. The implicit requirement for random.pop() is support for seq.pop()... I don't think random's convenience functions should validate (or even worse, convert) input. It's actually great that they are thin wrappers without magic, resulting in the same behaviour as if done without them. self.assertIn(pop([25, 75]), [25, 75]) These should also verify that the element is not in the list anymore. Also other test with different (and possibly wrong) input types should be added. This is true for many convenience functions in random. I've considered doing that at first and came to the conclusion that the tests for random should test the behaviour specific to random, not that of the underlying functionality? So seq[random] should test for random behaviour, not that indexing of seq itself works correctly. Similarly, seq.pop(random) should test for random behaviour and not for a working seq.pop()? All we would do here is duplicate tests not related to random. Please correct me if I'm wrong. I'm glad that this started a discussion. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12941 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12941] add random.pop()
John Feuerstein j...@feurix.com added the comment: The test doesn't have to check that seq.pop() is working fine (there are other tests for that) but that it's actually called and that it pops the right element from the input sequence (and not e.g. from a copy of the sequence that might have been created at some point). I agree, that makes sense. One use case I might think of is picking all the elements of a sequence until there are no more left, without risking to pick the same element twice. The same result can be achieved by shuffling the sequence and iterate over the elements though (that doesn't actually leave you with an empty sequence, but that's probably just a unimportant side-effect). One problem with shuffling in this use case is that you lose the otherwise original order of the remaining elements, so there is no way to return from pop random elements to pop elements in order (without working on a shallow copy). However, I would agree that this is rather uncommon. Feel free to close this as wont fix, after all it is trivial for the user to randomly pop elements out of a sequence himself (see above). There might be other use cases. If nothing else, there's at least issue 12941 to reference now. Thanks! -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12941 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12941] add random.pop()
New submission from John Feuerstein j...@feurix.com: This patch against current hg tip (72314:92842e347d98) adds random.pop(): pop(self, seq) method of Random instance Remove and return a random element from a non-empty sequence. Includes test case. -- components: Library (Lib) files: random_pop.diff keywords: patch messages: 143748 nosy: jfeuerstein priority: normal severity: normal status: open title: add random.pop() type: feature request versions: Python 3.4 Added file: http://bugs.python.org/file23120/random_pop.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12941 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com