OOP Beyond the Basics: Using Properties for Encapsulation, Computation and Refactoring

Posted by Bob on Wed 31 May 2017 in Concepts • Tagged with oop, property, decorators, encapsulation, computation, dunder, refactoring, pytest, 2vs3, getter, setter • 4 min read

In this article I share my learning of the property decorator coding a simple Account class. I think it's an unmissable tool in your (Python) OOP toolkit.


Continue reading

Twitter digest 2017 week 15

Posted by PyBites on Sun 16 April 2017 in Digest • Tagged with twitter, news, tips, python, frameworks, chrome, iterm2, twilio, books, learning, beginners, dictionaries, web scraping, cheat sheet, bokeh, data science, decorators, APIs, pygamels • 2 min read

Every weekend we share a curated list of 15 cool things (mostly Python) that we found / tweeted throughout the week.


Continue reading

Code Challenge 14 - Write DRY Code With Decorators - Review

Posted by PyBites on Sat 15 April 2017 in Challenges • Tagged with codechallenges, learning, decorators, design patterns, DRY • 2 min read

It's end of the week again so we review the code challenge of this week. It's never late to sign up, just fork our challenges repo and start coding.


Continue reading

Beginning Flask

Posted by Julian on Thu 13 April 2017 in Flask • Tagged with Flask, python, decorators, tutorial, learning • 5 min read

In this post I cover the basics of Flask in language that anyone can understand.


Continue reading

How to Write a Decorator with an Optional Argument?

Posted by Bob on Tue 11 April 2017 in Tips • Tagged with decorators, arguments, tricks, tips, cookbook • 3 min read

When playing with decorators (this week's challenge) I got stuck: how do you write a decorator that takes an optional argument? Python cookbook 3rd ed edition to the rescue. In this post how I failed my way to the right solution.


Continue reading

Code Challenge 14 - Write DRY Code With Decorators

Posted by PyBites on Mon 10 April 2017 in Challenges • Tagged with codechallenges, learning, decorators, design patterns, DRY • 2 min read

Hi Pythonistas, a new week, a new 'bite' of Python coding! This week we let you practice with decorators, a nice way to abstract away common functionality. It allows you to alter the behavior of a callable without modifying the callable itself. We agree with Dan Bader that 'understanding decorators is a milestone for any serious Python programmer.' Enjoy!


Continue reading

Flask for Loops - Printing Dict Data

Posted by Julian on Thu 06 April 2017 in Flask • Tagged with Flask, loops, python, decorators, tutorial, learning • 4 min read

In this post I demo how to create an extremely simple Flask app that prints the contents of a Dict to a web page.


Continue reading

Code Challenge 09 - The With Statement and Context Managers

Posted by PyBites on Mon 06 March 2017 in Challenges • Tagged with codechallenges, learning, with, contextlib, contextmanagers, decorators, generators • 1 min read

A new week, more coding! This week we have a free form exercise. This week you will implement your own Context Manager (= support with on your object).


Continue reading

Beautiful, idiomatic Python

Posted by Bob on Tue 10 January 2017 in Best practices • Tagged with pythonic, cleancode, collections, 2vs3, namedtuples, decorators, contextmanagers • 2 min read

Transforming Code into Beautiful, Idiomatic Python is a must-watch to write more Pythonic code. In this post some highlights.


Continue reading