Python programming and its packages Dagim
Python programming and its packages Dagim
Name ID
1.DAGIM NEGA UGE/27644/14
2.ABDETA TEREFE UGE/27670/14
3.ELIAS BIKALE UGE/27687/14
4.AMANUEL SELAMU UGE/27676/14
5.GETAHUN MILLION UGE/27697/14
Python programming and its packages
1. introduction
Python, one of the most popular programming languages today, has a rich history of
development and evolution. From its inception in the late 1980s to its current status as a
versatile and powerful language, Python's version history reflects the language's
adaptability and the community's dedication to improvement.
Guido van Rossum began working on Python in the late 1980s as a successor to the
ABC programming language and first released it in 1991 as Python 0.9.0. Python 2.0
was released in 2000. Python 3.0, released in 2008, was a major revision not
completely backward-compatible with earlier versions. Python 2.7.18, released in 2020,
was the last release of Python 2.
Python consistently ranks as one of the most popular programming languages, and has
gained widespread use in the machine learning community.
2. Analyze Version Histories: and Compare Releases: Contrast
features, performance, and architecture across major versions.
Python 1
Python 1 launched in 1994 with new features for functional programming, including
lambda, map, filter and reduce. It also included features from 0.9 Python, including
classes with inheritance, exception handling, functions, and the core data types list, dict,
str.
Python 1.4 brought its next set of features, such as Modula-3 style keyword arguments
and support for complex number operations.
During this period, Perl was the most popular scripting language, and Python was too
immature to be used at wide scale. As more developers sought alternatives to Perl,
Python seemed the best choice, as it mimics many of Perl’s features. In the world of
object-oriented programming, Java was on the rise during this era of Visual Basic and
C/C++.
Establishing a Strong Foundation
Python 2.0 (2000)
Python 2 launched in 2000 with big changes to source code storage. It introduced many
desired features like unicode support, list comprehension, and garbage collection. A bit
later, Python 2.2 introduced unification of types and classes under one hierarchy,
allowing Python to be truly object-oriented.
Around this time, many programmers used to adopt Python as an alternate scripting
language. Since Java was dominating in the world of enterprise-sized applications,
Python was used in smaller, niche applications.
Even Java developers started using Python to increase their coding speed due to its
interoperability.
List Comprehension
List comprehensions are used to create new lists from, from other iterables. List
comprehensions take and return a list, allowing you to trim a list by a certain criteria or
to create a new list with newly manipulated elements.
The following shows how you can use list comprehensions to return a new list with only
elements that are present in both passed lists.
Python 2.0 overhauls the garbage collection system by switching from a counter-based
system to a cycle-based system.
In the old system, each object would contain a counter that records how many other
objects are pointing to it. The object was then automatically deleted once that counter
reached zero. However, it wouldn’t delete objects that were pointed to but were not
accessible, resulting in a memory leak.
Python 2.0 fixes this by periodic cycles that call the garbage collector to delete
inaccessible objects. The cycles use additional overhead but reduce the risk of a
memory leak. Overhead costs of the deletion cycles have since been reduced due to
optimizations.
Augmented Assignment
Python 2.0 also adds support for augmented assignment operators that perform an
operation on the chosen variable and return the variable. For example, a += 1 adds 1 to
the value of a. It is a shorter version of the statement = a + 1.
The full list of supported assignment operators is +=, -=, *=, /=, %=, **=, &=, |=, ^=, >>=,
and <<=.
Python 2.2 Unified types and classes into one Python hierarchy to
December 2001 make Python more object-oriented. Also, added
generator routines that control the behavior of loops.
Python 2.5 Added the with statement that encloses code within a
March 2005 context manager.
Python 3’s development was steered by the same philosophies as previous versions but
also added that for every task “there should be one— and preferably only one
—obvious way to do it”.
Removing many duplicate tools unfortunately meant that all previous Python 2 code
was not compatible with Python 3.0. Some of the most notable changes are that print is
now a built-in function, removal of the Python 2 input, unification of str and unicode, and
changes in integer division.
Thankfully, the team at Python created a tool called 2to3 that will review an old Python 2
program and convert much of the changed syntax to Python 3 automatically.
The release of Python 3.0 pushed it into the developer limelight, and it attracted the
scientific community, particularly in fields like neuroscience. Once the NumPy library
was created in Python, Python became a competitor with R and Matlab, pushing Python
into its pedestal as the preferred language for machine learning and data science.
With the rise of big data in the early 2000s, spurred by the 2008 financial crisis, a new
need for data automation tools spiked. Many companies adopted Python for its
simplicity and powerful libraries. Shortly after, it became the preferred language for
managing social-media data.
It was around this time that Pandas, Scikit-learn, and Matplotlib were developed to meet
this demand.
Between 2012 and 2015, large technology companies like Facebook, Google, and
Netflix soon expanded the field of data science and machine learning, using Python as
the primary language and R for data visualization. More big-name Python tools like
TensorFlow and Seaborn were developed by these companies, making Python the #1
choice for data scientists.
Minor changes in Python 3.0
● reduce(): reduce() has been moved from builtins into functools. However map()
and filter() remain built-in.
● Old feature removal: old-style classes, string exceptions, and implicit relative
imports are no longer supported.
● Exception handling: exceptions now need the as keyword, exec as *var* is
standard over exec, *var*.
● with statement: which is now built in and no longer needs to be imported from
__future__.
● range: xrange() from Python 2 has been replaced by range(). The original range()
behavior is no longer available.
Print Function
In Python 2, print was a statement that had to be imported from __future__. In Python 3,
it has been changed to a built-in function and no longer requires any imports. As it is
now a function, you must have all printed arguments enclosed in parentheses,
print("printed").
For example:
One notable side effect of this is that you can no longer use an empty print statement to
create a new line
raw_input to input
The Python 2.0 version of input has been removed and the old raw_input has been
renamed to input. This means that input now always returns as a string rather than
being evaluated as an expression.
The goal of the change is to remove confusion around the behavior of the two similar
inputs and instead favor the more common use. If you want to use the old functionality,
you can instead use eval(input()).
Integer division
In Python 3, division operations that result in decimals return a float rather than a
truncated integer.
Python 3.1 June 2009 Added support for ordered dictionaries, which let
configuration files be read, modified, and then written
back in their original order.
Python 3.2 February 2011 Adds the option to restrict modules to specific APIs that
will remain stable despite updates. Added the argparse
module to replace optparse and the futures library for
concurrent programming.
Python 3.3 September Added yield from expression for generator delegation.
2012 Readded explicit unicode declaration support to ease
transition from Py2 to Py3. Simplified error catching by
removing the requirement to name a specific error type.
All errors can now be caught using OSError.
Python 3.4 March 2014 Added the asyncho module that includes support for
event loop implementations.
Python 3.7 June 2018 Added async and await as reserved keywords. Also,
added breakpoint() method, which drops you into the
debugger at the call site. Annotation evaluations can
now be postponed until runtime rather than at definition
to avoid scope errors.
Python 3.8 October 2019 Added “walrus operator” (:=) that allows you to assign
value to variables as part of a larger expression.
Enabled positional-only arguments that allows you to
specify that a parameter must be noted by position
rather than keyword. Added support for f-string specifier
= to allow more control over how the f-string is
presented.
Python 3.9 October 2020 Merge (|) and update (|=) added to dict library to
complement dict.update() method. Added
str.removeprefix(prefix) and str.removesuffix(suffix) to
easily remove unneeded sections of a string.
Python 3.10 October 2021 Python 3.10 introduced structural pattern matching with
the match statement, providing a functionality akin to the
switch or case statements found in other languages.
The future release of Python 3.12 brings more optimizations and features, continuing
the evolution of the language.
● Improved Error Messages in Python
● More Flexibility in Python F-String
● Type Parameter Syntax
● Improvement in Modules
● Syntactic Formalization of f-strings
Python's straightforward syntax and readability have not only made it a popular choice
for beginners but have also influenced the design of other programming languages like
Go (Golang) and Cobra. Its user-friendly nature allows new programmers to grasp
fundamental concepts easily, facilitating a smoother transition to more complex
languages later on.
Python's journey from a niche tool to a globally recognized language is marked by its
vibrant community and inclusive culture. These aspects have significantly contributed to
its enduring popularity and growth.
1. Openness and Inclusivity: The Python community is renowned for its open and
inclusive nature, fostering a welcoming environment for all programmers,
regardless of background or expertise. Initiatives like PyLadies and various
diversity programs, supported by the Python Software Foundation (PSF), have
been instrumental in promoting inclusivity and mentorship.
2. The Python Software Foundation (PSF): As the backbone of the Python
community, the PSF ensures that Python remains free and open-source. It
supports numerous outreach programs, grants, and events, providing a
collaborative platform for developers to contribute to Python's evolution.
3. Online Resources and Support: The community offers a wealth of online
resources, including comprehensive documentation, tutorials, forums, and Q&A
platforms like Stack Overflow. These resources create an accessible learning
environment, enabling both beginners and experienced developers to enhance
their Python skills and seek guidance from peers.
Technical debt in software development refers to the implied cost of additional rework
caused by choosing an easy solution now instead of using a better approach that would
take longer.
Python, despite its popularity and versatility, faces several challenges that developers
need to consider. Here are some key challenges, particularly focusing on technical debt,
backward compatibility, and scalability issues:
Technical Debt
1. Dynamic Typing:
○ Python's dynamic typing can lead to runtime errors that are harder to
catch during development. This can accumulate technical debt, especially
in large codebases where type-related bugs may go unnoticed until
execution.
2. Dependency Management:
Backward Compatibility
1. Performance:
Additional Challenges
1. Security:
○ Easing the Transition: Python 4.0 will likely focus on making the transition
as smooth as possible, providing tools and documentation to help
developers migrate their codebases with minimal friction.
○ Incremental Depreciation: To avoid the challenges faced during the Python
2 to 3 transition, Python 4.0 might adopt an incremental deprecation
strategy, allowing developers to gradually update their code.