Effective Python: 59 Specific Ways to Write Better Python by Brett Slatkin

By Brett Slatkin

It's effortless to begin writing code with Python: that's why the language is so immensely well known. even if, Python has special strengths, charms, and expressivity that may be demanding to understand at the beginning -- in addition to hidden pitfalls which could simply journey you up for those who aren't conscious of them. potent Python might help you harness the entire strength of Python to put in writing awfully strong, effective, maintainable, and well-performing code. using the concise, scenario-driven sort pioneered in Scott Meyers's best-selling potent C++, Brett Slatkin brings jointly fifty nine Python most sensible practices, assistance, shortcuts, and life like code examples from specialist programmers.

Through sensible examples, Slatkin uncovers little-known Python quirks, intricacies, and idioms that powerfully effect code habit and function. You'll tips on how to select the best and potent option to accomplish key projects whilst a number of innovations exist, and the way to put in writing code that's more straightforward to appreciate, keep, and improve.

Drawing on his deep realizing of Python's functions, Slatkin bargains useful recommendation for every significant region of improvement with either Python 3.x and Python 2.x. assurance includes:

Algorithms
Objects
Concurrency
Collaboration
integrated modules
creation techniques
And more

Each part comprises particular, actionable directions prepared into goods, each one with rigorously worded suggestion supported by means of particular technical arguments and illuminating examples. utilizing potent Python, you could systematically enhance all of the Python code you write: now not by way of blindly following ideas or mimicking incomprehensible idioms, yet by means of gaining a deep figuring out of the technical the explanation why they make feel.

Show description

Read Online or Download Effective Python: 59 Specific Ways to Write Better Python (Effective Software Development Series) PDF

Best python books

Think Python: An Introduction to Software Design: How To Think Like A Computer Scientist

Python for software program layout is a concise advent to software program layout utilizing the Python programming language. meant for individuals without programming event, this ebook begins with the main uncomplicated techniques and progressively provides new fabric. many of the rules scholars locate so much hard, like recursion and object-oriented programming, are divided right into a series of smaller steps and brought over the process numerous chapters.

Invent Your Own Computer Games With Python, 2nd Edition

* * * * vital notice: this is often the 2d variation. The 4th version is now on hand on the market or obtain. * * * * "Invent your individual machine video games with Python" teaches you machine programming within the Python programming language. every one bankruptcy provides the whole resource code for a brand new online game and teaches the programming ideas from those examples.

Internet of Things with Python

Engage with the realm and speedily prototype IoT purposes utilizing PythonAbout This BookRapidly prototype even complicated IoT purposes with Python and placed them to functional useEnhance your IoT talents with the main up to date applicability within the box of wearable tech, shrewdpermanent environments, and residential automationInteract with undefined, sensors, and actuators and keep an eye on your DIY IoT tasks via PythonWho This e-book Is ForThe publication is perfect for Python builders who are looking to discover the instruments within the Python surroundings in an effort to construct their very own IoT functions and paintings on IoT-related initiatives.

Modern Python Cookbook

Key FeaturesDevelop succinct, expressive courses in PythonLearn the simplest practices and customary idioms via rigorously defined and dependent recipesDiscover new how you can practice Python for the hot age of developmentBook DescriptionPython is the popular number of builders, engineers, information scientists, and hobbyists far and wide.

Additional info for Effective Python: 59 Specific Ways to Write Better Python (Effective Software Development Series)

Example text

This is a neat way of forbidding the direct instantiation of a class. Implement this as an exercise. You might also want to change the computer serial_number into something that is different for each computer, because as it is now it means that all computers will have the same serial number (which is impractical). And you can't start baking the pizza unless both the sauce and the topping are placed on the dough. Moreover, each pizza usually requires a different baking time, depending on the thickness of its dough and the topping used.

A copy of an object is usually required when we know that parts of the object will be modified but we want to keep the original object untouched. mp/protpat]. Using Prototype for such cases is more convenient. Using shallow copies might be worthwhile if the available resources are limited (such as embedded systems) or performance is critical (such as high-performance computing). mp/py3copy] as follows: "A shallow copy constructs a new compound object and then (to the extent possible) inserts references into it to the objects found in the original.

Note that this is just a convenience, and not a necessity. In this case, edition is a new parameter that was not needed in the first book but is useful information for the clone: def main(): b1 = Book('The C Programming Language', ('Brian W.

Download PDF sample

Rated 4.71 of 5 – based on 48 votes