diff --git a/Misc/FAQ b/Misc/FAQ index 637acec19dc..44a0d295034 100644 --- a/Misc/FAQ +++ b/Misc/FAQ @@ -4,13 +4,13 @@ Followup-to: comp.lang.python From: guido@cwi.nl (Guido van Rossum) Reply-to: guido@cnri.reston.va.us (Guido van Rossum) Expires: Wed, 1 Nov 1995 00:00:00 GMT -Supersedes: +Supersedes: Approved: news-answers-request@MIT.Edu Archive-name: python-faq/part1 Submitted-by: Guido van Rossum -Version: 1.28 -Last-modified: 28 September 1995 +Version: 1.29 +Last-modified: 11 October 1995 This article contains answers to Frequently Asked Questions about Python (an object-oriented interpreted programming language -- see @@ -21,15 +21,15 @@ redistribution of this FAQ is allowed. Printed redistribution only with permission of the author. No warranties. Author's address: - Guido van Rossum - C.N.R.I. - 1895 Preston White Drive - Reston, VA 22091 - U.S.A. + Guido van Rossum + C.N.R.I. + 1895 Preston White Drive + Reston, VA 22091 + U.S.A. Email: , , The latest version of this FAQ is available by anonymous ftp from -. It will also be posted +. It will also be posted regularly to the newsgroups comp.answers and comp.lang.python . @@ -302,19 +302,30 @@ site). A. The following anonymous ftp sites keep mirrors of the Python distribution: - +USA: + + + - + + + + +Europe: + + - - +Australia: + + + Or try archie on the string "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 couple of years ago, Tim lost his email access. He hasn't surfaced 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 distribution) has been taken up by Barry Warsaw. Questions about it @@ -547,9 +558,6 @@ Infoseek uses Python to implement their commercial WWW information retrieval service . Contact: . -Michael Powers of daVinci Time & Space is "writing tons-o-python for -interactive television entertainment." Contact: . - Paul Everitt of Connecting Minds is planning a Lotus Notes gateway. Contact: . Or see their WWW server . @@ -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 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. 2.5. Q. When will the next version be released? -A. I am planning to release 1.3 in early October 1995. It will -contain keyword parameters as the most important new language feature. -A beta version was made available in August, more beta versions may -appear. +A. Version 1.3 is being released on 13 October 1995. It is too early +to predict when the next release will be necessary, but you can expect +something awesome within half a year! 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 to a subprocess's standard input and output, here's a simple solution, due to Jack Jansen: - import os - import sys - import string + import os + import sys + 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): - cmd = string.split(cmd) - p2cread, p2cwrite = os.pipe() - c2pread, c2pwrite = os.pipe() - pid = os.fork() - if pid == 0: - # Child - os.close(0) - os.close(1) - if os.dup(p2cread) <> 0: - sys.stderr.write('popen2: bad read dup\n') - if os.dup(c2pwrite) <> 1: - sys.stderr.write('popen2: bad write dup\n') - for i in range(3, MAXFD): - try: - os.close(i) - except: - pass - try: - os.execv(cmd[0], cmd) - finally: - os._exit(1) - os.close(p2cread) - tochild = os.fdopen(p2cwrite, 'w') - os.close(c2pwrite) - fromchild = os.fdopen(c2pread, 'r') - return fromchild, tochild + def popen2(cmd): + cmd = string.split(cmd) + p2cread, p2cwrite = os.pipe() + c2pread, c2pwrite = os.pipe() + pid = os.fork() + if pid == 0: + # Child + os.close(0) + os.close(1) + if os.dup(p2cread) <> 0: + sys.stderr.write('popen2: bad read dup\n') + if os.dup(c2pwrite) <> 1: + sys.stderr.write('popen2: bad write dup\n') + for i in range(3, MAXFD): + try: + os.close(i) + except: + pass + try: + os.execv(cmd[0], cmd) + finally: + os._exit(1) + os.close(p2cread) + tochild = os.fdopen(p2cwrite, 'w') + os.close(c2pwrite) + fromchild = os.fdopen(c2pread, 'r') + return fromchild, tochild 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 @@ -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 separately, all you need to do is put this in your .emacs file: - (defun my-python-mode-hook () - (setq font-lock-keywords python-font-lock-keywords) - (font-lock-mode 1)) - (add-hook 'python-mode-hook 'my-python-mode-hook) + (defun my-python-mode-hook () + (setq font-lock-keywords python-font-lock-keywords) + (font-lock-mode 1)) + (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())? @@ -1980,10 +1987,10 @@ Hints for proper usage of freeze.py: - you must have installed Python fully: - make install - make libinstall - make inclinstall - make libainstall + make install + make libinstall + make inclinstall + make libainstall 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 Python) will run out of file descriptors long before it runs out of memory: - for file in : - f = open(file) - c = file.read(1) + for file in : + f = open(file) + c = file.read(1) Using the current reference counting and destructor scheme, each new assignment to f closes the previous file. Using GC, this is not