[Tutor] Documentation concerns.

Alan Gauld alan.gauld@blueyonder.co.uk
Thu May 22 05:01:02 2003


> So one would expect 'a\tab\tabc\tabcd\t'.expandtabs() to produce
> 'a        ab        abc        adcd        ' where there are 8
spaces
> between each word? But that's NOT what happens. So the definition is
not
> explicit enough.

No, that would be converting tabs into 8 chars but expand fills
the space with up to 8 chars. I must admit it behaves exactly
as I would expect:

>>> result = ''
>>> for c in range(50):
...   if c % 8 == 0: result += '|'
...   else: result += '-'
...
>>> print result
|-------|-------|-------|-------|-------|-------|-
>>> 'a  ab      abc     abcd    '.expandtabs()
'a       ab      abc     abcd    '
>>>

What else did you think it might do Bob?

Alan G.