Python is an ObjectOriented language that does all the things that you can do with Perl or TCL - only better, since it was designed from the ground up as an OO language. Lots of Python documentation is available at http://www.python.org and the Python Wiki http://www.python.org/cgi-bin/moinmoin as well as source code and binaries for UNIX, Macintosh, Win95/NT, DOS, etc. ---- '''See also''': * PythonPhilosophy * PythonSample''''''s * PythonIdioms * PythonDiscussion * PythonProblems - ''negative comments go here'' * BoaConstructor - RAD (gui builder) ide and Zope front end * PythonIde - They are springing out all over * PythonPeople * PythonOptimization * PythonSprint * BlocksInPython * RefactoringWithPython * ReStructuredText (DocUtils) * PyLit (LiterateProgramming tool) * IwannaLearnPython * JavaScriptObjectNotation(JSON) (data interchange format) * PyChecker * PythonWhiteSpaceDiscussion * PythonThreeThousand * VisualPython * WhatAreTheDifferencesBetweenPythonTwoAndPythonThree ----- '''Python Web Frameworks''' * DjangoProject * Web2Py * PylonsFramework * ZopeApplicationServer (Zope) - Application server in python ----- '''Python Books''' * CorePythonProgramming * LearningPython * ProgrammingPython * PythonCookbook * PythonInaNutshell ---- '''Interfaces for Python extensions in CeeLanguage or CeePlusPlus''' * BoostPythonLibrary * SimplifiedWrapperAndInterfaceGenerator (SWIG) * PythonCxxModule ---- '''Interfaces for Python extensions in R (ArrLanguage)''' * ArrPy (Rpy) ----- '''Wikis about Python''': * The official Python Info wiki at http://wiki.python.org/moin/. * The SeattlePythonInterestGroup wiki. * A GermanLanguage wiki about Python: http://mobbing-gegner.de/mywiki/Python/Links ---- '''Wikis written in Python''': * JotEngine * PyWiki, PikiPiki * MoinMoin * IckyWiki * ZwiKi * WikiNehesa * WindowsWiki ---- '''PEAK - P''''''ythonEnterpriseApplicationKit''' I heard that it is an exciting development that is evolving, with proponents claiming superiority to J2EE. What can it do already, at Jun05? Any good introductory reading on why people should keep an eye on it? -- dl ----- '''Games that use Python''': * FreedomForce * Blade of Darkness (several megabytes of Python scripts) * EveOnline (uses StacklessPython) * The Backyard Sports series, from Humongous * TempleOfElementalEvil * Uru: Ages Beyond Myst * CivilizationIv * EndgameSingularity ----- '''Other applications that use Python''': * CubicWeb (SemanticWeb tool) * EnvisagePluginFramework | EnthoughtToolSuite (ETS) * GNU Mailman (mailing list software) * GentooPortage * Pediatek (http://pediatek.com) ----- '''TestingFrameworks''': * Unittest.py, an xUnit for python, is part of the standard library. (PythonUnit) * DocTest: testing-from-the-doc-string written by TimPeters * py.test: Pythonic TestingFramework (http://codespeak.net/py/current/doc/test.html) ----- '''Python Patterns''' * PythonSingleton ---- '''Python Implementations''': * CPython: the canonical, reference implementation * JavaPython: Jython (formerly JPython), implemented in JavaLanguage. Emits JavaByteCode and integrates seamlessly with Java code * StacklessPython: supports continuation, coroutines, and microthread * PalmPython: python on PalmOS devices * PyPy: a self-hosting implementation of Python * IronPython: Python implemented on top of the CommonLanguageRuntime, for seamless integration with the rest of DotNet ----- '''RefactoringBrowser''': * BicycleRepairMan: Python RefactoringBrowser (apparently stalled; no activity since 2004) ----- '''Python advocates''': * ComputerProgrammingForEverybody(CanEndUsersScript) : problems that Python tries to address. ----- '''Useful Python Libraries''': * Pywin32 from http://sourceforge.net/projects/pywin32/ (for persons with MicrosoftWindowsCulturalAssumption) ----- '''Python comparisons''': * Python and JavaLanguage side by side at: http://www.ferg.org/projects/python_java_side-by-side.html * PythonVsRuby * PythonVsPerl * RosettaCode ---- '''Python's key features:''' * Python is an excellent language for learning object orientation. * Python's BigIdea is that almost everything is a writable dictionary: dictionaries, classes, objects, stack frames, modules, etc. It's a very elegant and flexible idea. * And that you can make a reference to almost anything and pass that around. You have first-class modules, objects, methods, functions, etc. * NameSpace''''''s too. Never forget about namespaces in Python. * Oddly enough, I thought Python's BigIdea was that everything is a sequence * '''Python has a BigIdea for everyone as the above 3 points would seem to indicate''' ''"Our chief weapon is surprise! Surprise and fear...fear and surprise... Our two weapons are..."'' -- MontyPython * And a fanatical devotion to the BDFL... * Perhaps it's more than there are no '''BigIdea'''s in Python, it's just a collection of well-thought-out features. * Who was it that said "Python gets all of its compromises exactly right."? * I think Python supports [MultiParadigmProgramming] well -- MartinPool * Its other great strength is its scalability; -- SteveFreeman * It also does excellent support for all things Microsoft, and it's a nice way to lead VB folk out of the wilderness. -- PeterMerel * Completely open source. * Large set of standard/nonstandard libraries. * Enjoys almost-Smalltalk-like plasticity, with typeless variables, late-late binding and reflection. * Normally doesn't look like line noise run through an obfuscation filter [Though ObfuscatedPython and WyPy show how even Python can be made to look horrid] * GeneratorsInPython, which support simple form of continuation. You'll be really amazed at how it can make complex stuff simple and elegant. -- JuneKim * ListComprehension''''''s from HaskellLanguage - see a quicksort implementation in PythonSample. * DuckTyping: you don't need a massive, static inheritance diagram. If an object implements the methods that, say, a file does, you can pass it to anything that expects a file, and it just works. (If you really want to live dangerously, you can even add the methods after instantiation, pass it like a file, and pull them back off the object when you're done. DontTryThisAtHome.) * Insight: code will be read more often than being written: optimize for readability * Last but not Least: It has a cool name :-P (''It's named after '''Monty''' Python, not the snake -- WayneWerner'') ---- PeterNorvig on PythonForLispProgrammers: ''Basically, Python can be seen as a dialect of Lisp with "traditional syntax."'' Incorrect. No conditionals in lambda. ''And you can't use returns either. Or use lambdas as generators.'' '''Actually conditional expressions have been added to Python 2.5, they look like this:''' test_temp = lambda t: "Above freezing" if t > 32 else ("Below freezing" if t < 32 else "At freezing") '''Using lambdas with generators can be done by using functions from itertools (e.g. imap, izip)''' ''Ah, but y = lambda x: foo is just syntactic sugar for'' def y(x): return foo ''This is because the definition of a nested function will be re-evaluated (or at least appear to be) whenever its outer function is called. So Python does have "proper" higher-order functions, but without a nice syntax for anything more complicated than returning an expression.'' ---- Python has built-in ComplexNumbers. ComplexNumbersAreYourFriend. Python is the best language I've tried for day-to-day quick programming. I've used it to manipulate text files, pipe formatting algorithms through a text editor, write music scripts, etc. I have to say I'm a believer in easy-to-use syntax that doesn't make you work hard and jump through hoops (LispLanguage, PerlLanguage, ForthLanguage, SmalltalkLanguage - Perl's the worst offender). It has a very pragmatic feel. Lisp, SchemeLanguage, etc. can can claim to be beautiful; Python is beautiful, easy-to-use, and powerful and practical for real-world apps. It even has support for a limited functional style for the pure academic type programmers out there. And recursion and iteration are equally supported, although performance is better for iteration, I think. -- AaronKristerJohnson ---- (Moved from ObjectsAreDictionaries) PythonLanguage implements objects as dictionaries, and "new-style" classes as objects. ''IMO Python failed to capitalize on the similarities early on, and now seems to have created two different structures for things that are only slightly different from each other rather than consolidate, unnecessarily complicating the language. In general Python designers went structure-happy with dictionaries, tuples, lists, etc. that are only slightly different from each other. Perhaps it was done for speed, but it certainly complicates the language syntax. A violation of the LawOfOrthogonality?'' Whilst I agree that Python is increasingly in danger of becoming unnecessarily complex, I think you're wrong about the structures. The variety of built-in structures with easy ways of expressing literals is one of the key strengths of Python. Python dictionaries and lists enable one to clearly express one's intention using literals. And the tuples exist to provide an immutable sequence for things like hashing. ''I suppose we would have to compare and contrast some examples.'' Python: myDict = {"a": 1, "b": 2, "c": 3} print myDict.get(someKey, someDefault) CeeSharp: var myDict = new Dictionary { { "a", 1 }, { "b", 2 }, { "c", 3 } }; int value = someDefault; myDict.Try''''''Get''''''Value(someKey, out value); Console.Write''''''Line(value); The paragraph below related to the old C#, I took the liberty of updating it to fairly idiomatic modern C#. It's worth noting that the initializer syntax used is general to all types, not specialized for dictionaries, and the new code is type safe where the old was not. Not an Object in sight. One of these encourages the use of dictionaries more than the other, especially for things like lookup tables vs. switch statements. Looking through many introductions to C#, I see switch statements for stuff that I'd just hash in Python. The other comparison would be between Python and a language with regular/minimal syntax, like LispLanguage or SchemeLanguage, I suppose. As far as having lots of similar built-in structures, dicts are different from lists, of course. That there are immutable tuples and mutable lists that are otherwise similar is perhaps a wart. You can hash on tuples but not lists; I suppose if Python were being designed right now, mutability of objects might be handled differently. Outside of dict, list, and tuple, what other built-in data structures are of note? -- AdamVandenberg Well, objects (the base type of new-style classes) are interesting, as are generators (although they're not as general-purpose as the "big three" you list). Naturally, most code uses modules, methods, and functions; they're first-class types in Python just like integers and tuples. It's a good idea to look over the methods of even the simplest types from time to time, because they have interesting properties that you might not know about otherwise. ---- I tore up some of my classes and made functions out of them. What's happening?? Seems I have learned enough of PythonLanguage and can write code where I don't have to hide complexity. If I can see a function in half a page, I don't have to make a class and then call .doSomething(), like in CeePlusPlus. ''I'm trying to make sense of this. Freestanding functions are not a feature specific to Python - there's no reason you can't write them in CeePlusPlus. In fact, Stroustrup rants against the "make everything a class" attitude of some coders.'' : I believe the point was that something that would take several pages in CeePlusPlus can be done in half a page in python. Several pages of code requires some further organization; half a page can be understood on its own terms. ''While free functions have always been perfectly acceptable in Python, until recently EverythingIsaClass was a very common paradigm in CeePlusPlus. Recently, it's come under fire by folks like HerbSutter, though, so it appears that CeePlusPlus is moving in this direction as well.'' Variable names are becoming shorter. Is it me or Python influence? ''I think it is the old C influence reasserting itself - those short, vowel-stripped variable names are something that people like to complain about in the common C libraries.'' ---- CategoryPython CategoryProgrammingLanguage