On 02/20/2012 11:43 AM, Sunil Tech wrote:
*I am Beginner (very little i know), i want to know what are new things i
can find in Python.*



There are thousands of computer languages out there. Nearly every feature has an analog out there somewhere. So "what's new" really depends on what language you're comparing it with.

You said you're a beginner. Is that a beginner at Python, a beginner at programming, a beginner with computers, what?

If I assume you're knowledgeable in C++, I'd point to this set of features:

1) No braces. You build program structure simply by proper indentation.

2) No declarations. A "variable" can contain an integer at one moment, and a dictionary of name/value pairs a moment later. The objects have the type, not the name.

3) Built in types for the most useful collections, tuple, list, dictionary, and set. And a large set of operations that can readily be done on them.

4) Duck typing. You can pass anything you like to a function, and the things you pass may not be subclasses of the expected types, but if the right operations (methods) are supported, it'll work. So you can define a "file like" object to a function that's expecting a file, and it doesn't have to be derived from file, it just has to have the right methods, and the equivalent semantics.

5) The kitchen sink. The standard library has an enormous collection of useful stuff, most of it written in python. Most of the time, you don't need to look to third party libraries to accomplish your goal.

6) Easy debugging. There are a number of IDE's available, but it's not hard to debug code without one. And you can run code fragments from a standard interpreter, and examine data and define new functions on the fly. The system also supports introspection, so even the simplest error message tells you a lot about what was happening. And when you need to, you can examine any object in the system, stack frames, types of objects, and so on.

7) Easy testing. You can define some sanity tests in your own source code, in a special string called a docstring. That string can thus have two uses: documentation for the reader of the code, and first line of tests to make sure the code meets those tests.

--

DaveA

_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to