Source code: Lib/platform.py Cross platform: Java platform: Windows platform: macOS platform: iOS platform: Unix platforms: Linux platforms: Android platform: Command-line usage: platform can also ...| Python documentation
Hypothesis 6.x¶| hypothesis.readthedocs.io
Container Types| rstudio.github.io
Python's collections.Counter class is extremely handy, especially when paired with generator expressions.| www.pythonmorsels.com
In this step-by-step tutorial, you'll learn what Python's OrderedDict is and how to use it in your code. You'll also learn about the main differences between regular dictionaries and ordered dictionaries.| realpython.com
Type Hints| loguru.readthedocs.io
Source code: Lib/configparser.py This module provides the ConfigParser class which implements a basic configuration language which provides a structure similar to what’s found in Microsoft Windows ...| Python documentation
In my opinion, you should only introduce a named tuple to your code when you're updating a preexisting API that was already returning a tuple or you are wrapping a tuple return value from another API. Let's start with when you should use named tuples. Usually an API that returns| Tall, Snarky Canadian
The time complexity of common operations on Python's many data structures.| www.pythonmorsels.com
Source code: Lib/tracemalloc.py The tracemalloc module is a debug tool to trace memory blocks allocated by Python. It provides the following information: Traceback where an object was allocated, St...| Python documentation
Why not…¶| www.attrs.org
Python generators are mighty, but they lack a couple of useful features. One of them is peeking the next item without consuming the generator. Even better, what if we could peek any number of items? …| ricardoanderegg.com
Short, meaningful names that take context into account are better than long, verbose names that don't.| benhoyt.com
An Enum is a set of symbolic names bound to unique values. They are similar to global variables, but they offer a more useful repr(), grouping, type-safety, and a few other features. They are most ...| Python documentation
Source code: Lib/copy.py Assignment statements in Python do not copy objects, they create bindings between a target and an object. For collections that are mutable or contain mutable items, a copy ...| Python documentation
This module provides access to some variables used or maintained by the interpreter and to functions that interact strongly with the interpreter. It is always available. Unless explicitly noted oth...| Python documentation
>>>, The default Python prompt of the interactive shell. Often seen for code examples which can be executed interactively in the interpreter.,,..., Can refer to:- The default Python prompt of the i...| Python documentation
Editor, Raymond Hettinger,. This article explains the new features in Python 3.8, compared to 3.7. Python 3.8 was released on October 14, 2019. For full details, see the changelog. Summary – Releas...| Python documentation
This chapter describes some things you’ve learned about already in more detail, and adds some new things as well. More on Lists: The list data type has some more methods. Here are all of the method...| Python documentation
The Python interpreter has a number of functions and types built into it that are always available. They are listed here in alphabetical order.,,,, Built-in Functions,,, A, abs(), aiter(), all(), a...| Python documentation
In 2022, disk I/O is very fast, and not usually the performance bottleneck in programs. This article digs into some numbers.| benhoyt.com
When I was replacing peewee with PonyORM, I was evaluating a few options, including moving away from an ORM entirely and simply storing the metadata in indexed tables in memory. This would have also helped to solve a couple of minor annoying design issues (such as improper encapsulation of the actual content state into the application instance), but I ended up not doing this.| beesbuzz.biz
The conflict between subclassing and composition is as old as object-oriented programming. The latest crop of languages like Go or Rust prove that you don’t need subclassing to successfully write code. But what’s a pragmatic approach to subclassing in Python, specifically?| Hynek Schlawack
namedtuple has been around since forever, and over time, its convenience saw it used far outside its originally intended purpose. With dataclasses now covering part of those use cases, what should one use named tuples for? In this article, I address this question, and give a few examples from real code.| death and gravity
“Don’t write clever code.” Why not? “Because it’s hard to understand.” People who say this think of clever code such as Duff’s Device: Duff's Device send(to, from, count) registershort*to, *from; registercount; { registern =(count +7) /8; switch(count %8) { case0: do{ *to =*from++; case7: *to =*from++; case6: *to =*from++; case5: *to =*from++; case4: *to =*from++; case3: *to =*from++; case2: *to =*from++; case1: *to =*from++; } while(--n >0); } } This code is “clever” becaus...| Hillel Wayne
I’ve created dozens of Python Morsels since I started it last year. At this point at least 10 of these exercises involve making a custom …| treyhunner.com
Crawling a website for missing resources using the Python standard library.| healeycodes.com
Performance comparison of counting and sorting word frequencies in various languages (Python, Go, C++, C, AWK, Forth, and Rust)| benhoyt.com