Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8322881
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T23:32:01+00:00 2026-06-08T23:32:01+00:00

Within a generator function, how can I find out if it has yielded anything

  • 0

Within a generator function, how can I find out if it has yielded anything yet?

def my_generator(stuff):
    # complex logic that interprets stuff and may or may not yield anything

    # I only want to yield this if nothing has been yielded yet.
    yield 'Nothing could be done with the input.'
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T23:32:04+00:00Added an answer on June 8, 2026 at 11:32 pm

    You’d need to keep a flag yourself, or restructure the code at the top. If things are too complex, it sounds like your function might do too much.

    Also, if that’s your message, it sounds like you may want an exception instead.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Can someone explain how the onUpgrade function is called within the SqliteDbOpenHelper class. I'm
How can I access the DRL generated within a DSLR file in Drools?
I'm looking for a way to find/replace links to images (within user-generated content) without
I've had a good look round and can't seem to find an answer to
I want to write the function below in a more concise manner: def sum_list(l):
I'm using the contents() function in jQuery in order to obtain some text within
In CSS2 and even in the upcoming CSS3, I can't find something that would
I am trying to define a dynamic variable within a function in Rhino JavaScript
I have a problem which I can't find a solution. I have a Parent
I have a small PHP Mysql function which generates all the columns within a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.