Effective Python Note 2

This article is composed of some notes from book Effective Python.

Use @property to define special behavior when attributes are accessed/set on your objects, if necessary

Another use case is to only specify getter to make that attribute read-only.

Effective Python Note

This article is composed of some notes from book Effective Python.

Scope Resolution

Python’s scope resolution follows the order below:

  1. current function
  2. enclosing scopes: like a outer function enclosing the current function
  3. global scope
  4. build-in scope
Your browser is out-of-date!

Update your browser to view this website correctly. Update my browser now

×