[Tutor] don't understand iteration

Ben Finney ben+python at benfinney.id.au
Mon Nov 10 05:25:13 CET 2014


"Clayton Kirkwood" <crk at godblessthe.us> writes:

> >-----Original Message-----
> >From: Tutor [mailto:tutor-bounces+crk=godblessthe.us at python.org] On
> >Behalf Of Dave Angel

(Clayton, does your mail client not present messages written by their
authors? The messages should not come to you “From:” the tutor list
itself. It's awkward to follow whom you're quoting.)

> >(month, day, time, ap, offset) = blah.group( *list (range (1, 6)))
> >
> >Should do it.

> Where did you find that one?

Working through the Python Tutorial (actually doing the examples, and
working to understand them before moving on) teaches these and other
Python concepts <URL:https://docs.python.org/3/tutorial/>.

> What does the '*' do/why?

Learn about sequence unpacking in function parameters at the Tutorial
<URL:https://docs.python.org/3/tutorial/controlflow.html#tut-unpacking-arguments>.

> And why the weird range thing?

Learn about the ‘range’ built-in at the Python library reference
<URL:https://docs.python.org/3/library/functions.html#func-range>.

-- 
 \         “I went to the museum where they had all the heads and arms |
  `\      from the statues that are in all the other museums.” —Steven |
_o__)                                                           Wright |
Ben Finney



More information about the Tutor mailing list