Sign in

Work at the nexus of biomedicine, data science & mobile dev. Love to write on these technological topics. Follow me @ycui01 on Twitter to get latest articles.

Write and use Python attributes the right way

An ornate door
An ornate door
Photo by Jan Canty on Unsplash

1. Use Property Decorator for Encapsulation


Have a better understanding of variables in Python

person whose face is obscured by a haze sitting in a wheat
person whose face is obscured by a haze sitting in a wheat
Photo by Aziz Acharki on Unsplash


Lambdas, decorators, partials, and more

Man using machinery
Man using machinery
Photo by Aurelien Romain on Unsplash.


Take advantage of the async and await features in asyncio

Image for post
Image for post
Photo by Ash Edmonds on Unsplash

First Look

Synchronous Code Example
  • The load_data_for_user function calls the authenticate_user and get_posts_remotely.
  • These two functions execute sequentially, taking five seconds to complete, matching the time difference shown in the timestamps.
Asynchronous Code…


Take advantage of one of the most powerful data types in Python

Stream of water
Stream of water
Photo by kazuend on Unsplash.

1. Create Dictionaries With Keys Specified


There’s nothing more valuable than a consistent engineer

landscape scene with lake, mountains, and cloudy sky
landscape scene with lake, mountains, and cloudy sky
Photo by Tobias Keller on Unsplash


All you need to know to write readable Python functions

Snowy mountains
Snowy mountains
Photo by Marc Marchal on Unsplash.


Virtual environments, string interpolation, lazy evaluation, and comprehensions

Canopy of trees in autumn
Canopy of trees in autumn
Photo by Robert Reyes on Unsplash.


When you shouldn’t use print for logging purposes

Laptop, phone and other accessories on a counter
Laptop, phone and other accessories on a counter
Photo by Artiom Vallat on Unsplash.


Get rid of some boilerplate code in your custom classes

laptop keyboard keys and their reflection in the laptop screen
laptop keyboard keys and their reflection in the laptop screen
Photo by Philipp Katzenberger on Unsplash

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store