[EMAIL PROTECTED] wrote:
[snip]


In a case like

print '%s%s' %42 , 333
...
TypeError: not enough arguments for format string

it would be ambiguous whether 333 was intended as a second formatting argument or as a second thing to be printed.

Here's where the Language Reference comes in handy:

print_stmt ::= "print" ( [expression ("," expression)* [","]]
expression_list ::= expression ( "," expression )* [","] # An expression list containing at least one comma yields a tuple

Given that, there is no ambiguity in print '%s%s' %42 , 333

--
Bob Gailer
919-636-4239 Chapel Hill, NC

_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to