Skip to content

1995parham-learning/python101

Repository files navigation

Introduction

It's better to use pyenv with your python code, if you want to have the latest version of python:

# Setup
pyvenv .
# Activate
. ./bin/activate
# Deactive
deactive

Also, you can use pipenv, poetry or other newer dependency management tools instead of old and messy virtual environment.

Sample codes of Mastering Python book that is written by Rick van Hattem.

Simple project for renaming your downloaded TV series or Wallpapers to better naming structure. It's far from complete project that can do these things in professional manner.

Let's learn this new beast in Python, we use pure python edition of Thrift form here. This example was written for having more fun in our trash life.

First up and run your EMQx broker, then use this example to have fun.

Sometimes you want to have a default value for a function parameter:

def f(a = 10):
  pass

You cannot use mutable values as a default value, but why?

Example of working with dataclasses in python. They are introduced in 3.7.

Tuples are immutable but let dig deeper and see what is happened when their items are not immutable.

Since first time that I used python one of my challenges is how hashing works.

Python has better support for UTF-8 than Golang, so let's use it.

Learn about using finalizers in Python and also seeing weakref for the first time.

An implementation for a calculator that also has a tokenizer, so you can write:

1 + 2 * (3 + 4)

The example for counting lines of text files with python. It dates back to 2014.

Dynamic programming implementation of Fibonacci.

We need to have a Solution class that has a pluggable algorithm which can be changed during the runtime. This example contains two ways of implementation for this problem.

The fist time I met Python.

Parse HTML in Python. This is a very useful example for scrapping sites.

An introduction example to using python for audio processing (needs to know a little about signals and systems).

Insert random data into a MongoDB server. It actually used for inserting random data into I1820 database for a B.Sc. Project.

Review on metaclass basis. Useful for refreshing the concepts in your mind before digging deeper about its awesome usages.

Python has built-in library named operator. This example is review on some of its functions.

It returns the most common element in the array. The objective of this example is not about mode itself, actually it discusses type hints.

In Python, a protocol definition is written as a typing.Protocol subclass. However, classes that implement a protocol don't need to inherit, register, or declare any relationship with the class that defines protocol. Protocol in Python is similar to interfaces in Go.

Do you know every python program has a thread named MainThread? You do now.

FastAPI is one of famous HTTP frameworks in Python and here is an example to use it.

How we can have function overloading in python?

The built-in memoryview class is a shared-memory sequence type that lets you handle slices of arrays without copying bytes. It was inspired by the NumPy library.

The f-string, the format() built-in function, and the str.format() method delegate the actual formatting to each type by calling their .__format__(format_spec) method. The format_spec is a formatting specifier.

Review on python built-in data structures.

In python, we cannot have a private property just like what we have in Java. This example shows the way in python we can simulate private properties.

Releases

No releases published

Packages

No packages published