[issue17670] expandabs() weirdness

Alfredo Solano Martínez report at bugs.python.org
Tue Apr 9 01:26:31 CEST 2013


New submission from Alfredo Solano Martínez:

I stumbled upon this by chance. Is the following behaviour by design?

>>> s = 'a\tb'
>>> s.expandtabs(1) == s.expandtabs(2)
True

In fact:
>>> s.expandtabs(1)
'a b' # 1 space
>>> s.expandtabs(2)
'a b' # 1 space
>>> s.expandtabs(3)
'a  b' # 2 spaces
>>> s.expandtabs(4)
'a   b' # 3 spaces

It seems to be an off-by-one difference from 2 onwards. 

Tested with python versions 2.7.4, 3.2.4 and 3.3.1 on a Linux x86_64 machine.

----------
components: Library (Lib)
messages: 186358
nosy: asolano
priority: normal
severity: normal
status: open
title: expandabs() weirdness
type: behavior
versions: Python 2.7, Python 3.3

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue17670>
_______________________________________


More information about the Python-bugs-list mailing list