Walrus Operator in Python 3.8

One of the biggest highlights of Python 3.8.0 is a new feature for assignment expressions known as the Walrus Operator.

"There is new syntax := that assigns values to variables as part of a larger expression," the Python 3.8.0 release notes state.


"It is affectionately known as 'the walrus operator' due to its resemblance to the eyes and tusks of a walrus."



In this example, the assignment expression helps avoid calling len() twice:

if (n := len(a)) > 10:
    print(f"List is too long ({n} elements, expected <= 10)")

Microsoft: We want you to learn Python programming language for free

Microsoft has launched a new 44-part series called Python for Beginners on YouTube, consisting of three- to four-minute lessons from two self-described geeks at Microsoft who love programming and teaching in YouTube or  Channel9

The Python for Beginners series is presented by Christopher Harrison, a senior program manager at Microsoft, and Susan Ibach, a business development manager from Microsoft's AI Gaming unit

Microsoft has published a page on GitHub containing additional resources, including slides and code samples to help students become better at Python. 

The Developers have a option to interface with machine-learning frameworks like Google-developed TensorFlow, and the Microsoft Cognitive Toolkit (CNTK)




DDA Line Drawing Algorithms Line Coordinates

def ROUND(a):
  return int(a + 0.5)
def drawDDA(x1,y1,x2,y2):
  x,y = x1,y1
  length = (x2-x1) if (x2-x1) > (y2-y1) else (y2-y1)
  dx = (x2-x1)/float(length)
  dy = (y2-y1)/float(length)
  print ('x = %s, y = %s' % (((ROUND(x),ROUND(y)))))
  for i in range(length):
    x += dx
    y += dy
    print ('x = %s, y = %s' % (((ROUND(x),ROUND(y)))))
drawDDA(2,5,10,20)

PyRobot - Python for Robotics

PyRobot is a Python package for benchmarking and running experiments in robot learning. The goal of this project is to abstract away the low-level controls for individual robots from the high-level motion generation and learning in an easy-to-use way. Using PyRobot will allow you to run robots without having to deal with the robot specific software along with enabling better comparisons.




Python developers reveal their favorite tool kits

  • Python is used mainly for Data Analysis 
  • NumPy is most popular data science framework 
  • Flask is most popular web frameworks 
  • Requests is most popular software libraries 
  • PyCharm is most popular IDEs for Python 

Python program to print memory and processor usage

import os import psutil pid = os.getpid() py = psutil.Process(pid) mu = (py.memory_info()[0] / 2.**30) * 1000 print('Memory Use(MB):', mu, 'of process id:', pid) print('CPU Use:',psutil.cpu_percent())

Python Program to Find the Fibonacci Series with defined program storage infinity

a=0 b=1 n=9999999999999999999999 # Number of terms in Fibonacci Series (sample value) # An integer giving the maximum value a variable of type Py_ssize_t can take. # It 's usually 2^31 - 1 on a 32-bit platform and 2^63 - 1 on a 64-bit platform. print(a,b,end=" ") while(n-2): c=a+b a=b b=c print("\n",c) n=n-1

Python Web Development Frameworks

Full Stack Frameworks

It gives full support to developers including basic components like form generators, form validation, and template layouts etc

1. Django is a high-level Python Web application development framework that encourages us to develop things rapidly, It uses pragmatic design.  It’s free and open source.

2. Web2py is a free open source full-stack development framework in python which allows the user to develop things quickly. It is a cross-platform framework that supports all popular operating systems. 

3. TurboGears is a free, open source and data-driven full-stack web application development Python framework. With the help of Javascript developer tools, developers can simply the web application.

4. CubicWeb is a semantic, free and open-source Python web framework, that empowers developers to efficiently build web applications by reusing components and following the well known object-oriented design principles. 

Non Full Stack Frameworks

Non-full stack frameworks are also called as Micro frameworks because it doesn’t have many components like full stack frameworks.

1. Flask is a microframework for Python based on Werkzeug, and Jinja 2. The main purpose is to develop a strong web application base. As compared to Django, Flask is best suited for small and easy projects.

2. CherryPy is a Minimalist Python Web Framework. It uses the Object-Oriented paradigm to develop web applications. This approach helps developers to develop web applications within a short period of time.

3. Bottle is a fast, simple and lightweight WSGI micro web-framework for Python. It is distributed as a single file module and has no dependencies other than the Python Standard Library. It is an easy-to-use lightweight framework generally used to build small web applications. It is mainly used to develop API’s.

4. Tornado is a python web framework with asynchronous network library. By using the non-blocking network I/O, Tornado can scale to tens of thousands of open connections, making it ideal for long polling, WebSockets, and other applications that require a long-lived connection to each user.