Code Monkey home page Code Monkey logo

python-tricks's Introduction

Python Tricks

Table of Contents

  • Ch2. Patterns for Cleaner Python
    • 2.1 Coevering Your A** With Assertions
    • 2.2 Complacent Comma Placement
    • 2.3 Context Managers and the with Statement
    • 2.4 Underscores, Dunders, and More
    • 2.5 A Shocking Truth About String Formatting
    • 2.6 The Zen of Python Easter Egg
  • Ch3. Effective Functions
    • 3.1 Python's Functions Are First-Class
    • 3.2 Lambdas Are Single-Expression Functions
    • 3.3 The Power of Decorators
    • 3.4 Fun With *args and **kwargs
    • 3.5 Function Argument Unpacking
    • 3.6 Nothing to Return Here
  • Ch4. Classes & OOP
    • 4.1 Object Comparisons: is vs ==
    • 4.2 String Conversion (Every Class Needs a __repr__)
    • 4.3 Defining Your Own Exception Classes
    • 4.4 Cloning Objects for Fun and Profit
    • 4.5 Abstract Base Classes Keep Inheritance in Check
    • 4.6 What Namedtuples Are Good For
    • 4.7 Class vs Instance Variable Pitfalls
    • 4.8 Instance, Class, and Static Methods Demystified
  • Ch5. Common Data Structures in Python
    • 5.1 Dictionaries, Maps, and Hashtables
    • 5.2 Array Data Structures
    • 5.3 Records, Structs, and Data Transfer Objects
    • 5.4 Set and Multisets
    • 5.5 Stacks (LIFOs)
    • 5.6 Queues (FIFOs)
    • 5.7 Priority Queues
  • Ch6. Looping & Iteration
    • 6.1 Writing Pythonic Loops
    • 6.2 Comprehending Comprehensions
    • 6.3 List Slicing Tricks and the Sushi Operator
    • 6.4 Beautiful Iterators
    • 6.5 Generators Are Simplified Iterators
    • 6.6 Generator Expressions
    • 6.7 Iterator Chains
  • Ch7. Dictionary Tricks
    • 7.1 Dictionary Default Values
    • 7.2 Sorting Dictionaries for Fun and Profit
    • 7.3 Emulating Switch/Case Statements With Dicts
    • 7.4 The Craziest Dict Expression in the West
    • 7.5 So Many Ways to Merge Dictionaries
    • 7.6 Dictionary Pretty-Printing
  • Ch8. Pythonic Productivity Techniques
    • 8.1 Exploring Python Modules and Objects
    • 8.2 Isolating Project Dependencies With Virtualenv
    • 8.3 Peeking Behind the Bytecode Curtain
  • Ch9. Closing Thoughts

python-tricks's People

Contributors

cyyeh avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.