473,396 Members | 1,671 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

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 1508
In article <sl*********************@lastu30.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.closed" *is* a bool object:
sys.stdout.closed 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*****@pythonware.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.closed was and wanted to find out.
Where would I look it up?

Pekka
Jun 21 '06 #4
In <sl*********************@lastu30.oulu.fi>, Pekka Karjalainen wrote:
Suppose I had no idea what sys.stdout.closed 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.closed 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*********************@lastu30.oulu.fi>, Pekka Karjalainen wrote:
Suppose I had no idea what sys.stdout.closed 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
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...
16
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
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...
9
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...
8
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. ...
20
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...
6
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...
5
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,...
5
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...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
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,...

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.