My first Python program

Ben Finney ben+python at benfinney.id.au
Wed Oct 13 22:25:23 CEST 2010


Seebs <usenet-nospam at seebs.net> writes:

> 1. If I have a message that I wish to print, it is quite possible that
> message + indentation exceeds 80 lines. What's the idiomatic way to
> solve this? Do I just break the string up into parts, or do I just
> accept that some lines are over 80 characters, or what?

Python borrows from C in that consecutive literal strings are
concatenated in the bytecode::

    stderr.write(
        "WARNING:"
        " Pants on fire\n")

> 2. It warns about **kw, both because the name is short and because of
> the "** magic". I was previously advised that the name "kw" is
> canonical for that usage, in which case, why am I getting linted at?

More conventional is the name ‘kwargs’; of a pair with ‘*args, **kwargs’.

-- 
 \        “We have to go forth and crush every world view that doesn't |
  `\                believe in tolerance and free speech.” —David Brin |
_o__)                                                                  |
Ben Finney



More information about the Python-list mailing list