Difference between revisions of "Python"

From RogueBasin
Jump to navigation Jump to search
(Adding Pygame to list of external links.)
(Giving the Python article a bit of 'flavour'.)
Line 1: Line 1:
== What is Python ==
== What is Python? ==


Python is an interpreted, interactive, object-oriented programming language. It incorporates modules, exceptions, dynamic typing, very high level dynamic data types, and classes. Python combines remarkable power with very clear syntax. It has interfaces to many system calls and libraries, as well as to various window systems, and is extensible in C or C++. It is also usable as an extension language for applications that need a programmable interface. Finally, Python is portable: it runs on many Unix variants, on the Mac, and on PCs under MS-DOS, Windows, Windows NT, and OS/2.
From the official [http://www.python.org/doc/faq/general/#what-is-python Python FAQ]:


''Taken from the official Python FAQ.''
"Python is an interpreted, interactive, object-oriented programming language. It incorporates modules, exceptions, dynamic typing, very high level dynamic data types, and classes. Python combines remarkable power with very clear syntax. It has interfaces to many system calls and libraries, as well as to various window systems, and is extensible in C or C++. It is also usable as an extension language for applications that need a programmable interface. Finally, Python is portable: it runs on many Unix variants, on the Mac, and on PCs under MS-DOS, Windows, Windows NT, and OS/2."


A full set of features can be found [http://www.python.org/about/ here.]


== Roguelike specific details ==
== Roguelike Specific Details ==


Python's expressive code, dynamic typing, flexible data types, and powerful OO and exception handling facilities make it well-suited to quick, productive RL development. Python is not the best choice if a small memory footprint or raw performance are important. Psyco allows you to get more performance at the cost of more memory, and is highly recommended.
Python's expressive code, dynamic typing, flexible data types, and powerful OO and exception handling facilities make it well-suited to quick, productive RL development. However, like all interpreted languages, Python has a reputation for large memory overheads and being slower in some applications when compared to compiled languages such as C++. These problems, however, can be overcome with the extension of third-party Python modules such as Psyco, and proper profiling and programming techniques.
 
Python's rapid speed of development and human-readable code makes it an excellent choice for programmers wanting to develop a roguelike in a limited amount of time, making the language ideal for 7DRL Challenges.
 
== Python-Specific Articles on RogueBasin ==


* [[Python_shadowcasting_implementation]] - Python code for field-of-view calculation using Bjorn Bergstrom's excellent [[FOV_using_recursive_shadowcasting|recursive shadowcasting algorithm]].
* [[Python_shadowcasting_implementation]] - Python code for field-of-view calculation using Bjorn Bergstrom's excellent [[FOV_using_recursive_shadowcasting|recursive shadowcasting algorithm]].
* [[Permissive_Field_of_View_in_Python]] - An implementation of the [[Precise_Permissive_Field_of_View|precise Permissive Field of View]] algorithm in Python.
* [[Permissive_Field_of_View_in_Python]] - An implementation of the [[Precise_Permissive_Field_of_View|precise Permissive Field of View]] algorithm in Python.
* [[Dungeon_builder_written_in_Python]] - A dungeon builder.
* [[Dungeon_builder_written_in_Python]] - A dungeon builder.


== Related links ==
== Related links ==


* [http://python.org Official Python website]
* [http://python.org Official Python website]
* [http://www.python.org/doc/faq/ Official Python FAQs]
* [http://adamv.com/dev/python/curses/ WCurses], a Python module implementing a substantial subset of the [[Curses]] interface under Windows.  Python includes Curses support by default for other OS's.
* [http://adamv.com/dev/python/curses/ WCurses], a Python module implementing a substantial subset of the [[Curses]] interface under Windows.  Python includes Curses support by default for other OS's.
* [http://psyco.sourceforge.net/ Psyco], the specializing compiler for Python.  Improves performance 2 to 100 times (usually about 4 times), and requires little more from the programmer than to import the module.
* [http://psyco.sourceforge.net/ Psyco], the specializing compiler for Python.  Improves performance 2 to 100 times (usually about 4 times), and requires little more from the programmer than to import the module.

Revision as of 10:54, 27 March 2008

What is Python?

From the official Python FAQ:

"Python is an interpreted, interactive, object-oriented programming language. It incorporates modules, exceptions, dynamic typing, very high level dynamic data types, and classes. Python combines remarkable power with very clear syntax. It has interfaces to many system calls and libraries, as well as to various window systems, and is extensible in C or C++. It is also usable as an extension language for applications that need a programmable interface. Finally, Python is portable: it runs on many Unix variants, on the Mac, and on PCs under MS-DOS, Windows, Windows NT, and OS/2."

A full set of features can be found here.

Roguelike Specific Details

Python's expressive code, dynamic typing, flexible data types, and powerful OO and exception handling facilities make it well-suited to quick, productive RL development. However, like all interpreted languages, Python has a reputation for large memory overheads and being slower in some applications when compared to compiled languages such as C++. These problems, however, can be overcome with the extension of third-party Python modules such as Psyco, and proper profiling and programming techniques.

Python's rapid speed of development and human-readable code makes it an excellent choice for programmers wanting to develop a roguelike in a limited amount of time, making the language ideal for 7DRL Challenges.

Python-Specific Articles on RogueBasin

Related links

  • Official Python website
  • Official Python FAQs
  • WCurses, a Python module implementing a substantial subset of the Curses interface under Windows. Python includes Curses support by default for other OS's.
  • Psyco, the specializing compiler for Python. Improves performance 2 to 100 times (usually about 4 times), and requires little more from the programmer than to import the module.
  • py2exe is a package which converts Python scripts into executable Windows programs, able to run without requiring a Python installation. Since most Windows users will not have Python installed, py2exe is a good way to distribute your Python game to that audience.
  • Pygame, SDL wrapper for Python that has been used for many graphical and non-graphical Roguelikes.