New submission from John Feuerstein :
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
Changes by John Feuerstein :
--
nosy: +john.feuerstein
___
Python tracker
<http://bugs.python.org/issue12567>
___
___
Python-bugs-list mailing list
Unsubscribe:
John Feuerstein 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
New submission from John Feuerstein :
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
New submission from John Feuerstein :
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
John Feuerstein 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() metho
John Feuerstein 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
> sequenc