Grammar check

This commit is contained in:
Mia Steinkirch 2019-06-11 22:33:23 -07:00 committed by GitHub
parent 8e9cbfd87f
commit 286316a29f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -29,7 +29,7 @@ PEP 8 is a coding convention, a set of recommendation, about how to write your P
#### What is pickling and unpickling? #### What is pickling and unpickling?
Pickle module accepts any Python object and converts it into a string representation and dumps it into a file by using dump function, this process is called pickling. While the process of retrieving original Python objects from the stored string representation is called unpickling. Pickle module accepts any Python object and converts it into a string representation and dumps it into a file by using a dump function, this process is called pickling. While the process of retrieving original Python objects from the stored string representation is called unpickling.
#### How Python is interpreted? #### How Python is interpreted?
@ -39,9 +39,9 @@ Python language is an interpreted language. Python program runs directly from th
#### How memory is managed in Python? #### How memory is managed in Python?
Python memory is managed by Python private heap space. All Python objects and data structures are located in a private heap. The programmer does not have an access to this private heap and interpreter takes care of this Python private heap. Python memory 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 and interpreter takes care of this Python private heap.
The allocation of Python heap space for Python objects is done by Python memory manager. The core API gives access to some tools for the programmer to code. The allocation of Python heap space for Python objects is done by Python memory manager. The core API gives access to some tools for the programmer to code.
Python also have an inbuilt garbage collector, which recycle all the unused memory and frees the memory and makes it available to the heap space. Python also has an inbuilt garbage collector, which recycle all the unused memory and frees the memory and makes it available to the heap space.
#### What are the tools that help to find bugs or perform static analysis? #### What are the tools that help to find bugs or perform static analysis?
@ -60,13 +60,13 @@ The difference between list and tuple is that list is mutable while tuple is not
#### How are arguments passed by value or by reference? #### How are arguments passed by value or by reference?
Everything in Python is an object and all variables hold references to the objects. The references values are according to the functions; as a result you cannot change the value of the references. However, you can change the objects if it is mutable. Everything in Python is an object and all variables hold references to the objects. The references values are according to the functions; as a result, you cannot change the value of the references. However, you can change the objects if it is mutable.
#### What are the built-in type does python provides? #### What are the built-in type does python provides?
There are mutable and Immutable types of Pythons built in types Mutable built-in types There are mutable and Immutable types of Pythons built-in types Mutable built-in types
List List
Sets Sets
@ -79,22 +79,22 @@ Numbers
#### What is namespace in Python? #### What is namespace in Python?
In Python, every name introduced has a place where it lives and can be hooked for. This is known as namespace. It is like a box where a variable name is mapped to the object placed. Whenever the variable is searched out, this box will be searched, to get corresponding object. In Python, every name introduced has a place where it lives and can be hooked for. This is known as namespace. It is like a box where a variable name is mapped to the object placed. Whenever the variable is searched out, this box will be searched, to get the corresponding object.
#### What is lambda in Python? #### What is lambda in Python?
It is a single expression anonymous function often used as inline function. It is a single expression anonymous function often used as an inline function.
#### Why lambda forms in python does not have statements? #### Why lambda forms in python do not have statements?
A lambda form in python does not have statements as it is used to make new function object and then return them at runtime. A lambda form in python does not have statements as it is used to make new function object and then return them at runtime.
#### What is pass in Python? #### What is pass in Python?
Pass means, no-operation Python statement, or in other words it is a place holder in compound statement, where there should be a blank left and nothing has to be written there. Pass means, no-operation Python statement, or in other words, it is a place holder in a compound statement, where there should be a blank left and nothing has to be written there.
@ -105,12 +105,12 @@ In Python, iterators are used to iterate a group of elements, containers like li
#### What is unittest in Python? #### What is unittest in Python?
A unit testing framework in Python is known as unittest. It supports sharing of setups, automation testing, shutdown code for tests, aggregation of tests into collections etc. A unit testing framework in Python is known as unittest. It supports sharing of setups, automation testing, shutdown code for tests, aggregation of tests into collections, etc.
#### In Python what is slicing? #### In Python what is slicing?
A mechanism to select a range of items from sequence types like list, tuple, strings etc. is known as slicing. A mechanism to select a range of items from sequence types like list, tuple, strings, etc. is known as slicing.
#### What are generators in Python? #### What are generators in Python?
@ -129,9 +129,9 @@ To copy an object in Python, you can try copy.copy () or copy.deepcopy() for the
#### What is the difference between deep and shallow copy? #### What is the difference between deep and shallow copy?
Shallow copy is used when a new instance type gets created and it keeps the values that are copied in the new instance. Whereas, deep copy is used to store the values that are already copied. Shallow copy is used when a new instance type gets created and it keeps the values that are copied in the new instance. Whereas, a deep copy is used to store the values that are already copied.
#### What is negative index in Python? #### What is a negative index in Python?
Python sequences can be index in positive and negative numbers. For positive index, 0 is the first index, 1 is the second index and so forth. For negative index, (-1) is the last index and (-2) is the second last index and so forth. Python sequences can be index in positive and negative numbers. For positive index, 0 is the first index, 1 is the second index and so forth. For negative index, (-1) is the last index and (-2) is the second last index and so forth.
@ -148,7 +148,7 @@ Xrange returns the xrange object while range returns the list, and uses the same
#### What is module and package in Python? #### What is module and package in Python?
In Python, module is the way to structure program. Each Python program file is a module, which imports other modules like objects and attributes. In Python, a module is the way to structure program. Each Python program file is a module, which imports other modules like objects and attributes.
The folder of Python program is a package of modules. A package can have modules or subfolders. The folder of Python program is a package of modules. A package can have modules or subfolders.
@ -200,23 +200,23 @@ Module = =PyImport_ImportModule("<modulename>");
#### Mention the use of // operator in Python? #### Mention the use of // operator in Python?
It is a Floor Division operator , which is used for dividing two operands with the result as quotient showing only digits before the decimal point. For instance, `10//5 = 2 and 10.0//5.0 = 2.0`. It is a Floor Division operator, which is used for dividing two operands with the result as quotient showing only digits before the decimal point. For instance, `10//5 = 2 and 10.0//5.0 = 2.0`.
#### Explain what is Flask & its benefits? #### Explain what is Flask & its benefits?
Flask is a web micro framework for Python based on "Werkzeug, Jinja 2 and good intentions" BSD licensed. Werkzeug and jingja are two of its dependencies. Flask is a web microframework for Python based on "Werkzeug, Jinja 2 and good intentions" BSD licensed. Werkzeug and jingja are two of its dependencies.
Flask is part of the micro-framework. Which means it will have little to no dependencies on external libraries. It makes the framework light while there is little dependency to update and less security bugs. Flask is part of the micro-framework. Which means it will have little to no dependencies on external libraries. It makes the framework light while there is a little dependency to update and fewer security bugs.
#### What is the difference between Django, Pyramid, and Flask? #### What is the difference between Django, Pyramid, and Flask?
Flask is a "microframework" primarily build for a small application with simpler requirements. In flask, you have to use external libraries. Flask is ready to use. Flask is a "microframework" primarily build for a small application with simpler requirements. In Flask, you have to use external libraries. Flask is ready to use.
Pyramid are build for larger applications. It provides flexibility and lets the developer use the right tools for their project. The developer can choose the database, URL structure, templating style and more. Pyramid is heavy configurable. Pyramid is built for larger applications. It provides flexibility and lets the developer use the right tools for their project. The developer can choose the database, URL structure, templating style and more. Pyramid is heavy configurable.
Like Pyramid, Django can also used for larger applications. It includes an ORM. Like Pyramid, Django can also be used for larger applications. It includes an ORM.
#### Explain how you can access sessions in Flask? #### Explain how you can access sessions in Flask?
@ -226,7 +226,7 @@ A session basically allows you to remember information from one request to anoth
#### Is Flask an MVC model and if yes give an example showing MVC pattern for your application? #### Is Flask an MVC model and if yes give an example showing MVC pattern for your application?
Basically, Flask is a minimalistic framework which behaves same as MVC framework. So MVC is a perfect fit for Flask, and the pattern for MVC we will consider for the following example: Basically, Flask is a minimalistic framework which behaves the same as MVC framework. So MVC is a perfect fit for Flask, and the pattern for MVC we will consider for the following example:
```python ```python
from flask import Flask from flask import Flask
@ -244,24 +244,24 @@ app.run(debug = True)
#### Explain database connection in Python Flask? #### Explain database connection in Python Flask?
Flask supports database powered application (RDBS). Such system requires creating a schema, which requires piping the shema.sql file into a sqlite3 command. So you need to install sqlite3 command in order to create or initiate the database in Flask. Flask supports database powered application (RDBS). Such a system requires creating a schema, which requires piping the shema.sql file into a sqlite3 command. So you need to install sqlite3 command in order to create or initiate the database in Flask.
Flask allows to request database in three ways Flask allows requesting database in three ways
* before_request() : They are called before a request and pass no arguments. * before_request() : They are called before a request and pass no arguments.
* after_request() : They are called after a request and pass the response that will be sent to the client. * after_request() : They are called after a request and pass the response that will be sent to the client.
* teardown_request(): They are called in situation when exception is raised, and response are not guaranteed. They are called after the response been constructed. They are not allowed to modify the request, and their values are ignored. * teardown_request(): They are called in a situation when an exception is raised, and response is not guaranteed. They are called after the response been constructed. They are not allowed to modify the request, and their values are ignored.
#### You are having multiple Memcache servers running Python, in which one of the memcacher server fails, and it has your data, will it ever try to get key data from that one failed server? #### You are having multiple Memcache servers running Python, in which one of the Memcache server fails, and it has your data, will it ever try to get key data from that one failed server?
The data in the failed server won't get removed, but there is a provision for auto-failure, which you can configure for multiple nodes. Fail-over can be triggered during any kind of socket or Memcached server level errors and not during normal client errors like adding an existing key, etc. The data in the failed server won't get removed, but there is a provision for auto-failure, which you can configure for multiple nodes. Fail-over can be triggered during any kind of socket or Memcached server level errors and not during normal client errors like adding an existing key, etc.
#### Explain how you can minimize the Memcached server outages in your Python Development? #### Explain how you can minimize the Memcached server outages in your Python Development?
When one instance fails, several of them goes down, this will put larger load on the database server when lost data is reloaded as client make a request. To avoid this, if your code has been written to minimize cache stampedes then it will leave a minimal impact. When one instance fails, several of them goes down, this will put a larger load on the database server when lost data is reloaded as the client make a request. To avoid this, if your code has been written to minimize cache stampedes then it will leave a minimal impact.
Another way is to bring up an instance of Memcached on a new machine using the lost machines IP address. Another way is to bring up an instance of Memcached on a new machine using the lost machines IP address.
@ -294,7 +294,7 @@ The special attribute `__slots__` allows you to explicitly state which instance
Neither. In Python, (almost) everything is an object. What we commonly refer to as "variables" in Python are more properly called names. Likewise, "assignment" is really the binding of a name to an object. Each binding has a scope that defines its visibility, usually the block in which the name originates. Neither. In Python, (almost) everything is an object. What we commonly refer to as "variables" in Python are more properly called names. Likewise, "assignment" is really the binding of a name to an object. Each binding has a scope that defines its visibility, usually the block in which the name originates.
In Python a variable is not an alias for a location in memory. Rather, it is simply a binding to a Python object.ext post. In Python a variable is not an alias for a location in memory. Rather, it is simply binding to a Python object.ext post.
---- ----