Skip to content

Nick Ryan

Data science, etc.

  • Home
  • About
  • Contact
  • CV
  • Github
  • LinkedIn
Nick Ryan

Tag: metaclass

Decorators and Metaprogramming in Python

Decorators and Metaprogramming in Python

Decorators

Decorators are intuitive and extremely useful. To demonstrate, we’ll look at a simple example. Let’s say we’ve got some function that sums all numbers 0 to n:

def sum_0_to_n(n):
    count = 0
    while n > 0:
        count += n
        n -= 1
    return count

and we’d like to time the performance of this function. Of course we could just modify the function like so:

Continue reading “Decorators and Metaprogramming in Python”

Author nickcdryanPosted on February 17, 2017February 17, 2017Tags metaclass, metaprogramming, pythonLeave a comment on Decorators and Metaprogramming in Python

Social

  • View nickcdryan1’s profile on Twitter
  • View nick-ryan-a687ba64’s profile on LinkedIn
  • View nickcdryan’s profile on GitHub

Archive

  • September 2019
  • August 2019
  • September 2017
  • June 2017
  • April 2017
  • March 2017
  • February 2017
  • January 2017

Tags

  • A/B testing
  • advertising
  • algorithms
  • baseball
  • benchmarking
  • BERT
  • chunking
  • computer vision
  • data analysis
  • deep learning
  • dimensionality reduction
  • facebook
  • machine learning
  • math
  • metaclass
  • metaprogramming
  • metrics
  • model evaluation
  • model selection
  • multi-label
  • neural net
  • neural networks
  • NLP
  • nltk
  • optimization
  • parsing
  • PCA
  • politics
  • preprocessing
  • python
  • pytorch
  • regularization
  • root-finding
  • scipy
  • sklearn
  • statistical learning theory
  • statistics
  • tagging
  • tensorflow
  • transfer learning
  • transformations
  • tutorial
  • twitter
  • visualization
  • web scraping
  • XLNet
  • Home
  • About
  • Contact
  • CV
  • Github
  • LinkedIn
Nick Ryan Blog at WordPress.com.
  • Follow Following
    • Nick Ryan
    • Already have a WordPress.com account? Log in now.
    • Nick Ryan
    • Customize
    • Follow Following
    • Sign up
    • Log in
    • Report this content
    • View site in Reader
    • Manage subscriptions
    • Collapse this bar