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

  • SEARCH
  • Home
  • 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 1064389
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T18:56:00+00:00 2026-05-16T18:56:00+00:00

When you want to print a bunch of variables in Python, you have quite

  • 0

When you want to print a bunch of variables in Python, you have quite a few options, such as:

for i in range(len(iterable)):
    print iterable[i].name

OR

map(lambda i: sys.stdout.write(i.name), iterable)

The reason I use sys.stdout.write instead of print in the second example is that lambdas won’t accept print, but sys.stdout.write serves the same purpose.

You can also print conditionally with the ternary operator:

map(lambda n: None if n % 2 else sys.stdout.write(str(n)), range(1, 100))

So it would be really handy if I could check an entire sequence for a condition that would warrant an exception in such a way:

map(lambda o: raise InvalidObjectError, o.name if not o.isValid else o(), iterable)

But that doesn’t work.
Is there such an object for raise in Python, and if so, where is it?

  • 1 1 Answer
  • 3 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-05-16T18:56:01+00:00Added an answer on May 16, 2026 at 6:56 pm

    There is no Python “object” (built-in or in the standard library) for raise, you have to build one yourself (typical short snippet that goes in one’s util.py…!):

    def do_raise(exc): raise exc
    

    typically to be called as do_raise(InvalidObjectError(o.name)).

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

Sidebar

Related Questions

i have a list of posts. i want print some words of post content
I want to print an attribute value based on its name, take for example
I have a bunch of links that I want to load dynamically within the
I have seen process.nextTick used in a few places and can't quite tell what
I have a bunch of executable files and I want to store the output
I have a bunch of Yaml configuration files that I want to convert to
So I have a bunch of WPF Windows in my Windows Application. I want
I want to build a bunch of Perl subrotines that all have the same
I have a map with a bunch of buttons that show and hide container
I have a bunch of HTML list items and what i want is to

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.