Commit 6681595d authored by Guido van Rossum's avatar Guido van Rossum

all sorts of minor nits

parent 3f21f962
...@@ -4,13 +4,13 @@ Followup-to: comp.lang.python ...@@ -4,13 +4,13 @@ Followup-to: comp.lang.python
From: guido@cwi.nl (Guido van Rossum) From: guido@cwi.nl (Guido van Rossum)
Reply-to: guido@cnri.reston.va.us (Guido van Rossum) Reply-to: guido@cnri.reston.va.us (Guido van Rossum)
Expires: Wed, 1 Nov 1995 00:00:00 GMT Expires: Wed, 1 Nov 1995 00:00:00 GMT
Supersedes: <DE1DI9.8MF@cwi.nl> Supersedes: <DFMAv8.3Hp@cwi.nl>
Approved: news-answers-request@MIT.Edu Approved: news-answers-request@MIT.Edu
Archive-name: python-faq/part1 Archive-name: python-faq/part1
Submitted-by: Guido van Rossum <guido@cwi.nl> Submitted-by: Guido van Rossum <guido@cwi.nl>
Version: 1.28 Version: 1.29
Last-modified: 28 September 1995 Last-modified: 11 October 1995
This article contains answers to Frequently Asked Questions about This article contains answers to Frequently Asked Questions about
Python (an object-oriented interpreted programming language -- see Python (an object-oriented interpreted programming language -- see
...@@ -21,15 +21,15 @@ redistribution of this FAQ is allowed. Printed redistribution only ...@@ -21,15 +21,15 @@ redistribution of this FAQ is allowed. Printed redistribution only
with permission of the author. No warranties. with permission of the author. No warranties.
Author's address: Author's address:
Guido van Rossum Guido van Rossum
C.N.R.I. C.N.R.I.
1895 Preston White Drive 1895 Preston White Drive
Reston, VA 22091 Reston, VA 22091
U.S.A. U.S.A.
Email: <guido@python.org>, <guido@cnri.reston.va.us>, <guido@cwi.nl> Email: <guido@python.org>, <guido@cnri.reston.va.us>, <guido@cwi.nl>
The latest version of this FAQ is available by anonymous ftp from The latest version of this FAQ is available by anonymous ftp from
<URL:ftp://ftp.python.org/pub/python/FAQ>. It will also be posted <URL:ftp://ftp.python.org/pub/doc/FAQ>. It will also be posted
regularly to the newsgroups comp.answers <URL:news:comp.answers> and regularly to the newsgroups comp.answers <URL:news:comp.answers> and
comp.lang.python <URL:news:comp.lang.python>. comp.lang.python <URL:news:comp.lang.python>.
...@@ -302,19 +302,30 @@ site). ...@@ -302,19 +302,30 @@ site).
A. The following anonymous ftp sites keep mirrors of the Python A. The following anonymous ftp sites keep mirrors of the Python
distribution: distribution:
<URL:ftp://ftp.cwi.nl/pub/python/> USA:
<URL:ftp://ftp.python.org/pub/python/>
<URL:ftp://gatekeeper.dec.com/pub/plan/python/> <URL:ftp://gatekeeper.dec.com/pub/plan/python/>
<URL:ftp://ftp.uu.net/languages/python/>
<URL:ftp://ftp.wustl.edu/graphics/graphics/sgi-stuff/python/> <URL:ftp://ftp.wustl.edu/graphics/graphics/sgi-stuff/python/>
<URL:ftp://ftp.uu.net/languages/python/> <URL:ftp://ftp.sterling.com/programming/languages/python/>
<URL:ftp://uiarchive.cso.uiuc.edu/pub/lang/python/>
<URL:ftp://ftp.pht.com/mirrors/python/python/>
Europe:
<URL:ftp://ftp.cwi.nl/pub/python/>
<URL:ftp://ftp.funet.fi/pub/languages/python/> <URL:ftp://ftp.funet.fi/pub/languages/python/>
<URL:ftp://ftp.sunet.se/pub/lang/python/> <URL:ftp://ftp.sunet.se/pub/lang/python/>
<URL:ftp://unix.hensa.ac.uk/mirrors/uunet/languages/python/> <URL:ftp://unix.hensa.ac.uk/mirrors/uunet/languages/python/>
<URL:ftp://ftp.sterling.com/programming/languages/python/>
<URL:ftp://uiarchive.cso.uiuc.edu/pub/lang/python/>
<URL:ftp://ftp.ibp.fr/pub/python/> <URL:ftp://ftp.ibp.fr/pub/python/>
<URL:ftp://ftp.switch.ch/software/sources/python/> <URL:ftp://ftp.switch.ch/software/sources/python/>
<URL:ftp://ftp.informatik.tu-muenchen.de/pub/comp/programming/languages/python/> <URL:ftp://ftp.informatik.tu-muenchen.de/pub/comp/programming/languages/python/>
Australia:
<URL:ftp://ftp.dstc.edu.au/pub/python/>
Or try archie on the string "python". Or try archie on the string "python".
1.6. Q. Is there a newsgroup or mailing list devoted to Python? 1.6. Q. Is there a newsgroup or mailing list devoted to Python?
...@@ -488,7 +499,7 @@ new kind of massively parallel processor). When KSR folded down a ...@@ -488,7 +499,7 @@ new kind of massively parallel processor). When KSR folded down a
couple of years ago, Tim lost his email access. He hasn't surfaced couple of years ago, Tim lost his email access. He hasn't surfaced
on the net since then. on the net since then.
Missing-him-too-ly yours... Missing-him-too-ly yours...
PS: support for Python's Emacs mode (Misc/python-mode.el in the PS: support for Python's Emacs mode (Misc/python-mode.el in the
distribution) has been taken up by Barry Warsaw. Questions about it distribution) has been taken up by Barry Warsaw. Questions about it
...@@ -547,9 +558,6 @@ Infoseek uses Python to implement their commercial WWW information ...@@ -547,9 +558,6 @@ Infoseek uses Python to implement their commercial WWW information
retrieval service <URL:http://www.infoseek.com/>. Contact: retrieval service <URL:http://www.infoseek.com/>. Contact:
<info@infoseek.com>. <info@infoseek.com>.
Michael Powers of daVinci Time & Space is "writing tons-o-python for
interactive television entertainment." Contact: <powers@dvts.com>.
Paul Everitt of Connecting Minds is planning a Lotus Notes gateway. Paul Everitt of Connecting Minds is planning a Lotus Notes gateway.
Contact: <Paul.Everitt@cminds.com>. Or see their WWW server Contact: <Paul.Everitt@cminds.com>. Or see their WWW server
<URL:http://www.cminds.com/>. <URL:http://www.cminds.com/>.
...@@ -582,15 +590,14 @@ If you'd like to be included in the list above, send me email! ...@@ -582,15 +590,14 @@ If you'd like to be included in the list above, send me email!
A. Very stable. While the current version number would suggest it is A. Very stable. While the current version number would suggest it is
in the early stages of development, in fact new, stable releases in the early stages of development, in fact new, stable releases
(numbered 0.9.x through 1.2) have been coming out roughly every 3 to (numbered 0.9.x through 1.3) have been coming out roughly every 3 to
6 months for the past four years. 6 months for the past four years.
2.5. Q. When will the next version be released? 2.5. Q. When will the next version be released?
A. I am planning to release 1.3 in early October 1995. It will A. Version 1.3 is being released on 13 October 1995. It is too early
contain keyword parameters as the most important new language feature. to predict when the next release will be necessary, but you can expect
A beta version was made available in August, more beta versions may something awesome within half a year!
appear.
2.6. Q. What new developments are expected for Python in the future? 2.6. Q. What new developments are expected for Python in the future?
...@@ -1476,39 +1483,39 @@ If after reading all of the above you still want to connect two pipes ...@@ -1476,39 +1483,39 @@ If after reading all of the above you still want to connect two pipes
to a subprocess's standard input and output, here's a simple solution, to a subprocess's standard input and output, here's a simple solution,
due to Jack Jansen: due to Jack Jansen:
import os import os
import sys import sys
import string import string
MAXFD = 100 # Max number of file descriptors in this system MAXFD = 100 # Max number of file descriptors in this system
def popen2(cmd): def popen2(cmd):
cmd = string.split(cmd) cmd = string.split(cmd)
p2cread, p2cwrite = os.pipe() p2cread, p2cwrite = os.pipe()
c2pread, c2pwrite = os.pipe() c2pread, c2pwrite = os.pipe()
pid = os.fork() pid = os.fork()
if pid == 0: if pid == 0:
# Child # Child
os.close(0) os.close(0)
os.close(1) os.close(1)
if os.dup(p2cread) <> 0: if os.dup(p2cread) <> 0:
sys.stderr.write('popen2: bad read dup\n') sys.stderr.write('popen2: bad read dup\n')
if os.dup(c2pwrite) <> 1: if os.dup(c2pwrite) <> 1:
sys.stderr.write('popen2: bad write dup\n') sys.stderr.write('popen2: bad write dup\n')
for i in range(3, MAXFD): for i in range(3, MAXFD):
try: try:
os.close(i) os.close(i)
except: except:
pass pass
try: try:
os.execv(cmd[0], cmd) os.execv(cmd[0], cmd)
finally: finally:
os._exit(1) os._exit(1)
os.close(p2cread) os.close(p2cread)
tochild = os.fdopen(p2cwrite, 'w') tochild = os.fdopen(p2cwrite, 'w')
os.close(c2pwrite) os.close(c2pwrite)
fromchild = os.fdopen(c2pread, 'r') fromchild = os.fdopen(c2pread, 'r')
return fromchild, tochild return fromchild, tochild
Note that many interactive programs (e.g. vi) don't work well with Note that many interactive programs (e.g. vi) don't work well with
pipes substituted for standard input and output. You will have to use pipes substituted for standard input and output. You will have to use
...@@ -1541,10 +1548,10 @@ one argument, the tuple args, instead of three arguments, the integers ...@@ -1541,10 +1548,10 @@ one argument, the tuple args, instead of three arguments, the integers
A. Assuming you're already using python-mode and font-lock-mode A. Assuming you're already using python-mode and font-lock-mode
separately, all you need to do is put this in your .emacs file: separately, all you need to do is put this in your .emacs file:
(defun my-python-mode-hook () (defun my-python-mode-hook ()
(setq font-lock-keywords python-font-lock-keywords) (setq font-lock-keywords python-font-lock-keywords)
(font-lock-mode 1)) (font-lock-mode 1))
(add-hook 'python-mode-hook 'my-python-mode-hook) (add-hook 'python-mode-hook 'my-python-mode-hook)
4.33. Q. Is there an inverse to the format operator (a la C's scanf())? 4.33. Q. Is there an inverse to the format operator (a la C's scanf())?
...@@ -1980,10 +1987,10 @@ Hints for proper usage of freeze.py: ...@@ -1980,10 +1987,10 @@ Hints for proper usage of freeze.py:
- you must have installed Python fully: - you must have installed Python fully:
make install make install
make libinstall make libinstall
make inclinstall make inclinstall
make libainstall make libainstall
6.14. Q. Why doesn't Python use proper garbage collection? 6.14. Q. Why doesn't Python use proper garbage collection?
...@@ -2008,9 +2015,9 @@ attractive. With GC, the following code (which is fine in current ...@@ -2008,9 +2015,9 @@ attractive. With GC, the following code (which is fine in current
Python) will run out of file descriptors long before it runs out of Python) will run out of file descriptors long before it runs out of
memory: memory:
for file in <very long list of files>: for file in <very long list of files>:
f = open(file) f = open(file)
c = file.read(1) c = file.read(1)
Using the current reference counting and destructor scheme, each new Using the current reference counting and destructor scheme, each new
assignment to f closes the previous file. Using GC, this is not assignment to f closes the previous file. Using GC, this is not
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment