Modern Python Solutions Part 1

The latest in modern Python recipes for the busy modern programmer

Python is the preferred choice of developers, engineers, data scientists, and hobbyists everywhere.

It is a great scripting language that can power your applications and provide great speed, safety, and scalability. By exposing Python as a series of simple recipes, you can gain insight into specific language features in a particular context. Having a tangible context helps make the language or standard library feature easier to understand.This video comes with over 100 recipes on the latest version of Python. The recipes will benefit everyone ranging from beginner to an expert. The video is broken down into 13 sections that build from simple language concepts to more complex applications of the language.The recipes will touch upon all the necessary Python concepts related to data structures, OOP, functional programming, as well as statistical programming. You will get acquainted with the nuances of Python syntax and how to effectively use the advantages that it offers. You will end the book equipped with the knowledge of testing, web services, and configuration and application integration tips and tricks.The recipes take a problem-solution approach to resolve issues commonly faced by Python programmers across the globe. You will be armed with the knowledge of creating applications with flexible logging, powerful configuration, and command-line options, automated unit tests, and good documentation.

Who this course is for

The video is for web developers, programmers, enterprise programmers, engineers, big data scientist, and so on. If you are a beginner, Modern Python Recipes will get you started. If you are experienced, it will expand your knowledge base. A basic knowledge of programming would help.

What you will learn from this course


Table of Contents

  1. Numbers, Strings, and Tuples
    • Creating Meaningful Names and Using Variables
    • Working with Large and Small Integers
    • Choosing between Float, Decimal, and Fraction\
    • Choosing between True Division and Floor Division
    • Rewriting an Immutable String
    • String Parsing with Regular Expressions
    • Building Complex Strings with "template".format()
    • Building Complex Strings from Lists of Characters
    • Using the Unicode Characters that aren't on Our Keyboards
    • Encoding Strings-Creating ASCII and UTF8 Bytes
    • Decoding Bytes, How to Get Proper Characters from Some Bytes
    • Using Tuples of Items

  2. Statements and Syntax
    • Writing Python Script and Module Files
    • Writing Long Lines of Code
    • Including Descriptions and Documentation
    • Writing Better RST Markup in docstring
    • Designing Complex if…elif Chains
    • Designing a While Statement that Terminates Properly
    • Avoiding a Potential Problem with Break Statements
    • Leveraging the Exception Matching Rules
    • Avoiding a Potential Problem With an Except:Clause
    • Chaining Exceptions with the Raise from Statement
    • Managing a Context Using the With Statement

  3. Function Definitions
    • Designing Functions with Optional Parameters
    • Using Super Flexible Keyword Parameter
    • Forcing Keyword-only Argument with the * Separator
    • Writing Explicit Types on Function Parameters
    • Picking an Order for Parameters Based on Partial Functions
    • Writing Clear Documentation Strings
    • Designing Recursive Functions Around Python's Stack Limit
    • Writing Reusable Script with the Script Library Switch

  4. Built-in Data Structures – List, Sets, and Dict
    • Choosing a Data Structure
    • Building Lists – Literals, Appending, and Comprehensions
    • Slicing And Dicing a List
    • Deleting From a List
    • Reversing a Copy of a List
    • Using Set Methods and Operators
    • Removing Items from a Set
    • Creating Dictionaries
    • Removing from Dictionaries
    • Controlling the Order of the Dict Keys
    • Handling Dictionaries and Sets in doctest Examples
    • Understanding Variables, References, and Assignment

  5. User Inputs and Outputs
    • Using Features of the print() Functions
    • Using input() and getpass() for User Input
    • Debugging with "Format".Format_Map(Vars())
    • Using Argparse to Get Command-line Input
    • Using CMD for Creating Command-line Applications
    • Using the OS Environment Settings

Copyright © 2017 Packt Publishing

All rights reserved. No part of this course may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews. Every effort has been made in the preparation of this course to ensure the accuracy of the information presented. However, the information contained in this course is sold without warranty, either express or implied. Neither the author, nor Packt Publishing, and its dealers and distributors will be held liable for any damages caused or alleged to be caused directly or indirectly by this course. Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this course by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information.

Livery Place
35 Livery Street
Birmingham B3 2PB, UK.
ISBN 978-1-78728-451-7

www.packtpub.com