[Tutor] Playing with generators
dn
PythonList at DancesWithMice.info
Fri Aug 12 17:03:33 EDT 2022
On 13/08/2022 07.45, Mark Lawrence wrote:
> On 10/08/2022 12:32, Leam Hall wrote:
>
> [big snip]
>
> Plenty of answers but if you want to learn about Python looping,
> including the use of generators, I highly recommend
> https://www.youtube.com/watch?v=EnSu9hHGq5o as there's something in it
> for every level of programmer.
+1
Thanks for this - I had forgotten the counter() 'trick'.
NB the presentation is almost ten-years old and uses Python 2.
(wonder if Ned has presented an updated version since?)
In Python 3:
- print-statement is now a function: print()
- the ordering of dicts is now predictable
- shorter names of functions to iterate over a dict's keys or values
and for extra-credit:
- yield from
Disclaimer: I use the edX platform and OpenEdX, and thus in that (and
other presentations) have long followed Ned's work.
--
Regards,
=dn
More information about the Tutor
mailing list