summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2009-05-17 12:22:57 (GMT)
committerGeorg Brandl <georg@python.org>2009-05-17 12:22:57 (GMT)
commitef0a865f9c906a1298c43a453b2195d86befd6a4 (patch)
tree1fd8e4bad94725a0b783e41185ae92c0e55bdcfe /Lib
parent55689c9240ee225c3974b814bf950381765e9e30 (diff)
downloadcpython-ef0a865f9c906a1298c43a453b2195d86befd6a4.zip
cpython-ef0a865f9c906a1298c43a453b2195d86befd6a4.tar.gz
cpython-ef0a865f9c906a1298c43a453b2195d86befd6a4.tar.bz2
Use PEP 8 and true booleans.
Diffstat (limited to 'Lib')
-rw-r--r--Lib/fileinput.py17
1 files changed, 9 insertions, 8 deletions
diff --git a/Lib/fileinput.py b/Lib/fileinput.py
index e4c71ce..90a600b 100644
--- a/Lib/fileinput.py
+++ b/Lib/fileinput.py
@@ -81,16 +81,17 @@ XXX Possible additions:
import sys, os
-__all__ = ["input","close","nextfile","filename","lineno","filelineno",
- "isfirstline","isstdin","FileInput"]
+__all__ = ["input", "close", "nextfile", "filename", "lineno", "filelineno",
+ "isfirstline", "isstdin", "FileInput"]
_state = None
DEFAULT_BUFSIZE = 8*1024
-def input(files=None, inplace=0, backup="", bufsize=0,
+def input(files=None, inplace=False, backup="", bufsize=0,
mode="r", openhook=None):
- """input([files[, inplace[, backup[, mode[, openhook]]]]])
+ """input(files=None, inplace=False, backup="", bufsize=0, \
+mode="r", openhook=None)
Create an instance of the FileInput class. The instance will be used
as global state for the functions of this module, and is also returned
@@ -194,7 +195,7 @@ class FileInput:
sequential order; random access and readline() cannot be mixed.
"""
- def __init__(self, files=None, inplace=0, backup="", bufsize=0,
+ def __init__(self, files=None, inplace=False, backup="", bufsize=0,
mode="r", openhook=None):
if isinstance(files, str):
files = (files,)
@@ -398,11 +399,11 @@ def hook_encoded(encoding):
def _test():
import getopt
- inplace = 0
- backup = 0
+ inplace = False
+ backup = False
opts, args = getopt.getopt(sys.argv[1:], "ib:")
for o, a in opts:
- if o == '-i': inplace = 1
+ if o == '-i': inplace = True
if o == '-b': backup = a
for line in input(args, inplace=inplace, backup=backup):
if line[-1:] == '\n': line = line[:-1]