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 6870349
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T03:40:23+00:00 2026-05-27T03:40:23+00:00

This is probably something stupid I am missing but it has really got me

  • 0

This is probably something stupid I am missing but it has really got me hung up on a larger project (c extension) that I am writing.

Why is print "Hello, World!" passing None and an extra \n to sys.stdout here?

>>> import sys
>>> class StdOutHook:
...     def write(self, text):
...         sys.__stdout__.write("stdout hook received text: %s\n" % repr(text))
... 
>>> class StdErrHook:
...     def write(self, text):
...         sys.__stderr__.write("stderr hook received text: %s\n" % repr(text))
... 
>>> sys.stdout = StdOutHook()
>>> sys.stderr = StdErrHook()
>>> 
>>> def x():
...     print "Hello, World!"
... 
>>> 
>>> print x()
stdout hook received text: 'Hello, World!'
stdout hook received text: '\n'
stdout hook received text: 'None'
stdout hook received text: '\n'
>>> 
  • 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-05-27T03:40:23+00:00Added an answer on May 27, 2026 at 3:40 am

    print x() prints the return value of x() which is implicitly None

    Either replace print "Hello world" with return "Hello world" or replace print x() with x()

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

Sidebar

Related Questions

Probably something stupid I'm missing but, why am I getting this warning? static void
This is probably something stupid, but I really can't figure it out myself. I'm
This is probably something fundamental and stupid that I've missed, but the various workarounds
I'm probably doing something realy stupid but I cant get this to work: var
This is something stupid I probably should know, but Googling fails me: When compiling
This is probably something silly I'm missing but I'm definitely lost. I'm using .NET
This is probably something really simple but I cant see what! Any images I
This is probably a pretty basic question, but just something that I wanted to
Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'dbuser1'@'localhost This is probably something stupid, but
Hopefully this question has an easy answer. It's probably something stupid I'm doing! In

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.