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

By Brett Slatkin

“Each merchandise in Slatkin’s Effective Python teaches a self-contained lesson with its personal resource code. This makes the booklet random-access: goods are effortless to browse and learn 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 large variety of themes 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 renowned. notwithstanding, Python’s detailed strengths, charms, and expressiveness may be demanding to understand, and there are hidden pitfalls which may simply journey you up.

Effective Python might help you grasp a really “Pythonic” method of programming, harnessing Python’s complete energy to write down tremendously 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, suggestions, and shortcuts, and explains them with lifelike 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 easy methods to accomplish key projects, so that you can write code that’s more straightforward to appreciate, continue, and improve.

Key gains include

  • Actionable directions for all significant parts of Python 3.x and 2.x improvement, with designated motives and examples
  • Best practices for writing features that make clear purpose, advertise reuse, and stay away from bugs
  • Coverage of ways to competently convey behaviors with periods and objects
  • Guidance on the right way to stay away from pitfalls with metaclasses and dynamic attributes
  • More effective ways to concurrency and parallelism
  • Better suggestions and idioms for utilizing Python’s integrated modules
  • Tools and top practices for collaborative development
  • Solutions for debugging, trying out, and optimization in an effort to enhance caliber and performance

Show description

Read or Download Effective Python: 59 Specific Ways to Write Better Python PDF

Best python books

Beginning Python: From Novice to Professional (2nd Edition)

Achieve a basic realizing of Python's syntax and lines with the second one version of starting Python, an up–to–date creation and functional reference. protecting a big selection of Python–related programming subject matters, together with addressing language internals, database integration, community programming, and net companies, you'll be guided by means of sound improvement ideas.

Bioinformatics Programming Using Python: Practical Programming for Biological Data

Powerful, versatile, and simple to exploit, Python is a perfect language for construction software program instruments and purposes for all times technological know-how examine and improvement. This distinct publication exhibits you the way to software with Python, utilizing code examples taken without delay from bioinformatics. very quickly, you'll be utilizing refined strategies and Python modules which are quite powerful for bioinformatics programming.

Bioinformatics Programming utilizing Python is ideal for an individual concerned with bioinformatics -- researchers, aid employees, scholars, and software program builders attracted to writing bioinformatics purposes. You'll locate it invaluable no matter if you already use Python, write code in one other language, or haven't any programming event in any respect. It's a great self-instruction device, in addition to a convenient reference while dealing with the demanding situations of real-life programming tasks.
* get to grips with Python's basics, together with how one can increase easy purposes
* use Python modules for development matching, established textual content processing, on-line information retrieval, and database entry
* observe generalized styles that disguise a wide share of ways Python code is utilized in bioinformatics
* methods to observe the foundations and methods of object-oriented programming
* enjoy the "tips and traps" part in every one bankruptcy

Programming in Python 3: A Complete Introduction to the Python Language (2nd Edition)

A absolutely Revised version that includes New fabric on Coroutines, Debugging, checking out, Parsing, String Formatting, and extra


Python three is the easiest model of the language but: it's extra robust, handy, constant, and expressive than ever sooner than. Now, best Python programmer Mark Summerfield demonstrates how one can write code that takes complete benefit of Python 3's gains and idioms. Programming in Python three, moment version, brings jointly all of the wisdom you must write any application, use any typical or third-party Python three library, and create new library modules of your own.


Summerfield attracts on his decades of Python adventure to proportion deep insights into Python three improvement you won't locate at any place else. He starts via illuminating Python's "beautiful heart": the 8 key components of Python you want to write strong, high-performance courses. construction on those center parts, he introduces new themes designed to reinforce your sensible expertise-one idea and hands-on instance at a time. assurance contains
* constructing in Python utilizing procedural, objectoriented, and practical programming paradigms
* growing customized applications and modules
* Writing and analyzing binary, textual content, and XML documents, together with non-compulsory compression, random entry, and textual content and XML parsing
* Leveraging complex information kinds, collections, regulate buildings, and features
* Spreading software workloads throughout a number of procedures and threads
* Programming SQL databases and key--value DBM documents
* Debugging techniques-and utilizing try out pushed improvement to prevent insects within the first position
* using Python's ordinary expression mini-language and module
* Parsing concepts, together with easy methods to use the third-party PyParsing and PLY modules
* construction usable, effective, GUI-based functions
* complex programming ideas, together with turbines, functionality and sophistication decorators, context managers, descriptors, summary base periods, metaclasses, coroutines, and extra


Programming in Python three, moment version, serves as either educational and language reference. It assumes a few past programming event, and is followed through vast downloadable instance code-all of it confirmed with Python three on home windows, Linux, and Mac OS X. This version covers Python three. zero and three. 1, and because of the Python language moratorium it's also legitimate for Python three. 2 which has an analogous language as Python three. 1.

Additional info for Effective Python: 59 Specific Ways to Write Better Python

Sample text

Double-click on the Sketch icon in the Project tree. 3. Notice the horizontal and vertical constraint symbols (the small red bars). Also notice that the lines have end points but they aren't constrained. 4. Grab either of the lines and move it and the other one won't move with it. 41 This material is copyright and is licensed for the sole use by on 7th October 2012 FreeCAD [How-to] 5. recompute() 6. Notice how one end of each line has connected to the other. 7. Try moving one of the lines around the screen and you will see that the lines move together.

Most FreeCAD commands can be accessed with macros and Python scripting. 19 This material is copyright and is licensed for the sole use by on 7th October 2012 FreeCAD [How-to] Taking advantage of the power of macros Macros actually record Python instructions as they are executed. We also have the ability to read and edit them later. Open our new macro with the Edit button in the macro dialog. This will open our macro in FreeCAD's built-in macro editor. com. PacktPub. com/support and register to have the files e-mailed directly to you.

Select the centers of the top two holes and the vertical axis. Add a symmetry constraint. Repeat for the bottom two holes. The two sets of circles are now independently symmetrical. 5. Draw a line from the center of the top-right hole to the center of the bottom-right hole. Make sure the end points are coincident with the center of each circle. Select the line and make it into a construction line by clicking on the construction mode icon. 6. Set a length constraint on the construction line of 50 mm.

Download PDF sample

Rated 4.65 of 5 – based on 34 votes