• Fri frakt över 249 kr
  • •
  • Snabba leveranser
  • •
  • Billiga böcker
Kundservice

Du är på sajten för privatpersoner.

Företag, bibliotek eller offentlig verksamhet?

Du handlar på classic.bokus.com, där alla dina funktioner finns intakta.
Till classic.bokus.com
Bokus logotyp. Gå till startsidan.
  • Erbjudanden
  • Nyheter
  • Student
  • Topplistor
  • Barn & ungdom
  • Bokus Play
  • E-böcker
  • Pocketböcker
  • Spel & pussel

10% rabatt på allt med kod NYSTART10 →

Sidfot

Mina sidor

    Hjälp

    • Kundservice
    • Vanliga frågor och svar
    • Frakt och leverans
    • Retur vid ångerrätt
    • Reklamera vara
    • Betalning
    • Köpvillkor
    • Allmänna villkor
    • Information om webbplatsens tillgänglighet

    Om Bokus

    • Om oss
    • Pressrum
    • För studenter
    • För företag
    • För bibliotek och offentlig verksamhet
    • För leverantörer
    • Hållbarhet

    Populärt

    • Aktuella erbjudanden
    • Presentkort
    • Studentlitteratur
    • Nya böcker
    • Topplistor
    • Signerade böcker
    • Engelska böcker

    Inspiration

    • Boktips
    • BookTok
    • Populära bokserier
    • Barnbokskaraktärer
    • Populära författare
    Logotyp för Bokus
    Följ oss på Facebook (extern länk)Följ oss på Instagram (extern länk)Följ oss på YouTube (extern länk)Följ oss på TikTok (extern länk)
    bokus @ CookiesAnpassa cookiesIntegritetspolicyKöpvillkor
    Till Citymail hemsida (extern länk)Till Budbee hemsida (extern länk)Till Postnord hemsida (extern länk)Till Schenker hemsida (extern länk)Till Early Bird hemsida (extern länk)Till Walleys hemsida (extern länk)
    1. Data och IT
    2. Programmeringsböcker
    3. Programspråk

    Better Python Code

    A Guide for Aspiring Experts

    AvDavid Mertz

    Häftad, Engelska, 2023

    373 kr

    Beställningsvara. Skickas inom 7-10 vardagar. Fri frakt över 249 kr.

    Beskrivning

    Move Beyond Python Code That "Mostly Works" to Code That Is Expressive, Robust, and Efficient

    Python is arguably the most-used programming language in the world, with applications from primary school education to workaday web development, to the most advanced scientific research institutes. While there are many ways to perform a task in Python, some are wrong, inelegant, or inefficient. Better Python Code is a guide to "Pythonic" programming, a collection of best practices, ways of working, and nuances that are easy to miss, especially when ingrained habits are borrowed from other programming languages.

    Author David Mertz presents concrete and concise examples of various misunderstandings, pitfalls, and bad habits in action. He explains why some practices are better than others, based on his 25+ years of experience as an acclaimed contributor to the Python community. Each chapter thoroughly covers related clusters of concepts, with chapters sequenced in ascending order of sophistication.

    Whether you are starting out with Python or are an experienced developer pushing through the limitations of your Python code, this book is for all who aspire to be more Pythonic when writing better Python code.

    • Use the right kind of loops in Python
    • Learn the ins and outs of mutable and immutable objects
    • Get expert advice to avoid Python "gotchas"
    • Examine advanced Python topics
    • Navigate the "attractive nuisances" that exist in Python
    • Learn the most useful data structures in Python and how to avoid misusing them
    • Avoid security mistakes
    • Understand the basics of numeric computation, including floating point numbers and numeric datatypes

    "My high expectations for this engaging Python book have been exceeded: it offers a great deal of insight for intermediate or advanced programmers to improve their Python skills, includes copious sharing of precious experience practicing and teaching the language, yet remains concise, easy to read, and conversational."
    --From the Foreword by Alex Martelli

    Register your book for convenient access to downloads, updates, and/or corrections as they become available. See inside book for details.

    Produktinformation

    • Utgivningsdatum:2023-12-05
    • Mått:178 x 232 x 12 mm
    • Vikt:470 g
    • Format:Häftad
    • Språk:Engelska
    • Antal sidor:288
    • Upplaga:1
    • Förlag:Pearson Education
    • ISBN:9780138320942

    Utforska kategorier

    • Programspråk inom Data och IT

    Mer om författaren

    David Mertz has been a member of the Python community for 25 years. He has taught Python to scientists, developers coming from other languages, and to programming neophytes. He was a director of the Python Software Foundation (PSF) for six years and continues to serve on, or chair, a variety of PSF working groups. David is the author of several technical books and has given keynote addresses at numerous international programming conferences.

    Recensioner i media

    "You'll not just be aspiring to be an expert anymore after practicing through Better Python Code: A Guide for Aspiring Experts, you'll be one of them! Learn from David Mertz, who's been making experts through his writing and training for the past 20 years."--Iqbal Abdullah, past Chair, PyCon Asia Pacific, and past board member, PyCon Japan"In Better Python Code: A Guide for Aspiring Experts, David Mertz serves up bite-sized chapters of Pythonic wisdom in this must-have addition to any serious Python programmer's collection. This book helps bridge the gap from beginner to advanced Python user, but even the most seasoned Python programmer can up their game with Mertz's insight into the ins and outs of Python."--Katrina Riehl, President, NumFOCUS"What separates ordinary coders from Python experts? It's more than just knowing best practices--it's understanding the benefits and pitfalls of the many aspects of Python, and knowing when and why to choose one approach over another. In this book David draws on his more than 20 years of involvement in the Python ecosystem and his experience as a Python author to make sure that the readers understand both what to do and why in a wide variety of scenarios."--Naomi Ceder, past Chair, Python Software Foundation"Like a Pythonic BBC, David Mertz has been informing, entertaining, and educating the Python world for over a quarter of a century, and he continues to do so here in his own pleasantly readable style."--Steve Holden, past Chair, Python Software Foundation"Being expert means someone with a lot of experience. David's latest book provides some important but common problems that folks generally learn only after spending years of doing and fixing. I think this book will provide a much quicker way to gather those important bits and help many folks across the world to become better."--Kushal Das, CPython Core Developer and Director, Python Software Foundation"This book is for everyone: from beginners, who want to avoid hard-to-find bugs, all the way to experts looking to write more efficient code. David Mertz has compiled a great set of useful idioms that will make your life as a programmer easier and your users happier."--Marc-André Lemburg, past Chair, EuroPython, and past Director, Python Software Foundation

    Innehållsförteckning

    • Foreword xviiPreface xixAcknowledgments xxvAbout the Author xxviiIntroduction 1Chapter 1: Looping Over the Wrong Things 31.1 (Rarely) Generate a List for Iteration 31.2 Use enumerate() Instead of Looping Over an Index 61.3 Don't Iterate Over dict.keys() When You Want dict.items() 81.4 Mutating an Object During Iteration 91.5 for Loops Are More Idiomatic Than while Loops 121.6 The Walrus Operator for "Loop-and-a-Half" Blocks 131.7 zip() Simplifies Using Multiple Iterables 151.8 zip(strict=True) and itertools.zip_longest() 171.9 Wrapping Up 20Chapter 2: Confusing Equality with Identity 212.1 Late Binding of Closures 212.2 Overchecking for Boolean Values 252.3 Comparing x == None 282.4 Misunderstanding Mutable Default Arguments 292.5 Copies versus References to Mutable Objects 332.6 Confusing is with == (in the Presence of Interning) 352.7 Wrapping Up 37Chapter 3: A Grab Bag of Python Gotchas 393.1 Naming Things 393.2 Quadratic Behavior of Naive String Concatenation 523.3 Use a Context Manager to Open a File 563.4 Optional Argument key to .sort() and sorted() 593.5 Use dict.get() for Uncertain Keys 623.6 Wrapping Up 64Chapter 4: Advanced Python Usage 674.1 Comparing type(x) == type(y) 674.2 Naming Things (Revisited) 714.3 Keep Less-Used Features in Mind 794.4 Type Annotations Are Not Runtime Types 984.5 Wrapping Up 105Chapter 5: Just Because You Can, It Doesn't Mean You Should... 1075.1 Metaclasses 1075.2 Monkeypatching 1125.3 Getters and Setters 1155.4 It's Easier to Ask for Forgiveness Than Permission 1185.5 Structural Pattern Matching 1215.6 Regular Expressions and Catastrophic Backtracking 1235.7 Wrapping Up 126Chapter 6: Picking the Right Data Structure 1296.1 collections.defaultdict 1296.2 collections.Counter 1326.3 collections.deque 1356.4 collections.ChainMap 1386.5 Dataclasses and Namedtuples 1416.6 Efficient Concrete Sequences 1466.7 Wrapping Up 150Chapter 7: Misusing Data Structures 1537.1 Quadratic Behavior of Repeated List Search 1537.2 Deleting or Adding Elements to the Middle of a List 1577.3 Strings Are Iterables of Strings 1637.4 (Often) Use enum Rather Than CONSTANT 1667.5 Learn Less Common Dictionary Methods 1697.6 JSON Does Not Round-Trip Cleanly to Python 1747.7 Rolling Your Own Data Structures 1787.8 Wrapping Up 187Chapter 8: Security 1898.1 Kinds of Randomness 1908.2 Putting Passwords or Other Secrets in "Secure" Source Code 1958.3 "Rolling Your Own" Security Mechanisms 1988.4 Use SSL/TLS for Microservices 2018.5 Using the Third-Party requests Library 2058.6 SQL Injection Attacks When Not Using DB-API 2088.7 Don’t Use assert to Check Safety Assumptions 2128.8 Wrapping Up 215Chapter 9: Numeric Computation in Python 2179.1 Understanding IEEE-754 Floating Point Numbers 2179.2 Numeric Datatypes 2289.3 Wrapping Up 239Appendix: Topics for Other Books 241A.1 Test-Driven Development 241A.2 Concurrency 242A.3 Packaging 243A.4 Type Checking 243A.5 Numeric and Dataframe Libraries 244Index 245