liveBook · Manning

Parameter

As explained in The Well-Grounded Python Developer: How the pros use Python and Flask

A query string is the portion of a URL containing parameters appended after a question mark.

A parameter names an input a function accepts; an argument is the value supplied when calling it. Parameters are part of an API’s contract: their names, order, and defaults tell callers what information the function needs and how to provide it. section 3.1.2

print(*objects, sep=' ', end='\n', file=sys.stdout, flush=False)

The print signature shows how one familiar function accepts multiple objects and offers defaults for their separator, ending, destination, and flushing behavior. section 3.1.2

Use positional parameters when their order makes sense to callers. Use keyword parameters with defaults for optional choices: a name-building function can require a first name while allowing a middle or last name to be omitted. Callers can also supply keyword arguments by name rather than relying on their order. section 3.2.2

Inputs should help a function do one clear job, not tie that job to an unnecessary side effect. A function that returns a full name can be tested directly and reused for printing, a web page, or JSON; one that always prints the name is harder to reuse. section 3.2.4

A URL can carry parameters too, in a query string after the question mark. For example, a blog-post request with action=create selects a creation form, while a request without that action displays posts. These are request inputs, not Python function parameters, though both let a caller influence behavior. section 11.4.1

How The Well-Grounded Python Developer: How the pros use Python and Flask covers it

How deep it goes
Explains positional and keyword inputs through calls and defaults, but does not develop URL query-string parsing.
Examples
Uses print, a full-name function, and a blog-post handler whose action query value selects a creation form.
What it assumes
Assumes familiarity with calling Python functions while explicitly distinguishing arguments from parameters.
What you can do after
Apply it to design callable functions with clear required and optional inputs and understand action-based blog-post requests.
How it connects
Connects parameters to function signatures, API contracts, default values, query strings, and single responsibility.

Also explained in

Compare how 31 books explain parameter →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of The Well-Grounded Python Developer: How the pros use Python and Flask. The section links point to the parts of the book it draws on.