Initial commit of OpenSPARC T2 architecture model.
[OpenSPARC-T2-SAM] / sam-t2 / devtools / v8plus / lib / python2.4 / lib-old / util.py
CommitLineData
920dae64
AT
1# Module 'util' -- some useful functions that don't fit elsewhere
2
3# NB: These are now built-in functions, but this module is provided
4# for compatibility. Don't use in new programs unless you need backward
5# compatibility (i.e. need to run with old interpreters).
6
7
8# Remove an item from a list.
9# No complaints if it isn't in the list at all.
10# If it occurs more than once, remove the first occurrence.
11#
12def remove(item, list):
13 if item in list: list.remove(item)
14
15
16# Return a string containing a file's contents.
17#
18def readfile(fn):
19 return readopenfile(open(fn, 'r'))
20
21
22# Read an open file until EOF.
23#
24def readopenfile(fp):
25 return fp.read()