diff --git a/Misc/BLURB b/Misc/BLURB deleted file mode 100644 index 590380576dd..00000000000 --- a/Misc/BLURB +++ /dev/null @@ -1,29 +0,0 @@ -What is Python? Executive Summary ----------------------------------- - -Python is an interpreted, object-oriented, high-level programming -language with dynamic semantics. Its high-level built in data -structures, combined with dynamic typing and dynamic binding, make it -very attractive for rapid application development, as well as for use -as a scripting or glue language to connect existing components -together. Python's simple, easy to learn syntax emphasizes -readability and therefore reduces the cost of program maintenance. -Python supports modules and packages, which encourages program -modularity and code reuse. The Python interpreter and the extensive -standard library are available in source or binary form without charge -for all major platforms, and can be freely distributed. - -Often, programmers fall in love with Python because of the increased -productivity it provides. Since there is no compilation step, the -edit-test-debug cycle is incredibly fast. Debugging Python programs is -easy: a bug or bad input will never cause a segmentation fault. -Instead, when the interpreter discovers an error, it raises an -exception. When the program doesn't catch the exception, the -interpreter prints a stack trace. A source level debugger allows -inspection of local and global variables, evaluation of arbitrary -expressions, setting breakpoints, stepping through the code a line at -a time, and so on. The debugger is written in Python itself, -testifying to Python's introspective power. On the other hand, often -the quickest way to debug a program is to add a few print statements -to the source: the fast edit-test-debug cycle makes this simple -approach very effective. diff --git a/Misc/BLURB.LUTZ b/Misc/BLURB.LUTZ deleted file mode 100644 index e508207521d..00000000000 --- a/Misc/BLURB.LUTZ +++ /dev/null @@ -1,122 +0,0 @@ -Newsgroups: comp.lang.perl,comp.lang.tcl -From: lutz@xvt.com (Mark Lutz) -Subject: Python (was Re: Has anyone done a tk addition to perl?) -Organization: XVT Software Inc. -Date: Thu, 14 Oct 1993 17:10:37 GMT -X-Disclaimer: The views expressed in this message are those of an - individual at XVT Software Inc., and do not necessarily - reflect those of the company. - - -I've gotten a number of requests for information about Python, -since my post here earlier this week. Since this appears to be -of general interest, and since there's no python news group yet, -I'm posting a description here. I'm not the best authority on -the language, but here's my take on it. - -[TCL/Perl zealots: this is informational only; I'm not trying to -'convert' anybody, and don't have time for a language war :-) -There is a paper comparing TCL/Perl/Python/Emacs-Lisp, which is -referenced in the comp.lang.misc faq, I beleive.] - - -What is Python?... - -Python is a relatively new very-high-level language developed -in Amsterdam. Python is a simple, procedural language, with -features taken from ABC, Icon, Modula-3, and C/C++. - -It's central goal is to provide the best of both worlds: -the dynamic nature of scripting languages like Perl/TCL/REXX, -but also support for general programming found in the more -traditional languages like Icon, C, Modula,... - -As such, it can function as a scripting/extension language, -as a rapid prototyping language, and as a serious software -development language. Python is suitable for fast development -of large programs, but also does well at throw-away shell coding. - -Python resembles other scripting languages a number of ways: - - dynamic, interpretive, interactive nature - - no explicit compile or link steps needed - - no type declarations (it's dynamically typed) - - high-level operators ('in', concatenation, etc) - - automatic memory allocation/deallocation (no 'pointers') - - high level objects: lists, tuples, strings, associative arrays - - programs can construct and execute program code using strings - - very fast edit/compile/run cycle; no static linking - - well-defined interface to and from C functions and data - - well-defined ways to add C modules to the system and language - -Python's features that make it useful for serious programming: - - it's object-oriented; it has a simplified subset of - C++'s 'class' facility, made more useful by python's - dynamic typing; the language is object-oriented from - the ground up (rather than being an add-on, as in C++) - - - it supports modules (imported packages, as in Modula-3); - modules replace C's 'include' files and linking, and allow - for multiple-module systems, code sharing, etc.; - - - it has a good exception handling system (a 'try' statement, - and a 'raise' statement, with user-defined exceptions); - - - it's orthogonal; everything is a first-class object in the - language (functions, modules, classes, class instance methods...) - and can be assigned/passed and used generically; - - - it's fairly run-time secure; it does many run-time checks - like index-out-of-bounds, etc., that C usually doesn't; - - - it has general data structuring support; Python lists are - heterogeneous, variable length, nestable, support slicing, - concatenation, etc., and come into existance and are reclaimed - automatically; strings and dictionaries are similarly general; - - - it's got a symbolic debugger and profiler (written in python, - of course..), and an interactive command-line interface; - as in Lisp, you can enter code and test functions in isolation, - from the interactive command line (even linked C functions); - - - it has a large library of built-in modules; it has support - for sockets, regular expressions, posix bindings, etc. - - - it supports dynamic loading of C modules on many platforms; - - - it has a _readable_ syntax; python code looks like normal - programming languages; tcl and perl can be very unreadable - (IMHO; what was that joke about Perl looking the same after - rot13..); python's syntax is simple, and statement based; - - -Of course, Python isn't perfect, but it's a good compromise betweem -scripting languages and traditional ones, and so is widely applicable. -'Perfect' languages aren't always useful for real-world tasks (Prolog, -for example), and languages at either extreme are not useful in the other -domain (C is poor for shell coding and prototyping, and awk is useless -for large systems design; Python does both well). - -For example, I've used Python successfully for a 4K line expert system -shell project; it would have been at least twice as large in C, and would -have been very difficult in TCL or Perl. - -Python uses an indentation-based syntax which may seem unusual at first -to C coders, but after using it I have found it to be _very_ handy, since -there's less to type. [I now forget to type '}' in my C code, and am -busy calculating how much time I wasted typing all those '}', 'END', etc., -just to pander to 'brain-dead' C/Pascal compilers :-)]. - -Python's currently at release 0.9.9. It seems suprisingly stable. -The first 'official' 1.0 release is due out by the end of this year. -Python runs on most popular machines/systems (mac, dos, unix, etc.) -It's public domain and distributable, and can be had via ftp. The -distribution includes examples, tutorials, and documentation. The -latest ftp address I have (I got it on a cd-rom): - pub/python/* at ftp.cwi.nl - pub/? at wuarchive.wustl.edu (in america) - -There's a python mailing list maintained by the language's creator. -Mail 'python-list-request@cwi.nl' to get on it. - -Mark Lutz -lutz@xvt.com diff --git a/Misc/BLURB.WINDOWS b/Misc/BLURB.WINDOWS deleted file mode 100644 index 097db4d5915..00000000000 --- a/Misc/BLURB.WINDOWS +++ /dev/null @@ -1,81 +0,0 @@ -Announcing Python - -Python, a mature, powerful and stable programming language used by -tens of thousands of programmers worldwide, has arrived in full force -at the heart of Windows 95 and Windows NT. Toting the powerful -toolbox which has made it such a sucess on almost every modern -operating system, Python for Windows has embraced the metaphors and -resources of its new home and turned them into powerful tools within -the Python language. - -Python's wrapper-around-a-tool metaphor allows it to provide a -well-formed handle for manipulating the technologies which MicroSoft -provides to the programmer. These tools include: - -- Office automation and customisation through ActiveX and COM Scripting -- Networking services -- Remote access services -- Performance monitoring -- Registry maintenance -- Database interaction through both ODBC and native database drivers - -In addition, Python provides access to the standard -application-building libraries, the MicroSoft Foundation Classes. - -Python is a high-level, interpreted, interactive, object-oriented -programming language. It provides the modern features programmer's -expect or desire, modules, exceptions, dynamic typing, high-level -dynamic data types, and classes. It combines remarkable power with -clear syntax, and easy extension. - -It is easy to extend Python by adding new, compiled tools to the -language. The compiling of extensions into the language toolbox -mitigates the overhead of interpretation, while the ability to mix -compiled and interpretted code promotes rapid application -development. In addition, it is possible to embed Python itself as a -tool in your applications, an easily understood and readily learned -extension language. - -(Should be some sort of bridge between the ideas of extending and the -ideas of already-available tools, but I have to start work soon...) - -Python's extensive, portable toolbox, available on Windows, most -Unixes, MacOS, DOS, and OS/2 includes a host of powerful tools which -are now easily available to Windows programmers. These include: - -- TCP/IP socket support -- CGI Forms Processing for the World-wide web -- Clients and servers for (among others) the HTTP and FTP protocols -- Powerful text manipulation facilities -- Powerful (optional) numeric and image manipulation facilities - -One of the most exciting of Python for Windows' new tools is -COM/ActiveX support. This tool allows Python to act as both server -and client to any COM-capable application or language, a group that -includes MSOffice, CorelDraw, MS Active Server Pages, Netscape -Communicator, MS Internet Explorer, Delphi, Visual Basic and Visual -C++. - -Client support allows Python to drive these applications (or -applications written in these languages), automating tasks, importing -or exporting data, customising environments and processing -information. Server support allows Python to be driven in a similar -manner, to provide access to its tools to any application capable of -calling a COM object. - -> Python's dynamism, flexibility, object oriented features, and -> ease of use make it a powerful and useful alternative to Java, -> Visual Basic, and compiled languages such as Delphi or C++. -> Simply put Python offers the simplest and most powerful way -> to solve many important programming and system administration -> tasks in the ActiveX/COM environment." - -It is, however, Python which is the star of Python for Windows. -Over seven years old, Python has long been a favourite of Web -Masters, Python is a clear, easily learned and understood language -with features that lend themselves to developing rapid, robust, -dynamic solutions. It is being used to solve problems in many large -organisations, notably including ... (insert notes here). It is -enthusiastically supported through public newsgroups and mailing -lists frequented by a large number of Python enthusiasts. Python -arguably provides the best support of any free language available. diff --git a/Misc/HYPE b/Misc/HYPE deleted file mode 100644 index ff39f4990bd..00000000000 --- a/Misc/HYPE +++ /dev/null @@ -1,70 +0,0 @@ -Newsgroups: comp.lang.misc,comp.lang.c,comp.lang.c++,comp.lang.perl,comp.lang.tcl -Followup-to: comp.lang.misc -Subject: Python 1.0.0 is out! - ---> Tired of decyphering the Perl code you wrote last week? - ---> Frustrated with Bourne shell syntax? - ---> Spent too much time staring at core dumps lately? - -Maybe you should try Python, the next generation object-oriented -scripting and prototyping language, with a *readable* syntax. Python -has been used by hundreds of happy users all over the world during the -past three years, and is now ready for prime time. - -Python is an interpreted language, and has the usual advantages of -such languages, such as run-time checks (e.g. bounds checking), -execution of dynamically generated code, automatic memory allocation, -high level operations on strings, lists and dictionaries (associative -arrays), and a fast edit-compile-run cycle. Additionally, it features -modules, classes, exceptions, and dynamic linking of extensions -written in C or C++. It has arbitrary precision integers. - -Python can be run interactively, and there is an extensive Emacs -editing mode which includes the capability to execute regions of code. -For the truly desperate there is a source level debugger (written in -Python, of course :-). - -Python comes with a large library of standard modules and classes, as -well as an extensive set of demo programs. It has interfaces to most -Unix system calls and library functions, and there exist extensions -that interface to window systems and graphics libraries like X and -SGI's GL. - -Python's source (in C) and documentation (in LaTeX and PostScript) are -freely available on the Internet. It builds without intervention on -most Unix platforms: error-free builds have been confirmed for SGI -IRIX 4 and 5, Sun SunOS 4 and Solaris 2, HP-UX, DEC Ultrix and OSF/1, -IBM AIX, and SCO ODT 3.0. A Macintosh binary is also available -- a -DOS binary is in the works. - -If you have a WWW viewer (e.g. Mosaic), you can see all Python -documentation on-line: point your viewer at the URL -http://www.cwi.nl/~guido/Python.html. - -The source and documentation are available by anonymous ftp from the -following sites -- please pick the one closest to you: - -Site IP address Directory - -ftp.cwi.nl 192.16.184.180 /pub/python -gatekeeper.dec.com 16.1.0.2 /pub/plan/python/cwi -ftp.uu.net 192.48.96.9 /languages/python -ftp.fu-berlin.de 130.133.4.50 /pub/unix/languages/python - -The file is called python1.0.0.tar.Z (some mirror sites convert it to -a .gz file or split it up in separate parts). See the INDEX file for -other goodies: FAQ, NEWS, PostScript, Emacs info, Mac binary, etc. -(Please don't ask me to mail it to you -- at 1.76 Megabytes it is -unwieldy at least...) - -There's a mailing list; write to to subscribe (no -LISTSERV commands please). A FAQ list is regularly posted to -comp.lang.misc. A newsgroup may be created in the near future. - -[Excuse the hype -- Python really is a neat language, if I may say so. -Please direct all followups to comp.lang.misc only.] - ---Guido van Rossum, CWI, Amsterdam -URL: diff --git a/Misc/comparisons b/Misc/comparisons deleted file mode 100644 index 8e52e82a323..00000000000 --- a/Misc/comparisons +++ /dev/null @@ -1,129 +0,0 @@ -Comparing Python to Other Languages ------------------------------------ - -These comparisons are a personal view. Comments are requested. ---Guido van Rossum - -Python is often compared to other interpreted languages such as Java, -JavaScript, Perl, Tcl, or Smalltalk. Comparisons to C++, Common Lisp -and Scheme can also be enlightening. In this section I will briefly -compare Python to each of these languages. These comparisons -concentrate on language issues only. In practice, the choice of a -programming language is often dictated by other real-world constraints -such as cost, availability, training, and prior investment, or even -emotional attachment. Since these aspects are highly variable, it -seems a waste of time to consider them much for this publication. - -Java - -Python programs are generally expected to run slower than Java -programs, but they also take much less time to develop. Python -programs are typically 3-5 times shorter than equivalent Java -programs. This difference can be attributed to Python's built-in -high-level data types and its dynamic typing. For example, a Python -programmer wastes no time declaring the types of arguments or -variables, and Python's powerful polymorphic list and dictionary -types, for which rich syntactic support is built straight into the -language, find a use in almost every Python program. Because of the -run-time typing, Python's run time must work harder than Java's. For -example, when evaluating the expression a+b, it must first inspect the -objects a and b to find out their type, which is not known at compile -time. It then invokes the appropriate addition operation, which may be -an overloaded user-defined method. Java, on the other hand, can -perform an efficient integer or floating point addition, but requires -variable declarations for a and b, and does not allow overloading of -the + operator for instances of user-defined classes. - -For these reasons, Python is much better suited as a "glue" language, -while Java is better characterized as a low-level implementation -language. In fact, the two together make an excellent -combination. Components can be developed in Java and combined to form -applications in Python; Python can also be used to prototype -components until their design can be "hardened" in a Java -implementation. To support this type of development, a Python -implementation written in Java is under development, which allows -calling Python code from Java and vice versa. In this implementation, -Python source code is translated to Java bytecode (with help from a -run-time library to support Python's dynamic semantics). - -Javascript - -Python's "object-based" subset is roughly equivalent to -JavaScript. Like JavaScript (and unlike Java), Python supports a -programming style that uses simple functions and variables without -engaging in class definitions. However, for JavaScript, that's all -there is. Python, on the other hand, supports writing much larger -programs and better code reuse through a true object-oriented -programming style, where classes and inheritance play an important -role. - -Perl - -Python and Perl come from a similar background (Unix scripting, which -both have long outgrown), and sport many similar features, but have a -different philosophy. Perl emphasizes support for common -application-oriented tasks, e.g. by having built-in regular -expressions, file scanning and report generating features. Python -emphasizes support for common programming methodologies such as data -structure design and object-oriented programming, and encourages -programmers to write readable (and thus maintainable) code by -providing an elegant but not overly cryptic notation. As a -consequence, Python comes close to Perl but rarely beats it in its -original application domain; however Python has an applicability well -beyond Perl's niche. - -Tcl - -Like Python, Tcl is usable as an application extension language, as -well as a stand-alone programming language. However, Tcl, which -traditionally stores all data as strings, is weak on data structures, -and executes typical code much slower than Python. Tcl also lacks -features needed for writing large programs, such as modular -namespaces. Thus, while a "typical" large application using Tcl -usually contains Tcl extensions written in C or C++ that are specific -to that application, an equivalent Python application can often be -written in "pure Python". Of course, pure Python development is much -quicker than having to write and debug a C or C++ component. It has -been said that Tcl's one redeeming quality is the Tk toolkit. Python -has adopted an interface to Tk as its standard GUI component library. - -Smalltalk - -Perhaps the biggest difference between Python and Smalltalk is -Python's more "mainstream" syntax, which gives it a leg up on -programmer training. Like Smalltalk, Python has dynamic typing and -binding, and everything in Python is an object. However, Python -distinguishes built-in object types from user-defined classes, and -currently doesn't allow inheritance from built-in types. Smalltalk's -standard library of collection data types is more refined, while -Python's library has more facilities for dealing with Internet and WWW -realities such as email, HTML and FTP. Python has a different -philosophy regarding the development environment and distribution of -code. Where Smalltalk traditionally has a monolithic "system image" -which comprises both the environment and the user's program, Python -stores both standard modules and user modules in individual files -which can easily be rearranged or distributed outside the system. One -consequence is that there is more than one option for attaching a -Graphical User Interface (GUI) to a Python program, since the GUI is -not built into the system. - -C++ - -Almost everything said for Java also applies for C++, just more so: -where Python code is typically 3-5 times shorter than equivalent Java -code, it is often 5-10 times shorter than equivalent C++ code! -Anecdotal evidence suggests that one Python programmer can finish in -two months what two C++ programmers can't complete in a year. Python -shines as a glue language, used to combine components written in C++. - -Common Lisp and Scheme - -These languages are close to Python in their dynamic semantics, but so -different in their approach to syntax that a comparison becomes almost -a religious argument: is Lisp's lack of syntax an advantage or a -disadvantage? It should be noted that Python has introspective -capabilities similar to those of Lisp, and Python programs can -construct and execute program fragments on the fly. Usually, -real-world properties are decisive: Common Lisp is big (in every -sense), and the Scheme world is fragmented between many incompatible -versions, where Python has a single, free, compact implementation. diff --git a/Misc/editline-fix b/Misc/editline-fix deleted file mode 100644 index 713b1a4e511..00000000000 --- a/Misc/editline-fix +++ /dev/null @@ -1,80 +0,0 @@ -Subject: Problems trying to use readline or editline ... -From: Skip Montanaro -To: python-list@cwi.nl -Date: 19 Nov 1995 14:19:56 GMT -X-Newsgroups: comp.lang.python -X-Organization: Automatrix, Inc. - - -I'm having some trouble with either of the line editing libraries available -to me. If I build Python with libreadline, I get "staircases" in my -interpreter output: - - >>> s = 1 - >>> a = 3 - >>> etc. - -So I figured I'd give Rich Salz's editline a try. It seems to be missing a -couple readline functions. When I link I get: - - myreadline.o: Undefined symbol _rl_insert referenced from text segment - myreadline.o: Undefined symbol _rl_bind_key referenced from text segment - -I'm running on BSD/OS 2.0 with GCC 2.6.3 as the compiler. My configure line -was - - ./configure --with-readline=/home/dolphin/skip/src/editline \ - --with-dl-dld=/home/dolphin/skip/src/dl-dld,/home/dolphin/skip/src/dld - -For editline I tried several things before arriving at something that does -work ... sort of. First I commented out the tab key binding in Python's -Parser/myreadline.c then had to fiddle with editline.c to get tabs to -insert. The diffs below seem to work, but have no notion of tab stops (I -like 4-char tab stops). - -I'd be grateful if anybody had a solution to the readline staircases or a -better solution for making editline work. - -*** editline.c~ Tue Nov 15 08:53:01 1994 ---- editline.c Sun Nov 19 09:15:16 1995 -*************** -*** 142,145 **** ---- 142,148 ---- - TTYput('?'); - } -+ else if (c == '\t') { -+ TTYput('\t'); -+ } - else if (ISCTL(c)) { - TTYput('^'); -*************** -*** 1326,1329 **** ---- 1329,1338 ---- - } - -+ STATIC STATUS -+ tab() -+ { -+ return insert_char('\t'); -+ } -+ - STATIC KEYMAP Map[33] = { - { CTL('@'), ring_bell }, -*************** -*** 1335,1339 **** - { CTL('G'), ring_bell }, - { CTL('H'), bk_del_char }, -! { CTL('I'), c_complete }, - { CTL('J'), accept_line }, - { CTL('K'), kill_line }, ---- 1344,1348 ---- - { CTL('G'), ring_bell }, - { CTL('H'), bk_del_char }, -! { CTL('I'), tab }, - { CTL('J'), accept_line }, - { CTL('K'), kill_line }, --- -Skip Montanaro skip@automatrix.com (518)372-5583 -Musi-Cal: http://www.calendar.com/concerts/ or mailto:concerts@calendar.com -Internet Conference Calendar: http://www.calendar.com/conferences/ - >>> ZLDF: http://www.netresponse.com/zldf <<< diff --git a/Misc/faq2html.py b/Misc/faq2html.py deleted file mode 100755 index 32f3e79601b..00000000000 --- a/Misc/faq2html.py +++ /dev/null @@ -1,167 +0,0 @@ -#! /usr/bin/env python - -# A somewhat-generalized FAQ-to-HTML converter (by Ka-Ping Yee, 10 Sept 96) - -# Reads a text file given on standard input or named as first argument, and -# generates HTML 2.0 on standard output. Recognizes these constructions: -# -# HTML element pattern at the beginning of a line -# -# section heading ()+ -# numbered list element <1-2 spaces>()+ -# unnumbered list element <0-2 spaces> -# preformatted section -# -# Heading level is determined by the number of () segments. -# Blank lines force a separation of elements; if none of the above four -# types is indicated, a new paragraph begins. A line beginning with many -# spaces is interpreted as a continuation (instead of preformatted) after -# a list element. Headings are anchored; paragraphs starting with "Q." are -# emphasized, and those marked with "A." get their first sentence emphasized. -# -# Hyperlinks are created from references to: -# URLs, explicitly marked using -# other questions, of the form "question ()*" -# sections, of the form "section ". - -import sys, string, regex, regsub, regex_syntax -regex.set_syntax(regex_syntax.RE_SYNTAX_AWK) - -# --------------------------------------------------------- regular expressions -orditemprog = regex.compile(' ?([1-9][0-9]*\.)+ +') -itemprog = regex.compile(' ? ?[-*] +') -headingprog = regex.compile('([1-9][0-9]*\.)+ +') -prefmtprog = regex.compile(' ') -blankprog = regex.compile('^[ \t\r\n]$') -questionprog = regex.compile(' *Q\. +') -answerprog = regex.compile(' *A\. +') -sentprog = regex.compile('(([^.:;?!(]|[.:;?!][^ \t\r\n])+[.:;?!]?)') - -mailhdrprog = regex.compile('^(Subject|Newsgroups|Followup-To|From|Reply-To' - '|Approved|Archive-Name|Version|Last-Modified): +', regex.casefold) -urlprog = regex.compile('<URL:([^&]+)>') -addrprog = regex.compile('<([^>@:]+@[^&@:]+)>') -qrefprog = regex.compile('question +([1-9](\.[0-9]+)*)') -srefprog = regex.compile('section +([1-9][0-9]*)') -entityprog = regex.compile('[&<>]') - -# ------------------------------------------------------------ global variables -body = [] -ollev = ullev = 0 -element = content = secnum = version = '' - -# ----------------------------------------------------- for making nested lists -def dnol(): - global body, ollev - ollev = ollev + 1 - if body[-1] == '': del body[-1] - body.append('
    ') - -def upol(): - global body, ollev - ollev = ollev - 1 - body.append(ollev and '
' or '') - -# --------------------------------- output one element and convert its contents -def spew(clearol=0, clearul=0): - global content, body, ollev, ullev - - if content: - if entityprog.search(content) > -1: - content = regsub.gsub('&', '&', content) - content = regsub.gsub('<', '<', content) - content = regsub.gsub('>', '>', content) - - n = questionprog.match(content) - if n > 0: - content = '' + content[n:] + '' - if ollev: # question reference in index - fragid = regsub.gsub('^ +|\.? +$', '', secnum) - content = '%s' % (fragid, content) - - if element[0] == 'h': # heading in the main text - fragid = regsub.gsub('^ +|\.? +$', '', secnum) - content = secnum + '%s' % (fragid, content) - - n = answerprog.match(content) - if n > 0: # answer paragraph - content = regsub.sub(sentprog, '\\1', content[n:]) - - body.append('<' + element + '>' + content) - body.append('') - content = '' - - while clearol and ollev: upol() - if clearul and ullev: body.append(''); ullev = 0 - -# ---------------------------------------------------------------- main program -faq = len(sys.argv)>1 and sys.argv[1] and open(sys.argv[1]) or sys.stdin -lines = faq.readlines() - -for line in lines: - if line[2:9] == '=======': #
will appear *before* - body.append('
') # the underlined heading - continue - - n = orditemprog.match(line) - if n > 0: # make ordered list item - spew(0, 'clear ul') - secnum = line[:n] - level = string.count(secnum, '.') - while level > ollev: dnol() - while level < ollev: upol() - element, content = 'li', line[n:] - continue - - n = itemprog.match(line) - if n > 0: # make unordered list item - spew('clear ol', 0) - if ullev == 0: body.append('
    '); ullev = 1 - element, content = 'li', line[n:] - continue - - n = headingprog.match(line) - if n > 0: # make heading element - spew('clear ol', 'clear ul') - secnum = line[:n] - sys.stderr.write(line) - element, content = 'h%d' % string.count(secnum, '.'), line[n:] - continue - - n = 0 - if not secnum: # haven't hit body yet - n = mailhdrprog.match(line) - v = version and -1 or regex.match('Version: ', line) - if v > 0 and not version: version = line[v:] - if n <= 0 and element != 'li': # not pre if after a list item - n = prefmtprog.match(line) - if n > 0: # make preformatted element - if element == 'pre': - content = content + line - else: - spew('clear ol', 'clear ul') - element, content = 'pre', line - continue - - if blankprog.match(line) > 0: # force a new element - spew() - element = '' - elif element: # continue current element - content = content + line - else: # no element; make paragraph - spew('clear ol', 'clear ul') - element, content = 'p', line - -spew() # output last element - -body = string.joinfields(body, '') -body = regsub.gsub(urlprog, '\\1', body) -body = regsub.gsub(addrprog, '\\1', body) -body = regsub.gsub(qrefprog, 'question \\1', body) -body = regsub.gsub(srefprog, 'section \\1', body) - -print '' -print 'Python Frequently-Asked Questions v' + version -print "(This file was generated using Ping's" -print 'faq2html.py.)' -print body + '' diff --git a/Misc/fixfuncptrs.sh b/Misc/fixfuncptrs.sh deleted file mode 100755 index f05809efc84..00000000000 --- a/Misc/fixfuncptrs.sh +++ /dev/null @@ -1,47 +0,0 @@ -prog=' -s|^\([ ]*\)\([a-z_]*,\)[ ]*\(/\*tp_dealloc\*/\)$|\1(destructor)\2 \3| -s|^\([ ]*\)\([a-z_]*,\)[ ]*\(/\*tp_print\*/\)$|\1(printfunc)\2 \3| -s|^\([ ]*\)\([a-z_]*,\)[ ]*\(/\*tp_getattr\*/\)$|\1(getattrfunc)\2 \3| -s|^\([ ]*\)\([a-z_]*,\)[ ]*\(/\*tp_setattr\*/\)$|\1(setattrfunc)\2 \3| -s|^\([ ]*\)\([a-z_]*,\)[ ]*\(/\*tp_compare\*/\)$|\1(cmpfunc)\2 \3| -s|^\([ ]*\)\([a-z_]*,\)[ ]*\(/\*tp_repr\*/\)$|\1(reprfunc)\2 \3| -s|^\([ ]*\)\([a-z_]*,\)[ ]*\(/\*tp_hash\*/\)$|\1(hashfunc)\2 \3| - -s|^\([ ]*\)\([a-z_]*,\)[ ]*\(/\*sq_length\*/\)$|\1(inquiry)\2 \3| -s|^\([ ]*\)\([a-z_]*,\)[ ]*\(/\*sq_concat\*/\)$|\1(binaryfunc)\2 \3| -s|^\([ ]*\)\([a-z_]*,\)[ ]*\(/\*sq_repeat\*/\)$|\1(intargfunc)\2 \3| -s|^\([ ]*\)\([a-z_]*,\)[ ]*\(/\*sq_item\*/\)$|\1(intargfunc)\2 \3| -s|^\([ ]*\)\([a-z_]*,\)[ ]*\(/\*sq_slice\*/\)$|\1(intintargfunc)\2 \3| -s|^\([ ]*\)\([a-z_]*,\)[ ]*\(/\*sq_ass_item\*/\)$|\1(intobjargproc)\2 \3| -s|^\([ ]*\)\([a-z_]*,\)[ ]*\(/\*sq_ass_slice\*/\)$|\1(intintobjargproc)\2 \3| - -s|^\([ ]*\)\([a-z_]*,\)[ ]*\(/\*mp_length\*/\)$|\1(inquiry)\2 \3| -s|^\([ ]*\)\([a-z_]*,\)[ ]*\(/\*mp_subscript\*/\)$|\1(binaryfunc)\2 \3| -s|^\([ ]*\)\([a-z_]*,\)[ ]*\(/\*mp_ass_subscript\*/\)$|\1(objobjargproc)\2 \3| - -s|^\([ ]*\)\([a-z_]*,\)[ ]*\(/\*nb_nonzero*\*/\)$|\1(inquiry)\2 \3| -s|^\([ ]*\)\([a-z_]*,\)[ ]*\(/\*nb_coerce*\*/\)$|\1(coercion)\2 \3| -s|^\([ ]*\)\([a-z_]*,\)[ ]*\(/\*nb_negative*\*/\)$|\1(unaryfunc)\2 \3| -s|^\([ ]*\)\([a-z_]*,\)[ ]*\(/\*nb_positive*\*/\)$|\1(unaryfunc)\2 \3| -s|^\([ ]*\)\([a-z_]*,\)[ ]*\(/\*nb_absolute*\*/\)$|\1(unaryfunc)\2 \3| -s|^\([ ]*\)\([a-z_]*,\)[ ]*\(/\*nb_invert*\*/\)$|\1(unaryfunc)\2 \3| -s|^\([ ]*\)\([a-z_]*,\)[ ]*\(/\*nb_int*\*/\)$|\1(unaryfunc)\2 \3| -s|^\([ ]*\)\([a-z_]*,\)[ ]*\(/\*nb_long*\*/\)$|\1(unaryfunc)\2 \3| -s|^\([ ]*\)\([a-z_]*,\)[ ]*\(/\*nb_float*\*/\)$|\1(unaryfunc)\2 \3| -s|^\([ ]*\)\([a-z_]*,\)[ ]*\(/\*nb_oct*\*/\)$|\1(unaryfunc)\2 \3| -s|^\([ ]*\)\([a-z_]*,\)[ ]*\(/\*nb_hex*\*/\)$|\1(unaryfunc)\2 \3| -s|^\([ ]*\)\([a-z_]*,\)[ ]*\(/\*nb_[a-z]*\*/\)$|\1(binaryfunc)\2 \3| - -' -for file -do - sed -e "$prog" $file >$file.new || break - if cmp -s $file $file.new - then - echo $file unchanged; rm $file.new - else - echo $file UPDATED - mv $file $file~ - mv $file.new $file - fi -done diff --git a/Misc/renumber.py b/Misc/renumber.py deleted file mode 100755 index cc2d075f264..00000000000 --- a/Misc/renumber.py +++ /dev/null @@ -1,110 +0,0 @@ -#! /usr/bin/env python - -# Renumber the Python FAQ - -import string -import regex -import sys -import os - -FAQ = 'FAQ' - -chapterprog = regex.compile('^\([1-9][0-9]*\)\. ') -questionprog = regex.compile('^\([1-9][0-9]*\)\.\([1-9][0-9]*\)\. ') -newquestionprog = regex.compile('^Q\. ') -blankprog = regex.compile('^[ \t]*$') -indentedorblankprog = regex.compile('^\([ \t]+\|[ \t]*$\)') - -def main(): - print 'Reading lines...' - lines = open(FAQ, 'r').readlines() - print 'Renumbering in memory...' - oldlines = lines[:] - after_blank = 1 - chapter = 0 - question = 0 - chapters = ['\n'] - questions = [] - for i in range(len(lines)): - line = lines[i] - if after_blank: - n = chapterprog.match(line) - if n >= 0: - chapter = chapter + 1 - question = 0 - line = `chapter` + '. ' + line[n:] - lines[i] = line - chapters.append(' ' + line) - questions.append('\n') - questions.append(' ' + line) - afterblank = 0 - continue - n = questionprog.match(line) - if n < 0: n = newquestionprog.match(line) - 3 - if n >= 0: - question = question + 1 - number = '%d.%d. '%(chapter, question) - line = number + line[n:] - lines[i] = line - questions.append(' ' + line) - # Add up to 4 continuations of the question - n = len(number) - for j in range(i+1, i+5): - if blankprog.match(lines[j]) >= 0: - break - questions.append(' '*(n+2) + lines[j]) - afterblank = 0 - continue - afterblank = (blankprog.match(line) >= 0) - print 'Inserting list of chapters...' - chapters.append('\n') - for i in range(len(lines)): - line = lines[i] - if regex.match( - '^This FAQ is divided in the following chapters', - line) >= 0: - i = i+1 - while 1: - line = lines[i] - if indentedorblankprog.match(line) < 0: - break - del lines[i] - lines[i:i] = chapters - break - else: - print '*** Can\'t find header for list of chapters' - print '*** Chapters found:' - for line in chapters: print line, - print 'Inserting list of questions...' - questions.append('\n') - for i in range(len(lines)): - line = lines[i] - if regex.match('^Here.s an overview of the questions', - line) >= 0: - i = i+1 - while 1: - line = lines[i] - if indentedorblankprog.match(line) < 0: - break - del lines[i] - lines[i:i] = questions - break - else: - print '*** Can\'t find header for list of questions' - print '*** Questions found:' - for line in questions: print line, - if lines == oldlines: - print 'No changes.' - return - print 'Writing new file...' - f = open(FAQ + '.new', 'w') - for line in lines: - f.write(line) - f.close() - print 'Making backup...' - os.rename(FAQ, FAQ + '~') - print 'Moving new file...' - os.rename(FAQ + '.new', FAQ) - print 'Done.' - -main()