Bookmark Topic Watch Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
Python is a dynamic object-oriented programming language that can be used for many kinds of software development. It offers strong support for integration with other languages and tools, comes with extensive standard libraries, and can be learned in a few days. Many Python programmers report substantial productivity gains and feel the language encourages the development of higher quality, more maintainable code. (shamelessly stolen from the Python home page)

One interesting feature of Python is that it has an interactive console. If python is installed, just type "python" in a shell and start programming:



What strikes most people just starting with Python is that whitespace means something. Rather than using brackets to enclose groups of code, groups of code at the same indent level are grouped. For example, let's declare a function:



To end the function declaration on the interactive console I just hit "enter" on a blank line. Note there's nothing to enclose the work being done in double() except the indent level.

Python has object-oriented features. Without going into too much detail, let's declare a class and access some members:



Compared to Java, there's a lot of syntax missing. For example, Python does not require that one declares member variables before he uses them. Also, Python also doesn't have the variety of access modifiers that there are in Java.

Language Features

Python doesn't skimp on features:

  • A variety of basic data types are available: numbers (floating point, complex, and unlimited-length long integers), strings (both ASCII and Unicode), lists, and dictionaries.
  • Python supports object-oriented programming with classes and multiple inheritance.
  • Code can be grouped into modules and packages.
  • The language supports raising and catching exceptions, resulting in cleaner error handling.
  • Data types are strongly and dynamically typed. Mixing incompatible types (e.g. attempting to add a string and a number) causes an exception to be raised, so errors are caught sooner.
  • Python contains advanced programming features such as generators and list comprehensions.
  • Python's automatic memory management frees you from having to manually allocate and free memory in your code.
  • Can integrate easily with Java through Jython
  • Python web applications can be built with Zope


  • Python Documentation

    There are plenty of good sources of information on Python. I've found the following to be the most helpful:

  • The Python Documentation Index on the Python site
  • Think Python is both a good introduction to programming as well as a good introduction to the Python language.
  • Dive Into Python is a book aimed at experienced professional programmers who want to hit the ground running with a new language.
  • Python questions can be asked in the Jython / Python forum here at JavaRanch.




  • CategoryLearnSomethingNew
     
      Bookmark Topic Watch Topic
    • New Topic