By Brett Slatkin
“Each merchandise in Slatkin’s Effective Python teaches a self-contained lesson with its personal resource code. This makes the publication random-access: goods are effortless to browse and examine in no matter what order the reader wishes. i'll be recommending Effective Python to scholars as an admirably compact resource of mainstream suggestion on a truly vast diversity of subject matters for the intermediate Python programmer.”
—Brandon Rhodes, software program engineer at Dropbox and chair of PyCon 2016-2017
It’s effortless to begin coding with Python, that is why the language is so well known. although, Python’s exact strengths, charms, and expressiveness might be demanding to know, and there are hidden pitfalls that may simply journey you up.
Effective Python may also help you grasp a very “Pythonic” method of programming, harnessing Python’s complete energy to write down awfully strong and well-performing code. utilizing the concise, scenario-driven variety pioneered in Scott Meyers’ best-selling Effective C++, Brett Slatkin brings jointly fifty nine Python most sensible practices, advice, and shortcuts, and explains them with real looking code examples.
Drawing on years of expertise development Python infrastructure at Google, Slatkin uncovers little-known quirks and idioms that powerfully influence code habit and function. You’ll study tips on how to accomplish key initiatives, so that you can write code that’s more uncomplicated to appreciate, continue, and improve.
Key positive aspects include
- Actionable directions for all significant parts of Python 3.x and 2.x improvement, with targeted reasons and examples
- Best practices for writing services that make clear goal, advertise reuse, and stay away from bugs
- Coverage of ways to competently show behaviors with sessions and objects
- Guidance on the best way to stay away from pitfalls with metaclasses and dynamic attributes
- More effective ways to concurrency and parallelism
- Better innovations and idioms for utilizing Python’s integrated modules
- Tools and top practices for collaborative development
- Solutions for debugging, checking out, and optimization with a purpose to increase caliber and performance
Read or Download Effective Python: 59 Specific Ways to Write Better Python PDF
Similar python books
In basics OF PYTHON: FROM FIRST courses via information buildings, Washington and Lee college professor Kenneth A. Lambert provides the entire very important subject matters in CS1 and CS2 in a single quantity. This cost-effective structure presents teachers with a constant method of instructing introductory programming and knowledge buildings over a typical two-term direction series.
Python for facts research is worried with the nuts and bolts of manipulating, processing, cleansing, and crunching info in Python. it's also a realistic, glossy creation to clinical computing in Python, adapted for data-intensive purposes. it is a publication in regards to the elements of the Python language and libraries you'll have to successfully clear up a large set of information research difficulties.
When you intend to exploit Amazon net companies (AWS) for distant computing and garage, Python is a perfect programming language for constructing functions and controlling your cloud-based infrastructure. This cookbook will get you begun with greater than dozen recipes for utilizing Python with AWS, in line with the author’s boto library.
Construct real-world synthetic Intelligence functions with Python to intelligently have interaction with the realm round you approximately This e-book Step into the superb international of clever apps utilizing this accomplished consultant input the area of synthetic Intelligence, discover it, and create your individual purposes paintings via basic but insightful examples that would get you up and operating with man made Intelligence very quickly Who This e-book Is For This e-book is for Python builders who are looking to construct real-world man made Intelligence purposes.
Additional info for Effective Python: 59 Specific Ways to Write Better Python
If count is passed, the first count oc‐ currences are replaced. join(x). splitlines([keepends]) Splits string S on line breaks, returning lines list. The result does not retain line break characters unless keepends is true. format_map(mapping) See section “String formatting”. format(**M), but M is not copied. capitalize() Capitalizes the first character of string S, and lowercases its other characters. expandtabs([tabsize]) Replaces tabs in string S with tabsize spaces (default is 8). strip([chars]) Removes leading and trailing whitespace from string S (or characters in chars if passed).
L = list('spam') Creates a list of all items in any iterable, by calling the type constructor function. L = [x ** 2 for x in range(9)] Creates a list by collecting expression results during itera‐ tion (list comprehension). append(X) Inserts the single object X at the end of L, changing the list in-place. extend(I) Inserts each item in any iterable I at the end of L in-place (like an in-place +). Similar to L[len(L):] = I. Hint: use L[:0] = I to prepend all items in I. sort(key=None, reverse=False) Sorts L in-place, in ascending order by default.
The re‐ sult of 'a' + u'bc' is u'abc'). S. ASCII data (and raise an error for non-ASCII characters). The built-in str() and unicode() func‐ tions can be used to convert between normal and Unicode strings, and the encode() and decode() string methods apply and undo Unicode encodings. X’s built-in open() function files. Lists Lists are mutable (changeable) sequences of object references ac‐ cessed by offset (position). Literals and creation List literals are written as a comma-separated series of values en‐ closed in square brackets, and various operations construct lists dynamically: 46 | Python Pocket Reference  An empty list.