Skip to content

hughluo/py_metaprogramming

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

py_metaprogramming

Inspired by David Beazley'S tutorial Python 3 Metaprogramming presented at PyCon'13, March 14, 2013. Santa Clara, California.

Considerations

(Class) Decorator vs Metaclass:

  • How many functionalities will the Metaclass have?
  • Propagation due to inheritance
  • decorator to fulfill specialized needs

Use Case

Debug

Problem

While debugging, print or logging function everywhere.

Solution

Use decorator to debug func and class decorator to debug all instance method. Example Link

Signature

Problem

Boilerplate code to assign attribute while init a class.

Solution

Use Signature from the standard library inspect to build signature for function. Example Link

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages