1. Trang chủ
  2. » Tất cả

Mastering-Python

486 0 0

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Định dạng
Số trang 486
Dung lượng 4,34 MB

Nội dung

www.allitebooks.com Mastering Python Master the art of writing beautiful and powerful Python by using all of the features that Python 3.5 offers Rick van Hattem BIRMINGHAM - MUMBAI www.allitebooks.com Mastering Python Copyright © 2016 Packt Publishing All rights reserved No part of this book 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 book to ensure the accuracy of the information presented However, the information contained in this book 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 book Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals However, Packt Publishing cannot guarantee the accuracy of this information First published: April 2016 Production reference: 1270416 Published by Packt Publishing Ltd Livery Place 35 Livery Street Birmingham B3 2PB, UK ISBN 978-1-78528-972-9 www.packtpub.com www.allitebooks.com Credits Author Project Coordinator Rick van Hattem Suzanne Coutinho Reviewers Proofreader Randall Degges Safis Editing Dave de Fijter Indexer I de Hoogt Mariammal Chettiyar Commissioning Editor Sarah Crofton Production Coordinator Nilesh Mohite Acquisition Editor Cover Work Reshma Raman Nilesh Mohite Content Development Editor Arun Nadar Technical Editors Ryan Kochery Tanmayee Patil Copy Editor Vikrant Phadke www.allitebooks.com About the Author Rick van Hattem is an experienced programmer, entrepreneur, and software/database architect with over 20 years of programming experience, including 15 with Python Additionally, he has a lot of experience with high-performance architectures featuring large amounts of concurrent users and/or data Rick has founded several start-ups and has done consulting for many companies, including a few Y Combinator start-ups and several large companies One of the startups he founded, Fashiolista.com, is one of the largest social networks for fashion in the world, featuring millions of users and the performance challenges to accompany those Rick was one of the reviewers on the book PostgreSQL Server Programming, Packt Publishing Thanks to my family, in particular Marloes, who supported me every step of the way; and my mother and sister, who have always been there for me www.allitebooks.com About the Reviewers Randall Degges is a happy programmer, speaker, author, and amateur bodybuilder living in California Growing up in Los Angeles, he was intensely interested in building commandline programs and writing quality software His love of programming eventually propelled him into a successful career in software development Randall has been a life-long open source developer and has contributed to hundreds of popular projects in Python, Node.js, and Go He's also the author of several popular libraries, which you can find on his public GitHub account at https://github.com/rdegges At 23, he cofounded an extremely popular API service in the telephony industry: OpenCNAM (https://www.opencnam.com) At 25, he joined Stormpath (https://stormpath.com) as the head of developer evangelism, whereby he writes open source security libraries full time and travels the world giving technical talks about building secure software In his free time, Randall writes and edits technical books, runs a security podcast called Stormcast (https://www.stormca.st), posts blogs on his personal website (https://www.rdegges.com), and tries to spend time with his high-school sweetheart, Samantha www.allitebooks.com Dave de Fijter is a Python developer from the Netherlands He always knew he would end up "doing something with computers." At a young age, he went to the library to read books about them even though he had no computer at that time This obsession never really ended In 2001, aged 14, he started his first part-time job, creating dynamic websites in PHP for a local web development company, and there he found his calling In 2007, he finished his bachelor's degree in ICT while already working full time as a PHP developer for over a year In 2008, he switched from PHP to Python and Django for web development and loved this new technology stack so much that he never looked back After working as a Python developer for various start-ups and established companies, Dave used this experience to start his own business called Indentity (https://indentity.nl) in 2010, focusing on Python/Django development and advice Up until now, he runs this company and mainly spends his time helping out start-ups with designing and building technologically advanced web applications from the ground up as an interim CTO/technical cofounder I de Hoogt, with some basic experience wrought from university assignments in the field of modeling of multi-phase flows, got himself started in software development His main experience in programming in Python stems from an internship at a company dealing in 3D printing software, where a package resulting in optimized object orientation and guaranteed mathematical mesh validity was created Other projects that he's been involved with have dealt with control systems such as self-parking cars, multi-legged robots, and quadcopters, but his current job is in the field of data analysis www.allitebooks.com www.PacktPub.com eBooks, discount offers, and more Did you know that Packt offers eBook versions of every book published, with PDF and ePub files available? You can upgrade to the eBook version at www.PacktPub com and as a print book customer, you are entitled to a discount on the eBook copy Get in touch with us at customercare@packtpub.com for more details At www.PacktPub.com, you can also read a collection of free technical articles, sign up for a range of free newsletters and receive exclusive discounts and offers on Packt books and eBooks TM https://www2.packtpub.com/books/subscription/packtlib Do you need instant solutions to your IT questions? PacktLib is Packt's online digital book library Here, you can search, access, and read Packt's entire library of books Why subscribe? • Fully searchable across every book published by Packt • Copy and paste, print, and bookmark content • On demand and accessible via a web browser www.allitebooks.com www.allitebooks.com Table of Contents Preface xi Chapter 1: Getting Started – One Environment per Project Creating a virtual Python environment using venv Creating your first venv venv arguments Differences between virtualenv and venv Bootstrapping pip using ensurepip ensurepip usage Manual pip install Installing C/C++ packages Debian and Ubuntu Red Hat, CentOS, and Fedora OS X Windows 10 Summary 11 Chapter 2: Pythonic Syntax, Common Pitfalls, and Style Guide Code style – or what is Pythonic code? Formatting strings – printf-style or str.format? PEP20, the Zen of Python Beautiful is better than ugly Explicit is better than implicit Simple is better than complex Flat is better than nested Sparse is better than dense Readability counts Practicality beats purity Errors should never pass silently In the face of ambiguity, refuse the temptation to guess One obvious way to it Now is better than never [i] www.allitebooks.com 13 14 15 15 16 17 18 20 20 21 21 22 24 24 25 ... in to your Packt account Also, the code for the book is hosted on GitHub at https://github.com/ mastering-python/ code Once the file is downloaded, please make sure that you unzip or extract the

Ngày đăng: 13/04/2019, 01:40