Python Language FAQ - Table of Contents

Markus Fleck python-announce@python.org
Wed, 07 Jul 99 23:26:53 GMT


This FAQ newsgroup posting has been automatically converted from an
HTML snapshot of the original Python FAQ; please refer to the original
"Python FAQ Wizard" at <http://grail.cnri.reston.va.us/cgi-bin/faqw.py>
if source code snippets given in this document do not work - incidentally
some formatting information may have been lost during the conversion.

----------------------------------------------------------------------------

The whole Python FAQ - Table of Contents

Last changed on Mon Jun 28 19:36:09 1999 EDT

(Entries marked with ** were changed within the last 24 hours; entries
marked with * were changed within the last 7 days.)

----------------------------------------------------------------------------

1. General information and availability

1.1.  What is Python?
1.2.  Why is it called Python?
1.3.  How do I obtain a copy of the Python source?
1.4.  How do I get documentation on Python?
1.5.  Are there other ftp sites that mirror the Python distribution?
1.6.  Is there a newsgroup or mailing list devoted to Python?
1.7.  Is there a WWW page devoted to Python?
1.8.  Is the Python documentation available on the WWW?
1.9.  Are there any books on Python?
1.10. Are there any published articles about Python that I can
      reference?
1.11. Are there short introductory papers or talks on Python?
1.12. How does the Python version numbering scheme work?
1.13. How do I get a beta test version of Python?
1.14. Are there copyright restrictions on the use of Python?
1.15. Why was Python created in the first place?
1.16. Do I have to like "Monty Python's Flying Circus"?
1.17. What is Python good for?
1.18. Can I use the FAQ Wizard software to maintain my own FAQ?
1.19. Which editor has good support for editing Python source code?

----------------------------------------------------------------------------

2. Python in the real world

2.1.  How many people are using Python?
2.2.  Have any significant projects been done in Python?
2.3.  Are there any commercial projects going on using Python?
2.4.  How stable is Python?
2.5.  What new developments are expected for Python in the future?
2.6.  Is it reasonable to propose incompatible changes to Python?
2.7.  What is the future of Python?
2.8.  What is the PSA, anyway?
2.9.  How do I join the PSA?
2.10. What are the benefits of joining the PSA?
2.11. Is Python Y2K (Year 2000) Compliant?

----------------------------------------------------------------------------

3. Building Python and Other Known Bugs

3.1.  Is there a test set?
3.2.  When running the test set, I get complaints about floating point
      operations, but when playing with floating point operations I cannot
      find anything wrong with them.
3.3.  Link errors after rerunning the configure script.
3.4.  The python interpreter complains about options passed to a script
      (after the script name).
3.5.  When building on the SGI, make tries to run python to create
      glmodule.c, but python hasn't been built or installed yet.
3.6.  I use VPATH but some targets are built in the source directory.
3.7.  Trouble building or linking with the GNU readline library.
3.8.  Trouble with socket I/O on older Linux 1.x versions.
3.9.  Trouble with prototypes on Ultrix.
3.10. Other trouble building Python on platform X.
3.11. How to configure dynamic loading on Linux.
3.12. I can't get shared modules to work on Linux 2.0 (Slackware96)?
3.13. Trouble when making modules shared on Linux.
3.14. How to use threads on Linux.
3.15. Errors when linking with a shared library containing C++ code.
3.16. I built with tkintermodule.c enabled but get 'Tkinter not found'
3.17. I built with Tk 4.0 but Tkinter complains about the Tk version.
3.18. Compilation or link errors for the _tkinter module
3.19. I configured and built Python for Tcl/Tk but "import Tkinter"
      fails.
3.20. Tk doesn't work right on DEC Alpha.
3.21. Several common system calls are missing from the posix module.
3.22. ImportError: No module named string, on MS Windows.
3.23. Core dump on SGI when using the gl module.
3.24. "Initializer not a constant" while building DLL on MS-Windows
3.25. Output directed to a pipe or file disappears on Linux.
3.26. Syntax Errors all over the place in Linux with libc 5.4
3.27. Crash in XIO on Linux when using Tkinter.
3.28. How can I test if Tkinter is working?
3.29. Is there a way to get the interactive mode of the python
      interpreter to perform function/variable name completion?
3.30. Why is the Python interpreter not built as a shared library?
3.31. Build with GCC on Solaris 2.6 (SunOS 5.6) fails
3.32. Running "make clean" seems to leave problematic files that cause
      subsequent builds to fail.

----------------------------------------------------------------------------

4. Programming in Python

4.1.  Is there a source code level debugger with breakpoints, step,
      etc.?
4.2.  Can I create an object class with some methods implemented in C
      and others in Python (e.g. through inheritance)? (Also phrased as: Can
      I use a built-in type as base class?)
4.3.  Is there a curses/termcap package for Python?
4.4.  Is there an equivalent to C's onexit() in Python?
4.5.  When I define a function nested inside another function, the
      nested function seemingly can't access the local variables of the outer
      function. What is going on? How do I pass local data to a nested
      function?
4.6.  How do I iterate over a sequence in reverse order?
4.7.  My program is too slow. How do I speed it up?
4.8.  When I have imported a module, then edit it, and import it again
      (into the same Python process), the changes don't seem to take place.
      What is going on?
4.9.  How do I find the current module name?
4.10. I have a module in which I want to execute some extra code when
      it is run as a script. How do I find out whether I am running as a
      script?
4.11. I try to run a program from the Demo directory but it fails with
      ImportError: No module named ...; what gives?
4.12. I have successfully built Python with STDWIN but it can't find
      some modules (e.g. stdwinevents).
4.13. What GUI toolkits exist for Python?
4.14. Are there any interfaces to database packages in Python?
4.15. Is it possible to write obfuscated one-liners in Python?
4.16. Is there an equivalent of C's "?:" ternary operator?
4.17. My class defines __del__ but it is not called when I delete the
      object.
4.18. How do I change the shell environment for programs called using
      os.popen() or os.system()? Changing os.environ doesn't work.
4.19. What is a class?
4.20. What is a method?
4.21. What is self?
4.22. What is an unbound method?
4.23. How do I call a method defined in a base class from a derived
      class that overrides it?
4.24. How do I call a method from a base class without using the name
      of the base class?
4.25. How can I organize my code to make it easier to change the base
      class?
4.26. How can I find the methods or attributes of an object?
4.27. I can't seem to use os.read() on a pipe created with os.popen().
4.28. How can I create a stand-alone binary from a Python script?
4.29. What WWW tools are there for Python?
4.30. How do I run a subprocess with pipes connected to both input and
      output?
4.31. How do I call a function if I have the arguments in a tuple?
4.32. How do I enable font-lock-mode for Python in Emacs?
4.33. Is there a scanf() or sscanf() equivalent?
4.34. Can I have Tk events handled while waiting for I/O?
4.35. How do I write a function with output parameters (call by
      reference)?
4.36. Please explain the rules for local and global variables in
      Python.
4.37. How can I have modules that mutually import each other?
4.38. How do I copy an object in Python?
4.39. How to implement persistent objects in Python? (Persistent ==
      automatically saved to and restored from disk.)
4.40. I try to use __spam and I get an error about
      _SomeClassName__spam.
4.41. How do I delete a file? And other file questions.
4.42. How to modify urllib or httplib to support HTTP/1.1?
4.43. Unexplicable syntax errors in compile() or exec.
4.44. How do I convert a string to a number?
4.45. How do I convert a number to a string?
4.46. How do I copy a file?
4.47. How do I check if an object is an instance of a given class or of
      a subclass of it?
4.48. What is delegation?
4.49. How do I test a Python program or component.
4.50. My multidimensional list (array) is broken! What gives?
4.51. I want to do a complicated sort: can you do a Schwartzian
      Transform in Python?
4.52. How to convert between tuples and lists?
4.53. Files retrieved with urllib contain leading garbage that looks
      like email headers.
4.54. How do I get a list of all instances of a given class?
4.55. A regular expression fails with regex.error: match failure.
4.56. I can't get signal handlers to work.
4.57. I can't use a global variable in a function? Help!
4.58. What's a negative index? Why doesn't list.insert() use them?
4.59. How can I sort one list by values from another list?
4.60. Why doesn't dir() work on builtin types like files and lists?
4.61. How can I mimic CGI form submission (METHOD=POST)?
4.62. If my program crashes with a bsddb (or anydbm) database open, it
      gets corrupted. How come?
4.63. How do I make a Python script executable on Unix?
4.64. How do you remove duplicates from a list?
4.65. Are there any known year 2000 problems in Python?
4.66. I want a version of map that applies a method to a sequence of
      objects! Help!
4.67. How do I generate random numbers in Python?
4.68. How do I access the serial (RS232) port?
4.69. Images on Tk-Buttons don't work in Py15?
4.70. Where is the math.py (socket.py, regex.py, etc.) source file?
4.71. How do I send mail from a Python script?
4.72. How do I avoid blocking in connect() of a socket?
4.73. How do I specify hexadecimal and octal integers?
4.74. How to get a single keypress at a time?
4.75. How can I overload constructors (or methods) in Python?
4.76. How do I pass keyword arguments from one method to another?
4.77. What module should I use to help with generating HTML?
4.78. How do I create documentation from doc strings?
4.79. How do I read (or write) binary data?
4.80. I can't get key bindings to work in Tkinter
4.81. "import crypt" fails
4.82. Are there coding standards or a style guide for Python programs?
4.83. How do I freeze Tkinter applications?
4.84. How do I create static class data and static class methods?
4.85. __import__('x.y.z') returns <module 'x'>; how do I get z?
4.86. Basic thread wisdom
4.87. Why doesn't closing sys.stdout (stdin, stderr) really close it?
4.88. What kinds of global value mutation are thread-safe?
4.89. How do I modify a string in place?
4.90. How to pass on keyword/optional parameters/arguments

----------------------------------------------------------------------------

5. Extending Python

5.1.  Can I create my own functions in C?
5.2.  Can I create my own functions in C++?
5.3.  How can I execute arbitrary Python statements from C?
5.4.  How can I evaluate an arbitrary Python expression from C?
5.5.  How do I extract C values from a Python object?
5.6.  How do I use Py_BuildValue() to create a tuple of arbitrary
      length?
5.7.  How do I call an object's method from C?
5.8.  How do I catch the output from PyErr_Print() (or anything that
      prints to stdout/stderr)?
5.9.  How do I access a module written in Python from C?
5.10. How do I interface to C++ objects from Python?
5.11. mSQLmodule (or other old module) won't build with Python 1.5 (or
      later)
5.12. I added a module using the Setup file and the make fails! Huh?
5.13. I want to compile a Python module on my Red Hat Linux system, but
      some files are missing.
5.14. What does "SystemError: _PyImport_FixupExtension: module
      yourmodule not loaded" mean?

----------------------------------------------------------------------------

6. Python's design

6.1.  Why isn't there a switch or case statement in Python?
6.2.  Why does Python use indentation for grouping of statements?
6.3.  Why are Python strings immutable?
6.4.  Why don't strings have methods like index() or sort(), like lists?
6.5.  Why does Python use methods for some functionality (e.g.
      list.index()) but functions for other (e.g. len(list))?
6.6.  Why can't I derive a class from built-in types (e.g. lists or
      files)?
6.7.  Why must 'self' be declared and used explicitly in method
      definitions and calls?
6.8.  Can't you emulate threads in the interpreter instead of relying on
      an OS-specific thread implementation?
6.9.  Why can't lambda forms contain statements?
6.10. Why don't lambdas have access to variables defined in the
      containing scope?
6.11. Why can't recursive functions be defined inside other functions?
6.12. Why is there no more efficient way of iterating over a dictionary
      than first constructing the list of keys()?
6.13. Can Python be compiled to machine code, C or some other language?
6.14. How does Python manage memory? Why not full garbage collection?
6.15. Why are there separate tuple and list data types?
6.16. How are lists implemented?
6.17. How are dictionaries implemented?
6.18. Why must dictionary keys be immutable?
6.19. How the heck do you make an array in Python?
6.20. Why doesn't list.sort() return the sorted list?
6.21. How do you specify and enforce an interface spec in Python?
6.22. Why do all classes have the same type? Why do instances all have
      the same type?
6.23. Why isn't all memory freed when Python exits?
6.24. Why no class methods or mutable class variables?
6.25. Why are default values sometimes shared between objects?
6.26. Why no goto?
6.27. How do you make a higher order function in Python?
6.28. Why do I get a SyntaxError for a 'continue' inside a 'try'?
6.29. Why can't raw strings (r-strings) end with a backslash?
6.30. Why can't I use an assignment in an expression?

----------------------------------------------------------------------------

7. Using Python on non-UNIX platforms

7.1.  Is there a Mac version of Python?
7.2.  Are there DOS and Windows versions of Python?
7.3.  Is there an OS/2 version of Python?
7.4.  Is there a VMS version of Python?
7.5.  What about IBM mainframes, or other non-UNIX platforms?
7.6.  Where are the source or Makefiles for the non-UNIX versions?
7.7.  What is the status and support for the non-UNIX versions?
7.8.  I have a PC version but it appears to be only a binary. Where's
      the library?
7.9.  Where's the documentation for the Mac or PC version?
7.10. How do I create a Python program file on the Mac or PC?
7.11. How can I use Tkinter on Windows 95/NT?
7.12. cgi.py (or other CGI programming) doesn't work sometimes on NT or
      win95!
7.13. Why doesn't os.popen() work in PythonWin on NT?
7.14. How do I use different functionality on different platforms with
      the same program?
7.15. Is there an Amiga version of Python?
7.16. Why doesn't os.popen()/win32pipe.popen() work on Win9x?

----------------------------------------------------------------------------

8. Python on Windows

8.1.  Using Python for CGI on Microsoft Windows
8.2.  How to check for a keypress without blocking?
8.3.  $PYTHONPATH
8.4.  dedent syntax errors
8.5.  How do I emulate os.kill() in Windows?
8.6.  Why does os.path.isdir() fail on NT shared directories?
8.7.  PyRun_SimpleFile() crashes on Windows but not on Unix
8.8.  Import of _tkinter fails on Windows 95/98
8.9.  Can't extract the downloaded documentation on Windows
8.10. Can't get Py_RunSimpleFile() to work.
8.11. Where is Freeze for Windows?
8.12. Is a *.pyd file the same as a DLL?
8.13. Missing cw3215mt.dll (or missing cw3215.dll)

----------------------------------------------------------------------------

-- 
----------- comp.lang.python.announce (moderated) ----------
Article Submission Address:  python-announce@python.org
Python Language Home Page:   http://www.python.org/
Python Quick Help Index:     http://www.python.org/Help.html
------------------------------------------------------------