473,756 Members | 1,818 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

help() on stdout.closed

Python 2.4.1 (#1, May 16 2005, 15:19:29)
[GCC 4.0.0 20050512 (Red Hat 4.0.0-5)] on linux2
Type "help", "copyright" , "credits" or "license" for more information.
from sys import stdout
help (stdout.closed)
If I do this, it gives me help on the bool object. Also:
stdout.closed._ _doc__

'bool(x) -> bool\n\nReturns True when the argument x is true, False
otherwise.\nThe builtins True and False are the only two instances of the
class bool.\nThe class bool is a subclass of the class int, and cannot be
subclassed.'

What's going on here? Other docstrings in sys.stdout work fine.

Pekka (uses 2.4.3 on another comp)
Jun 21 '06 #1
6 1534
In article <sl************ *********@lastu 30.oulu.fi>, Pekka Karjalainen wrote:
from sys import stdout
help (stdout.closed)


If I do this, it gives me help on the bool object.


stdout.closed is a bool. What were you expecting it to show you?
Jun 21 '06 #2
Pekka Karjalainen wrote:
from sys import stdout
help (stdout.closed)
If I do this, it gives me help on the bool object.
that's probably because "sys.stdout.clo sed" *is* a bool object:
sys.stdout.clos ed False type(sys.stdout .closed) <type 'bool'>

there's no way the reflection system can figure out how a given boolean was
created; all it knows is that it gets an object of a given type.
Other docstrings in sys.stdout work fine.


have you tried things like
help(sys.stdout .name)
and
help(sys.stdout .write("hello") )


?

</F>

Jun 21 '06 #3
On 2006-06-21, Fredrik Lundh <fr*****@python ware.com> wrote:
have you tried things like

[...]

I have now. I'm not sure what the results are supposed to tell me, but I
am not going to press the issue.

Suppose I had no idea what sys.stdout.clos ed was and wanted to find out.
Where would I look it up?

Pekka
Jun 21 '06 #4
In <sl************ *********@lastu 30.oulu.fi>, Pekka Karjalainen wrote:
Suppose I had no idea what sys.stdout.clos ed was and wanted to find out.
Where would I look it up?


`sys.stdout` is a file (like) object:

http://docs.python.org/lib/bltin-file-objects.html

Ciao,
Marc 'BlackJack' Rintsch
Jun 21 '06 #5
Pekka Karjalainen wrote:
Suppose I had no idea what sys.stdout.clos ed was and wanted to find out.
Where would I look it up?

help(sys.stdout ) ....
| closed = <attribute 'closed' of 'file' objects>
| True if the file is closed
....

in case anyone feels like hacking, support for something like
help(sys.stdout , "closed")


might be useful, I think.

</F>

Jun 21 '06 #6
Marc 'BlackJack' Rintsch <bj****@gmx.net > wrote:
In <sl************ *********@lastu 30.oulu.fi>, Pekka Karjalainen wrote:
Suppose I had no idea what sys.stdout.clos ed was and wanted to find out.
Where would I look it up?


`sys.stdout` is a file (like) object:

http://docs.python.org/lib/bltin-file-objects.html


Since the OP is using linux he may prefer to look this up using
"info". Info contains all the same stuff as the web pages and it is
terminal friendly.

To find the below I typed

info
CTRL-S pytho
Cursor down to "Python2.3-lib:" and press ENTER
CTRL-S closed
CTRL-S, CTRL-S until correct entry found (the 4th one)

....

File objects also offer a number of other interesting attributes.
These are not required for file-like objects, but should be implemented
if they make sense for the particular object.

`closed'
bool indicating the current state of the file object. This is a
read-only attribute; the `close()' method changes the value. It
may not be available on all file-like objects.

--
Nick Craig-Wood <ni**@craig-wood.com> -- http://www.craig-wood.com/nick
Jun 21 '06 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
21137
by: Michael Gaab | last post by:
If I redirect stdout by using freopen("afile", "w", stdout); and then I closed stdout using, fclose(stdout), essentially I am just closing "afile". I have to reestablish what stdout originally pointed to? thanks
16
39610
by: boss_bhat | last post by:
Assume stdout is closed and if i now want to open stdout, how to open it? IS this correct way of opening stdout fopen(stdout,"/dev/null"); Thanks Prasanna Bhat Mavinkuli
9
2354
by: santosh | last post by:
Hello all, I've put together a small program to count the number of characters and 'words' in a text file. The minimum length of a word, (in terms of no. of characters), as well as word delimiting characters can be specified on the command line. The default delimiting characters built into the program are space, newline, tab, carriage return, form feed, vertical tab, comma and null. If a 'u' or 'U' is specified as the last command line...
9
18291
by: Santtu Nyrhinen | last post by:
Hi, Let say that I have a function like void writeHello() { printf("Hello"); } Now I need to make an automated test fot that function. The test function returns 1 for successful and 0 for unsuccessful test. int Test_writeHello() {
8
5944
by: Paul Edwards | last post by:
Is it permissible in C89 to do an "fclose(stdout)" and then exit, or is the C runtime library allowed to assume that stdout remains open and thus unconditionally do an fclose itself? Thanks. Paul.
20
7303
by: David Mathog | last post by:
A program of mine writes to a tape unit. Output can be either through stdout or through a file opened with fopen(). When all the data is transferred to tape the program needs to close the output stream so that the tape driver will write a filemark on the tape. Otherwise multiple clumps of data saved to tape would all appear to be one big file on the tape. When the tape unit device was explicitly opened with fopen() that's possible:...
6
17551
by: gregpinero | last post by:
Let's say I have this Python file called loop.py: import sys print 'hi' sys.stdout.flush() while 1: pass And I want to call it from another Python process and read the value 'hi'. How would I do it?
5
16205
by: Dick Watson | last post by:
I'm trying to debug some code I haven't been in for years. It's in the 1and1 linux hosting environment. Under PHP 4.4.8 (cgi) (built: Mar 6 2008 18:09:06) This code <?php fwrite(STDOUT, "trythis\r\n"); ?>
5
8980
by: Joakim Hove | last post by:
Hello, I have written a program in C; this programs uses an external proprietary library. When calling a certain function in the external library, the particular function writes a message to stdout. I am not particularly interested in this message, and would like to silence it - however I do not know how to do it. (I stdout and stderr my self, so just redirecting into oblivion is not an option). An excerpt of the code looks like this:
0
9456
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9275
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10034
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9872
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8713
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7248
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6534
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
3805
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2666
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.