[Tutor] What does "TypeError: 'int' object is not iterable"mean?
adam.jtm30 at gmail.com
Sat Oct 23 16:07:54 CEST 2010
On 23/10/10 13:38, Alan Gauld wrote:
> "Steven D'Aprano" <steve at pearwood.info> wrote
>> It would have to be a *very* old version. The use of * as the width
>> parameter in format strings goes back to the Dark Ages of Python 1.5:
>> I believe this is a virtual copy of string formatting from C, in which
>> case it probably goes back to the 80s or even the 70s.
> This got me wondering so I dug out my copy of the original K&R (1978)
> and there is no mention of * in the format specifiers description.
> (There is for scanf but there it is a field suppressor)
> I don't have an ANSI C version of K&R at home so can't say if it got
> added as part of the ANSI C process - around 1990? - but neither
> of my ANSI C books mention it either.
> So it may not be a part of C after all.
> Interesting, I wonder where it did first appear?
> Alan G.
It is indeed in the ANSI version of K&R.
"Width or precision or both may be specified as *, in which case the
value is computed by converting the next argument(s), which must be
int." (The C Programming Language; B. W. Kernighan, D. M. Ritchie; 1988)
More information about the Tutor