44

Python Programming Language

Embed Size (px)

DESCRIPTION

 

Citation preview

  • 1. PYTHON PROGRAMMING LANGUAGEE

2. INDEX ____________________________________________________________________________________________________________________________________________________________________________ Introduction History Explanation:- =>Program Comparison:- =>Advantage =>Disadvantages Python used Conclusion 3. INTRODUCTION 4. Python is a general-purpose, interpreted high-level programming language whose design philosophy emphasizes code readability. Its syntax are said to be clearand expressive. Python has a large and comprehensive standard library. Python supports multiple programming paradigms, including object-oriented, imperative and functional programming styles. It features a fully dynamic type system and automatic memory management, similar to that of Scheme, Ruby, Perl, andTcl. 5. Like other dynamic languages, Python is often used as a scripting language, but is also used in a wide range of non- scripting contexts. Python interpreters are available for many operating systems. Python is one of a handful of modern programming languages gaining a lot of traction In the development community Like Java, once written, programs can be run on any operating system. 6. History 7. The history of Python starts with ABC. This doesn't mean the "American BroadcastingCompany" nor the NewWave band ABC, but the programming languageABC. ABC is a general-purpose programming language and programming environment, which had been developed in the Netherlands,Amsterdam, at the CWI (CentrumWiskunde & Informatica). The greatest achievement of ABC was to influence the design of Python. Python was conceptualized in the late 1980s.Guido van Rossum worked that time in a project at the CWI, called Amoeba, a distributed operating system. 8. He programmed in ABC. In an interview with BillVenners (January 2003), Guido van Rossum said: "I remembered all my experience and some of my frustration with ABC. I decided to try to design a simple scripting language that possessed some of ABC's better properties, but without its problems. So I started typing. I created a simple virtual machine, a simple parser, and a simple runtime. I made my own version of the various ABC parts that I liked. I created a basic syntax, used indentation for statement grouping instead of curly braces or begin-end blocks, and developed a small number of powerful data types: a hash table ( or dictionary, as we call it), a list, strings, and numbers. " 9. So, what about the name "Python": Most people think about snakes, but the name has something to do with excellent Britisch humour. Guido van Rossum, the creator of Python, wrote in 1996 about the origin of the name of his programming language: "Over six years ago, in December 1989, I was looking for a 'hobby' programming project that would keep me occupied during the week around Christmas. My office ... would be closed, but I had a home computer, and not much else on my hands. I decided to write an interpreter for the new scripting language I had been thinking about lately: a descendant of ABC that would appeal to Unix/C hackers. I chose Python as a working title for the project, being in a slightly irreverent mood (and a big fan of Monty Python's Flying Circus)." 10. Guido van Rossum the Inventor of PYTHON 11. . 12. Explanation 13. Python is a dynamic, interpreted language. Source code does not declare the types of variables or parameters or methods.This makes the code short and flexible, and you lose the compile-time type checking in the source code. Python tracks the types of all values at runtime and flags code that does not make sense as it runs. An excellent way to see how Python code works is to run the Python interpreter and type code right into it. If you ever have a question like "what happens if I add an int to a list?" ... just typing it into the Python interpreter is fast way to see what happens. 14. Python code does not declare the types of variables -- just assign to them and go. Python raises a runtime error if the code tries to read from a variable that has not been given a value. Like C++ and Java, Python is case sensitive so "a" and "A" are different variables. The end of a line marks the end of a statement, so unlike C++ and Java, Python does not require a semicolon at the end of each statement. You can include semicolons at the end of Python statements (perhaps just out of habit), but it's not the best style. Comments begin with a '#' and extend to the end of the line. 15. PYTHON INTERPRETER 16. Programs:- Calculations. Comments. Variables. String. Statements. Loop:- The while loop. Condition. If. If else. If elif. 17. Compari son 18. 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 comparison 19. 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. 20. 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. 21. 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 usingTcl usually containsTcl 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. 22. It has been said thatTcl's one redeeming quality is theTk toolkit. Python has adopted an interface toTk as its standard GUI component library. Tcl 8.0 addresses the speed issuse by providing a bytecode compiler with limited data type support, and adds namespaces. However, it is still a much more cumbersome programming language. 23. 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. 24. 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. 25. 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. 26. 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. 27. C++ Almost everything said for Java also applies forC++, 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++. 28. Python:- Python is newer. It is loosly typed language. It's runtime is slow. It's code are faster to write. It is really fun to write with its easier, and its rich features. As python is gaining levels really fast. C:- C is old. It is pretty strictly typed language. It's runtime is extremely fast. It's code are slow to write. C is "richer" and becaust its "older", its used in more apps, and in the open source community its more helpful. Since, kernel and many basic commands are made in c. 29. Advantages The language doesn't provide a rich syntax, which is really helpful. The idea behind that is to keep you thinking about the business rules of your application and not to spend time trying to figure out what command you should use. It is also true that Python is interactive, portable, easy to learn, easy to use, and a serious language. 30. Furthermore, it provides dynamic semantics and rapid prototyping capabilities. Python is largely known as a glue language that connects existing components. It is embeddable in applications from other languages (C/C++, Java, and so on), and it is also possible to add new modules to Python, extending its core vocabulary. The next couple of paragraphs list and explain why Python is a cool programming language and what things make Python more flexible than other languages. 31. Readability Python's syntax is clear and readable. The way Python's syntax is organized imposes some order to programmers. Experts and beginners can easily understand the code and everyone can become productive in Python very quickly. 32. It Is Simple to Get Support The Python community always provides support to Python users. As we already know, Python code is freely available for everyone. Therefore, thousands of developers worldwide are working hard to find bugs and create patches to fix those bugs. 33. Fast to Learn The language is very easy to learn because its source code resembles pseudo code. It doesn't ask for long and strange lines of code. Therefore, less training is a direct result. Companies don't need to spend much time to have their programmers coding in Python. Once you start learning Python, you can do useful coding almost immediately. And after some practice, your productivity will suddenly increase. You can design a high-level, object-oriented programming code in a friendly and interpreted Python environment. This feature works great for small tasks. 34. Fast to Code Python provides fast feedback in several ways. First, the programmer can skip many tasks that other languages require him to take. Therefore, it reduces both the cost of program maintenance and the development time. 35. Reusability Python encourages program reusability by implementing modules and packages. A large set of modules has already been developed and is provided asThe Standard Python Library, which is part of the Python distribution. You can easily share functionality between your programs by breaking the programs into modules, and reusing the modules as components of other programs. 36. Disadvantages Python isn't the best for memory intensive tasks. Python is interpreted language & is slow compared to C/C++ or java. Python not a great choice for a high-graphic 3d game that takes up a lot of CPU. Python is evolving continuously, with constant evolution there is little substantial documentation available for the language 37. Conclusion 38. Python is an easy to learn and powerful programming language as it is known in common parlance, there is nevertheless need of a good introduction and tutorial on the Python language. 39. PresentatedbyF.Y.BSc. ComputerScienceStudents Laksh Nikita Shamiksha Shamima Swapnil One for group, And Group for all. -:Be together