Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
8cbaa515
Commit
8cbaa515
authored
Jul 17, 1997
by
Guido van Rossum
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added fileno(); added readlines(sizehint).
AMK's sed job.
parent
9a68dee5
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
48 additions
and
18 deletions
+48
-18
Doc/lib/libtypes.tex
Doc/lib/libtypes.tex
+24
-9
Doc/libtypes.tex
Doc/libtypes.tex
+24
-9
No files found.
Doc/lib/libtypes.tex
View file @
8cbaa515
...
@@ -405,13 +405,13 @@ If the right argument is a dictionary (or any kind of mapping), then
...
@@ -405,13 +405,13 @@ If the right argument is a dictionary (or any kind of mapping), then
the formats in the string must have a parenthesized key into that
the formats in the string must have a parenthesized key into that
dictionary inserted immediately after the
\code
{
\%
}
character, and
dictionary inserted immediately after the
\code
{
\%
}
character, and
each format formats the corresponding entry from the mapping. E.g.
each format formats the corresponding entry from the mapping. E.g.
\begin{verbatim}
\b
code
\b
egin{verbatim}
>>> count = 2
>>> count = 2
>>> language = 'Python'
>>> language = 'Python'
>>> print '
%(language)s has %(count)03d quote types.' % vars()
>>> print '
%(language)s has %(count)03d quote types.' % vars()
Python has 002 quote types.
Python has 002 quote types.
>>>
>>>
\end{verbatim}
\end{verbatim}
\ecode
In this case no * specifiers may occur in a format (since they
In this case no * specifiers may occur in a format (since they
require a sequential parameter list).
require a sequential parameter list).
...
@@ -685,6 +685,13 @@ Files have the following methods:
...
@@ -685,6 +685,13 @@ Files have the following methods:
\code
{
0
}
.
\code
{
0
}
.
\end{funcdesc}
\end{funcdesc}
\begin{funcdesc}
{
fileno
}{}
Return the integer ``file descriptor'' that is used by the underlying
implementation to request I/O operations from the operating system.
This can be useful for other, lower level interfaces that use file
descriptors, e.g. module
\code
{
fcntl
}
or
\code
{
os.read
}
and friends.
\end{funcdesc}
\begin{funcdesc}
{
read
}{
\optional
{
size
}}
\begin{funcdesc}
{
read
}{
\optional
{
size
}}
Read at most
\var
{
size
}
bytes from the file (less if the read hits
Read at most
\var
{
size
}
bytes from the file (less if the read hits
\EOF
{}
or no more data is immediately available on a pipe, tty or
\EOF
{}
or no more data is immediately available on a pipe, tty or
...
@@ -714,9 +721,11 @@ Files have the following methods:
...
@@ -714,9 +721,11 @@ Files have the following methods:
input.
input.
\end{funcdesc}
\end{funcdesc}
\begin{funcdesc}
{
readlines
}{}
\begin{funcdesc}
{
readlines
}{
\optional
{
sizehint
}
}
Read until
\EOF
{}
using
\code
{
readline()
}
and return a list containing
Read until
\EOF
{}
using
\code
{
readline()
}
and return a list containing
the lines thus read.
the lines thus read. If the optional
\var
{
bufferhint
}
argument is
present, instead of reading up to
\EOF
{}
, whole lines totalling
approximately
\var
{
sizehint
}
bytes are read.
\end{funcdesc}
\end{funcdesc}
\begin{funcdesc}
{
seek
}{
offset
\,
whence
}
\begin{funcdesc}
{
seek
}{
offset
\,
whence
}
...
@@ -751,6 +760,12 @@ Write a list of strings to the file. There is no return value.
...
@@ -751,6 +760,12 @@ Write a list of strings to the file. There is no return value.
does not add line separators.)
does not add line separators.)
\end{funcdesc}
\end{funcdesc}
Classes that are trying to simulate a file object should also have a
writable
\code
{
softspace
}
attribute, which should be initialized to
zero. (
\code
{
softspace
}
is used by the
\code
{
print
}
statement.) This
will be automatic for classes implemented in Python; types implemented
in C will have to provide a writable
\code
{
softspace
}
attribute.
\subsubsection
{
Internal Objects
}
\subsubsection
{
Internal Objects
}
(See the Python Reference Manual for these.)
(See the Python Reference Manual for these.)
...
...
Doc/libtypes.tex
View file @
8cbaa515
...
@@ -405,13 +405,13 @@ If the right argument is a dictionary (or any kind of mapping), then
...
@@ -405,13 +405,13 @@ If the right argument is a dictionary (or any kind of mapping), then
the formats in the string must have a parenthesized key into that
the formats in the string must have a parenthesized key into that
dictionary inserted immediately after the
\code
{
\%
}
character, and
dictionary inserted immediately after the
\code
{
\%
}
character, and
each format formats the corresponding entry from the mapping. E.g.
each format formats the corresponding entry from the mapping. E.g.
\begin{verbatim}
\b
code
\b
egin{verbatim}
>>> count = 2
>>> count = 2
>>> language = 'Python'
>>> language = 'Python'
>>> print '
%(language)s has %(count)03d quote types.' % vars()
>>> print '
%(language)s has %(count)03d quote types.' % vars()
Python has 002 quote types.
Python has 002 quote types.
>>>
>>>
\end{verbatim}
\end{verbatim}
\ecode
In this case no * specifiers may occur in a format (since they
In this case no * specifiers may occur in a format (since they
require a sequential parameter list).
require a sequential parameter list).
...
@@ -685,6 +685,13 @@ Files have the following methods:
...
@@ -685,6 +685,13 @@ Files have the following methods:
\code
{
0
}
.
\code
{
0
}
.
\end{funcdesc}
\end{funcdesc}
\begin{funcdesc}
{
fileno
}{}
Return the integer ``file descriptor'' that is used by the underlying
implementation to request I/O operations from the operating system.
This can be useful for other, lower level interfaces that use file
descriptors, e.g. module
\code
{
fcntl
}
or
\code
{
os.read
}
and friends.
\end{funcdesc}
\begin{funcdesc}
{
read
}{
\optional
{
size
}}
\begin{funcdesc}
{
read
}{
\optional
{
size
}}
Read at most
\var
{
size
}
bytes from the file (less if the read hits
Read at most
\var
{
size
}
bytes from the file (less if the read hits
\EOF
{}
or no more data is immediately available on a pipe, tty or
\EOF
{}
or no more data is immediately available on a pipe, tty or
...
@@ -714,9 +721,11 @@ Files have the following methods:
...
@@ -714,9 +721,11 @@ Files have the following methods:
input.
input.
\end{funcdesc}
\end{funcdesc}
\begin{funcdesc}
{
readlines
}{}
\begin{funcdesc}
{
readlines
}{
\optional
{
sizehint
}
}
Read until
\EOF
{}
using
\code
{
readline()
}
and return a list containing
Read until
\EOF
{}
using
\code
{
readline()
}
and return a list containing
the lines thus read.
the lines thus read. If the optional
\var
{
bufferhint
}
argument is
present, instead of reading up to
\EOF
{}
, whole lines totalling
approximately
\var
{
sizehint
}
bytes are read.
\end{funcdesc}
\end{funcdesc}
\begin{funcdesc}
{
seek
}{
offset
\,
whence
}
\begin{funcdesc}
{
seek
}{
offset
\,
whence
}
...
@@ -751,6 +760,12 @@ Write a list of strings to the file. There is no return value.
...
@@ -751,6 +760,12 @@ Write a list of strings to the file. There is no return value.
does not add line separators.)
does not add line separators.)
\end{funcdesc}
\end{funcdesc}
Classes that are trying to simulate a file object should also have a
writable
\code
{
softspace
}
attribute, which should be initialized to
zero. (
\code
{
softspace
}
is used by the
\code
{
print
}
statement.) This
will be automatic for classes implemented in Python; types implemented
in C will have to provide a writable
\code
{
softspace
}
attribute.
\subsubsection
{
Internal Objects
}
\subsubsection
{
Internal Objects
}
(See the Python Reference Manual for these.)
(See the Python Reference Manual for these.)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment