"Matthew Warren" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> I learned over the years to do things like the following, and I like
> doing it like this because of readability, something Python seems to
> focus on :-
>
> Print "There are "+number+" ways to skin a "+furryanimal

In python:
IDLE 1.1.3
>>> number = 3
>>> furryanimal = 'rat'
>>> print 'There are', number, 'of ways to skin a', furryanimal
There are 3 of ways to skin a rat

You have to remember that spaces are added automatically.
Printing a comma list is quite common in informal and preliminary work
and sometimes in finished work when its output is good enough.

> But nowadays, I see things like this all over the place;
>
> print("There are %s ways to skin a %s" % (number, furryanimal))

This gives more control over exact format of output.
Some people may also prefer having variables grouped together at end,
especially if they 'grew up' on C (for instance) rather than Basic.

Terry Jan Reedy



-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to