Guido Van Rossum: A Dutch programmer, popularly known as the author of Python programming language. He has created Python in 1989 and has worked for Google and Dropbox!
why is it named Python?
While implementing Python, Van Rossum was also reading the published scripts from “Monty Python’s Flying Circus”, a BBC comedy series from the 1970s. Since he wanted a short, unique and slightly mysterious name for his invention, he got inspired by the series and named it Python!
Python
is not that complex! It is a high-level dynamic programming language
and is quite easy to learn. Python code has a very ‘natural’ style to
it, which makes it easy to read and understand.
The simplicity of Python is what makes it so popular!- Free and open source
- Highly readable
- memory management
- clean visual layout
- support oops
- High performance
What are the key features of Python?
- Python is an interpreted language. That means that, unlike languages like C and its variants, Python does not need to be compiled before it is run. Other interpreted languages include PHP and Ruby.
- Python is dynamically typed,
this means that you don’t need to state the types of variables when you
declare them or anything like that. You can do things like
x=111
and thenx="I'm a string"
without error - Python is well suited to object orientated programming
in that it allows the definition of classes along with composition and
inheritance. Python does not have access specifiers (like C++’s
public
,private
), the justification for this point is given as “we are all adults here” - In Python, functions are first-class objects. This means that they can be assigned to variables, returned from other functions and passed into functions. Classes are also first class objects
- Writing Python code is quick
but running it is often slower than compiled languages.
Fortunately,Python allows the inclusion of C based extensions so
bottlenecks can be optimized away and often are. The
numpy
package is a good example of this, it’s really quite quick because a lot of the number crunching it does isn’t actually done by Python - Python finds use in many spheres – web applications, automation, scientific modelling, big data applications and many more. It’s also often used as “glue” code to get other languages and components to play nice.
Ans:
- Memory management in python is managed by Python private heap space. All Python objects and data structures are located in a private heap. The programmer does not have access to this private heap. The python interpreter takes care of this instead.
- The allocation of heap space for Python objects is done by Python’s memory manager. The core API gives access to some tools for the programmer to code.
- Python also has an inbuilt garbage collector, which recycles all the unused memory and so that it can be made available to the heap space
Ans: Help()
and dir() both functions are accessible from the Python interpreter and
used for viewing a consolidated dump of built-in functions.
- Help() function: The help() function is used to display the documentation string and also facilitates you to see the help related to modules, keywords, attributes, etc.
- Dir() function: The dir() function is used to display the defined symbols.
What does this mean: *args
, **kwargs
? And why would we use it?
Ans: We use
*args
when we aren’t sure how many arguments are going to be passed to a
function, or if we want to pass a stored list or tuple of arguments to a
function. **kwargs
is used when we don’t know how many
keyword arguments will be passed to a function, or it can be used to
pass the values of a dictionary as keyword arguments. The identifiers args
and kwargs
are a convention, you could also use *bob
and **billy
but that would not be wise.
No comments:
Post a Comment