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 <rep...@bugs.python.org>
<http://bugs.python.org/issue17670>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to