Roy Tang

Programmer, engineer, scientist, critic, gamer, dreamer, and kid-at-heart.

Blog Notes Photos Links Archives About

All entries tagged devnotes.

You can subscribe to an RSS feed of this list.

Nov 2019

  • DevNotes: Python's yield

    I’ve been using Python for well over 10 years, and I still don’t have an intuitive mastery of one of its keywords: yield. Everytime I see it in someone’s code I need to stop and mentally remind myself what it does. I figured I’d write a devnote to help improve my recall. Typically, yield is used in a function with a loop, like so: def some_func(lim): for i in range(0, lim): yield i yield means the function returns a “generator” that can be used as an iterable in a loop:

    read more (172 words)

    Posted by under post at #software development #devnotes
    Also on: twitter / 1 0 / 172 words

Aug 2019