social.dk-libre.fr is a Fediverse instance that uses the ActivityPub protocol. In other words, users at this host can communicate with people that use software like Mastodon, Pleroma, Friendica, etc. all around the world.

This server runs the snac software and there is no automatic sign-up process.

Search results for tag #python

[?]Trey Hunner 🐍 » 🌐
@treyhunner@mastodon.social

Python Tip #272 (of 365):

Do something or return something, but not both.

The list sort method returns None:

>>> numbers = [4, 2, 7, 1, 5]
>>> x = numbers.sort()
>>> print(x)
None
>>> numbers
[1, 2, 4, 5, 7]

The sort method modifies the list IN PLACE: mutating the list is its purpose.

Returning nothing indicates that an action happened.

append, extend, update, and most other mutating methods/functions follow this convention.

🧵 (1/3)

    [?]Trey Hunner 🐍 » 🌐
    @treyhunner@mastodon.social

    Python Tip #273 (of 365):

    Avoid needless wrapper functions.

    This lambda does nothing but call len:

    sorted(words, key=lambda s: len(s))

    So pass len itself:

    sorted(words, key=len)

    🧵 (1/4)

      [?]Trey Hunner 🐍 » 🌐
      @treyhunner@mastodon.social

      “A loop that goes on forever is called an infinite loop.”

      Read more 👉 pym.dev/while-loops/

        [?]Hugo van Kemenade » 🌐
        @hugovk@mastodon.social

        🐍🚀 Out now!

        pepotron:
        Open multiple PEPs like `pep 745 790`
        Replace ghapi with urllib3
        github.com/hugovk/pepotron/rel

        linkotron:
        If no input given on CLI, read from clipboard
        github.com/hugovk/linkotron/re

        norwegianblue:
        Show cycle name in EOL colour
        github.com/hugovk/norwegianblu

        pylast:
        Only retry transient network failures
        github.com/pylast/pylast/relea

        all of them:
        Drop support for almost-EOL Python 3.10
        devguide.python.org/versions/

          [?]Hugo van Kemenade » 🌐
          @hugovk@mastodon.social

          Just released: humanize 4.13.0! 🚀

          🤖 Optimise `naturalsize` algorithm by using `math.log`

          🤖 Fix `precisedelta` rounding

          github.com/python-humanize/hum

            [?]Hugo van Kemenade » 🌐
            @hugovk@mastodon.social

            Just released! 🚀

            After one sequential-only CI failure, two artifacts builds, one GitHub outage, two fixes for the Windows installer build, four Windows builds, and a NuGet outage:

            🐍 Python 3.15 alpha 2!

            🔬 PEP 799: A new high-frequency statistical sampling profiler
            💬 PEP 686: Python now uses UTF-8 as the default encoding
            🌊 PEP 782: A new PyBytesWriter C API to create a Python bytes object
            ⚠️ Better error messages

            discuss.python.org/t/python-3-

              [?]Hugo van Kemenade » 🌐
              @hugovk@mastodon.social

              Just released! 🚀

              🎶 pylast 7.0.0

              🎤 A interface to @lastfm and Libre.fm

              🗑️ Remove `SCROBBLE_SOURCE_*` and `SCROBBLE_MODE_*` constants. Last used in 2017, you probably weren't using them

              📻 Add `chosen_by_user` parameter to `scrobble`. Set to false if you don't have "direct" control over the source, like radio or a stream.

              🐍 Add support for Python 3.15

              📼 Test against recorded API instead of live

              🦀 Replace pre-commit with prek

              Thanks to @scy!

              github.com/pylast/pylast/relea

                [?]Hugo van Kemenade » 🌐
                @hugovk@mastodon.social

                Just released! 🚀🐍

                Python 3.14.1

                Waiting for the .1 to upgrade? This one's especially for you!

                🥧 Deferred type annotation evaluation!
                🥧 T-strings!
                🥧 Zstandard!
                🥧 Syntax highlighting in the REPL!
                🥧 Colour in unittest, argparse, json and calendar CLIs!
                🥧 UUID v6-8!
                🥧 And much more!

                discuss.python.org/t/python-3-

                Two snakes enjoying a pie with 3.14 on the top and π crimping.

                Alt...Two snakes enjoying a pie with 3.14 on the top and π crimping.

                  [?]Hugo van Kemenade » 🌐
                  @hugovk@mastodon.social

                  Just released! 🚀🐍

                  Python 3.14.2 (and 3.13.11)

                  Waiting for the .2 to upgrade? This one's especially for you!

                  So soon? We found some regressions, so here’s an expedited pair of releases. They also come with bonus security fixes.

                  discuss.python.org/t/python-3-

                  Two snakes enjoying a pie with 3.14 on the top and π crimping.

                  Alt...Two snakes enjoying a pie with 3.14 on the top and π crimping.

                    [?]Hugo van Kemenade » 🌐
                    @hugovk@mastodon.social

                    Just released! 🚀

                    Python Docs Sphinx Theme

                    This is the theme for the Python documentation (and others)

                    * Add support for green, red and yellow side borders for code examples
                    * Add Portuguese translation
                    * Add support for Python 3.15

                    github.com/python/python-docs-

                    Light mode screenshot showing examples of "good code", with a green border on the left, and "bad code", with red.

                    Alt...Light mode screenshot showing examples of "good code", with a green border on the left, and "bad code", with red.

                    Same but for dark mode.

                    Alt...Same but for dark mode.

                      [?]Hugo van Kemenade » 🌐
                      @hugovk@mastodon.social

                      Just released! 🚀

                      🐍 Python 3.15 alpha 3!

                      discuss.python.org/t/python-3-

                      🔬 PEP 799: A new high-frequency statistical sampling profiler and dedicated profiling package
                      💬 PEP 686: Python now uses UTF-8 as the default encoding
                      🌊 PEP 782: A new PyBytesWriter C API to create a Python bytes object
                      🎨 Colour code snippets in argparse help: bsky.app/profile/savannah.dev/
                      ⚠️ Better error messages

                        [?]Hugo van Kemenade » 🌐
                        @hugovk@mastodon.social

                        Just released! 🚀

                        🤖 Humanize 4.15.0

                        This does stuff like turning a number into a fuzzy human-readable duration ("3 minutes ago")

                        github.com/python-humanize/hum

                        * Add locale support for decimal separator in `intword`
                        * Add support for Python 3.15
                        * `naturaldelta`: round the value to nearest unit that makes sense
                        * Fix plural form for `intword` and improve performance
                        * Replace `Exception` with more specific `FileNotFoundError`
                        * Replace pre-commit with prek

                          [?]Hugo van Kemenade » 🌐
                          @hugovk@mastodon.social

                          Just released! 🚀

                          stravavis 0.6.0: create visualisations of Strava activities

                          * add option to select visualisations/allow --bbox as file/support 3.13-3.14/drop 3.9

                          github.com/marcusvolz/strava_p

                          termcolor 3.3.0: ANSI formatting for the terminal

                          * add italic/fix error handling

                          github.com/termcolor/termcolor

                          pylast 7.0.1: A Python interface to Last.fm

                          * fix type hints

                          github.com/pylast/pylast/relea

                          Monochrome heatmap showing lots of Strava activities around greater Helsinki.

                          Alt...Monochrome heatmap showing lots of Strava activities around greater Helsinki.

                            [?]Hugo van Kemenade » 🌐
                            @hugovk@mastodon.social

                            Just released! 🚀

                            pypistats 1.12.0

                            CLI for PyPI download stats

                            support 3.15
                            drop 3.9
                            improve verbose output
                            declare type hints
                            replace dateutil+six dependencies with stdlib
                            replace httpx with urllib
                            replace pre-commit with prek

                            github.com/hugovk/pypistats/re

                              [?]Hugo van Kemenade » 🌐
                              @hugovk@mastodon.social

                              Just released! 🚀

                              norwegianblue 0.24.0

                              CLI to show end-of-life dates

                              show spinner when querying
                              support 3.15
                              replace dateutil+six dependencies with stdlib
                              replace httpx with urllib3
                              replace pre-commit with prek

                              github.com/hugovk/norwegianblu

                                [?]Hugo van Kemenade » 🌐
                                @hugovk@mastodon.social

                                🐍🚀 Out now: Python 3.15 beta 1!

                                🧊 This is the feature freeze, and now it's *your* turn to test out all the amazing things we've been baking for the past 12 months!

                                💤 Lazy imports!
                                🧊 frozendict builtin!
                                💂 sentinel builtin!
                                📉 Tachyon profiler!
                                🖼️ Frame pointers everywhere!
                                🧳 Unpacking in comprehensions!
                                8️⃣ UTF-8 default encoding!
                                🆕 Startup config files!
                                ⌨️ Loadsa typing!
                                🎨 More colour!

                                discuss.python.org/t/python-3-

                                Please report bugs, we'll fix for the big October release.

                                  [?]Hugo van Kemenade » 🌐
                                  @hugovk@mastodon.social

                                  🐍🚀 Out now: Python 3.14.5 final!

                                  ♻️ This now has the new (old) garbage collector, and the official macOS installer has been updated to use Tcl/Tk 9.0.3 instead of 8.6.17.

                                  discuss.python.org/t/python-3-

                                    [?]Dr. Juande Santander-Vela » 🌐
                                    @juandesant@mathstodon.xyz

                                    Today I (Re-)Learned about the `sep` and `end` parameters to Python’s `print`.

                                    `end=‘’` is useful to allow `print`statements not to add a newline. But you can also use it to add something else instead. That makes more sense if you also consider that…

                                    `sep=` allows you to have a separator. For instance, you can print a list vertically with `sep=‘\n’`:

                                    `print(*range(1,10), sep=‘\n’, end=‘’)`

                                    The `*` before `range` expands the content of `range` into multiple arguments to `print`.

                                    And a couple more parameters whose defaults are often OK, but also is good to know about:

                                    `flush` défaults to `False`, but using `print(flush=True)` can help get quicker output from a Python script before waiting for automatic flushing of standard out.

                                    And `file` defaults to `sys.stdout`, but you might want to use something like `print(“Error or debug info”,file=sys.stderr)` to print to the standard error stream, so that if you pipe stdout somewhere else, you still get the stderr messages (or redirect them separately). Of course, you can also have that file-like object passed from elsewhere.

                                      [?]Trey Hunner 🐍 » 🌐
                                      @treyhunner@mastodon.social

                                      Python Tip #271 (of 365):

                                      Return, don't print.

                                      If your function only seems to "work" in the REPL, it may be printing when it should be RETURNING.

                                      The print function "outputs" to the TERMINAL.

                                      The return statement "outputs" to the code that called your function.

                                      The Python REPL blurs this distinction by printing every non-None return value:

                                      >>> nth_fibonacci(20)
                                      6765

                                      Was that printed, or returned? It's unclear.

                                      🧵 (1/3)

                                        [?]Adam Johnson :django: :python: » 🌐
                                        @adamchainz@fosstodon.org

                                        📣 Join me on Thursday, 8th October, in Lisbon for a small software engineering meetup!

                                        Looking forward to meeting more folks out there.

                                        adamj.eu/tech/2026/09/28/pytho

                                          [?]Trey Hunner 🐍 » 🌐
                                          @treyhunner@mastodon.social

                                          “It has nothing to do with binary numbers or ones and zeroes.”

                                          Read more 👉 pym.dev/binary-search/

                                            FoxMaSk 🌵 boosted

                                            [?]Julien Palard » 🌐
                                            @mdk@mamot.fr

                                            Je distribue 8 places gratuites¹ pour la 2026 à Barritz, partage pour tenter ta chance !

                                            ¹ : En fait la PyConFR c’est gratuit, j’peux même pas jouer avec ces stratagèmes débiles de 1ère année en école de commerce, mais tu peux partager quand même ?

                                              [?]Laurent Cheylus » 🌐
                                              @lcheylus@bsd.network

                                              After all, a recent version of Ruff (fast Python linter written in Rust) imported in Debian unstable repository tracker.debian.org/pkg/ruff

                                                [?]Hugo van Kemenade » 🌐
                                                @hugovk@mastodon.social

                                                What's New in Python 3.15:

                                                🌊 wave 🌊

                                                * Added support for IEEE floating-point WAVE audio (WAVE_FORMAT_IEEE_FLOAT) in wave.

                                                * Added Wave_read.getformat(), Wave_write.getformat(), and Wave_write.setformat() for explicit frame format handling.

                                                * Wave_write.setparams() accepts both 7-item tuples including format and 6-item tuples for backwards compatibility (defaulting to WAVE_FORMAT_PCM).

                                                docs.python.org/3.15/whatsnew/

                                                  [?]DjangoCon Europe » 🌐
                                                  @djangoconeurope@fosstodon.org

                                                  Why Innsbruck? 🏔️
                                                  Because a DjangoCon should come with a pretty great backdrop.

                                                  ✨ A beautiful historic city
                                                  🏔️ The Alps right outside your door
                                                  🚋 Easy to get around
                                                  ☕ Plenty of places to meet, chat and recharge
                                                  💻 And, of course, a whole community of Django people coming together

                                                  Ready to discover Innsbruck with us?

                                                    [?]Trey Hunner 🐍 » 🌐
                                                    @treyhunner@mastodon.social

                                                    Python Tip #270 (of 365):

                                                    Move and copy files with pathlib.

                                                    In Python 3.14, Path objects gained move and copy methods, and copy works on whole directories:

                                                    >>> from pathlib import Path
                                                    >>> taxes = Path("taxes")
                                                    >>> taxes.copy("taxes-backup")
                                                    PosixPath('taxes-backup')

                                                    🧵 (1/3)

                                                      [?]Trey Hunner 🐍 » 🌐
                                                      @treyhunner@mastodon.social

                                                      “The reproducibility of pseudorandom numbers is useful for automated tests and for debugging.”

                                                      Read more 👉 pym.dev/random-numbers/

                                                        [?]Hugo van Kemenade » 🌐
                                                        @hugovk@mastodon.social

                                                        Make sure to compile your wheel dependencies with -O2 to get 2-3x speedup for free! 🚀

                                                        multibuild's defaults now also include -O2, so if you use that, update.

                                                        github.com/python-pillow/Pillo

                                                        JPEG2000 lossy save      main  2189.4 ms   pr   981.3 ms   2.23x
JPEG2000 lossy load      main   267.5 ms   pr    83.1 ms   3.22x
JPEG2000 lossless save   main  2168.4 ms   pr   970.6 ms   2.23x
JPEG2000 lossless load   main  2280.2 ms   pr   879.9 ms   2.59x
PNG save                 main   140.2 ms   pr   140.5 ms   1.00x
PNG load                 main    34.6 ms   pr    34.9 ms   0.99x
JPEG save                main    10.5 ms   pr    10.2 ms   1.03x
JPEG load                main    16.7 ms   pr    16.6 ms   1.01x
TIFF deflate save        main    93.7 ms   pr    95.0 ms   0.99x
TIFF deflate load        main    26.0 ms   pr    26.0 ms   1.00x
TIFF lzw save            main   104.3 ms   pr    49.1 ms   2.12x
TIFF lzw load            main    30.8 ms   pr    13.3 ms   2.32x
WebP save                main   318.5 ms   pr   323.7 ms   0.98x
WebP load                main    77.9 ms   pr    78.0 ms   1.00x
AVIF save                main   317.4 ms   pr   293.1 ms   1.08x
AVIF load                main    14.4 ms   pr    13.8 ms   1.04x
FreeType text            main   216.6 ms   pr    64.6 ms   3.35x
LittleCMS transform      main   148.0 ms   pr    47.2 ms   3.14x

                                                        Alt...JPEG2000 lossy save main 2189.4 ms pr 981.3 ms 2.23x JPEG2000 lossy load main 267.5 ms pr 83.1 ms 3.22x JPEG2000 lossless save main 2168.4 ms pr 970.6 ms 2.23x JPEG2000 lossless load main 2280.2 ms pr 879.9 ms 2.59x PNG save main 140.2 ms pr 140.5 ms 1.00x PNG load main 34.6 ms pr 34.9 ms 0.99x JPEG save main 10.5 ms pr 10.2 ms 1.03x JPEG load main 16.7 ms pr 16.6 ms 1.01x TIFF deflate save main 93.7 ms pr 95.0 ms 0.99x TIFF deflate load main 26.0 ms pr 26.0 ms 1.00x TIFF lzw save main 104.3 ms pr 49.1 ms 2.12x TIFF lzw load main 30.8 ms pr 13.3 ms 2.32x WebP save main 318.5 ms pr 323.7 ms 0.98x WebP load main 77.9 ms pr 78.0 ms 1.00x AVIF save main 317.4 ms pr 293.1 ms 1.08x AVIF load main 14.4 ms pr 13.8 ms 1.04x FreeType text main 216.6 ms pr 64.6 ms 3.35x LittleCMS transform main 148.0 ms pr 47.2 ms 3.14x

                                                          [?]Hynek Schlawack » 🌐
                                                          @hynek@mastodon.social

                                                          @carlton @djangomed @judy2k I’m glad a) there are still people caring about new packages and b) see the to-me obvious value in this. Lots of empty stares. 😅

                                                            [?]Hugo van Kemenade » 🌐
                                                            @hugovk@mastodon.social

                                                            What's New in Python 3.15:

                                                            unicodedata

                                                            * Unicode database updated to v17

                                                            * New iter_graphemes() iterates over grapheme clusters (UAX #29); grapheme_cluster_break(), indic_conjunct_break() & extended_pictographic() give character properties

                                                            * New isxidstart()/isxidcontinue() check UAX #31 identifier characters

                                                            * New block() returns a character's Unicode block

                                                            (Contributed by @stanfromireland, Serhiy Storchaka & Guillaume Sanchez)

                                                            docs.python.org/3.15/whatsnew/

                                                              [?]Trey Hunner 🐍 » 🌐
                                                              @treyhunner@mastodon.social

                                                              Python Tip #269 (of 365):

                                                              Walk directory trees with Path.walk.

                                                              The walk method (Python 3.12+) is the pathlib version of os.walk:

                                                              >>> taxes = Path("taxes")
                                                              >>> for directory, sub_directories, files in taxes.walk():
                                                              ... print(directory, sub_directories, files)
                                                              ...
                                                              taxes ['archived', '2026'] []
                                                              taxes/archived ['2017'] []
                                                              taxes/archived/2017 ['invoices'] []
                                                              taxes/archived/2017/invoices [] ['soylent.pdf']
                                                              taxes/2026 [] ['expenses.csv', 'dividends.csv']

                                                              🧵 (1/3)

                                                                [?]Hugo van Kemenade » 🌐
                                                                @hugovk@mastodon.social

                                                                What's New in Python 3.15:

                                                                collections

                                                                * Added collections.Counter.__xor__() and collections.Counter.__ixor__() to compute the symmetric difference between Counter objects. (Contributed by Raymond Hettinger.)

                                                                docs.python.org/3.15/whatsnew/

                                                                mastodon.social/tags/WhatsNew

                                                                  [?]Trey Hunner 🐍 » 🌐
                                                                  @treyhunner@mastodon.social

                                                                  “When exactly parentheses improve readability is a bit fuzzy and it's definitely subjective.”

                                                                  Read more 👉 pym.dev/unnecessary-parenthese

                                                                    [?]Trey Hunner 🐍 » 🌐
                                                                    @treyhunner@mastodon.social

                                                                    Python Tip #268 (of 365):

                                                                    Show relative paths with relative_to.

                                                                    Absolute paths are noisy:

                                                                    >>> print(path)
                                                                    /home/trey/taxes/archived/2017/invoices
                                                                    >>> taxes
                                                                    PosixPath('/home/trey/taxes')
                                                                    >>> print(path.relative_to(taxes))
                                                                    archived/2017/invoices

                                                                    🧵 (1/3)

                                                                      [?]Django News » 🤖 🌐
                                                                      @djangonews@mastodon.social

                                                                      [?]Alexandre B A Villares ☔🐍 » 🌐
                                                                      @villares@ciberlandia.pt

                                                                      If you want to work with typography in 3D, you can try out these "Fab four" libraries: , , & :D

                                                                      abav.lugaralgum.com/selected-w

                                                                      A purple slab with the following text in a stencil font as holes:
numpy,
shapely,
trimesh,
& py5

                                                                      Alt...A purple slab with the following text in a stencil font as holes: numpy, shapely, trimesh, & py5

                                                                        [?]codingjoe :django: :python: » 🌐
                                                                        @codingjoe@fosstodon.org

                                                                        [?]Trey Hunner 🐍 » 🌐
                                                                        @treyhunner@mastodon.social

                                                                        “A queue is often called a FIFO data structure: first in, first out.”

                                                                        Read more 👉 pym.dev/stacks-and-queues/

                                                                          [?]Graham Dumpleton » 🌐
                                                                          @grahamdumpleton@mastodon.social

                                                                          New post: A master class in decorators, patching and tracing.

                                                                          Seventy free, hands-on workshops. Start with decorators using only the Python standard library, move on to decorators, monkey patching and object proxies with wrapt, then finish with patching, testing and tracing using wrapture.

                                                                          Run them on Binder, in Codespaces, or in your browser. Nothing to install.

                                                                          grahamdumpleton.me/posts/2026/

                                                                            [?]Trey Hunner 🐍 » 🌐
                                                                            @treyhunner@mastodon.social

                                                                            “If an object quacks like a duck, it may be used as if it's a duck.”

                                                                            Read more 👉 pym.dev/all-iteration-is-the-s

                                                                              [?]Trey Hunner 🐍 » 🌐
                                                                              @treyhunner@mastodon.social

                                                                              Python Tip #267 (of 365):

                                                                              Change file extensions with with_suffix.

                                                                              A ".rst" file path that needs to turn into a ".md" file path:

                                                                              >>> from pathlib import Path
                                                                              >>> old_path = Path("/home/trey/projects/uvrs/readme.rst")
                                                                              >>> old_path.with_suffix(".md")
                                                                              PosixPath('/home/trey/projects/uvrs/readme.md')

                                                                              🧵 (1/4)

                                                                                Mas Tigre boosted

                                                                                [?]Mark Dominus » 🌐
                                                                                @mjd@mathstodon.xyz

                                                                                I'm looking for work, please boost!

                                                                                I'm a software engineer with 35 years of experience. I've worked across an unusually wide range of domains: mobile game backends, privacy-preserving data platforms, high-throughput COVID testing infrastructure, email and account systems, e-payment processing, job marketplace systems, and bioinformatics. I pick up new domains quickly and have a history of doing it repeatedly. I understand how to turn business needs into engineering requirements.

                                                                                I prefer to work remotely but I am open to an in-office job in the Philadelphia area or especially in Philadelphia itself. I've often worked remotely since the 1990s and can operate with minimal supervision. Several of my favorite projects were self-directed: I identified the need, built the thing, and shipped it. My preferred time zone is America/New_York, but I'm flexible.

                                                                                Some of the many, many technologies I've used are: Python, Perl, TypeScript/JavaScript, Haskell, Go, C, Java. Postgres, MySQL, SQLite. Flask, SQLAlchemy. AWS (Lambda, S3, RDS, SQS, EC2). Docker, Git. Github and Gitlab.

                                                                                I've also repeatedly picked up new languages and stacks as needed: Haskell for differential privacy research, TypeScript for a 24/7 AWS Lambda system, Flask for my most recent employer. I've become productive with new systems over and over, and I can do it quickly.

                                                                                I'm a published author (Higher-Order Perl, Morgan Kaufmann), longtime blogger, and conference speaker with a reputation for making complex ideas clear.

                                                                                I am a U.S. citizen.

                                                                                My résumé is at https://
                                                                                plover.com/~mjd/cv/Mark%20Jason%20Dominus.pdf

                                                                                mjd@pobox.com

                                                                                Thanks!



                                                                                  [?]codingjoe :django: :python: » 🌐
                                                                                  @codingjoe@fosstodon.org

                                                                                  Thanks to all the busy bees at DEP0021 is coming to secure your Django supply chain: github.com/codingjoe/deps/blob

                                                                                  Special thanks to @mdn for working providing excellent community documentation on SRI.

                                                                                    [?]Hugo van Kemenade » 🌐
                                                                                    @hugovk@mastodon.social

                                                                                    What's New in Python 3.15:

                                                                                    unittest

                                                                                    * unittest.TestCase.assertLogs() will now accept a formatter to control how messages are formatted. (Contributed by Garry Cairns.)

                                                                                    * unittest.TestCase.assertWarns() and unittest.TestCase.assertWarnsRegex() no longer swallow warnings that do not match the specified category or regex. Nested context managers are now supported. (Contributed by Serhiy Storchaka.)

                                                                                    docs.python.org/3.15/whatsnew/

                                                                                      [?]Trey Hunner 🐍 » 🌐
                                                                                      @treyhunner@mastodon.social

                                                                                      Keep in mind that because the loops in a comprehension must be in the same order as equivalent for loops, it does read a little funny.

                                                                                      Read more 👉 trey.io/aeo9fg

                                                                                        Bite Code! boosted

                                                                                        [?]Trey Hunner 🐍 » 🌐
                                                                                        @treyhunner@mastodon.social

                                                                                        Python Tip #266 (of 365):

                                                                                        Reread a file with seek(0).

                                                                                        Try to .read() a file twice, and you'll get nothing the second time:

                                                                                        >>> f = open("my_file.txt")
                                                                                        >>> f‍.read()
                                                                                        'This is my file 👋\nThis is line 2\n'
                                                                                        >>> f‍.read()
                                                                                        ''

                                                                                        Python keeps track of your position within a file as you read.

                                                                                        When you're at the end, another read returns an empty string.

                                                                                        The seek method changes that position.

                                                                                        🧵 (1/2)

                                                                                          [?]Hugo van Kemenade » 🌐
                                                                                          @hugovk@mastodon.social

                                                                                          What's New in Python 3.15:

                                                                                          pdb

                                                                                          * Use the new interactive shell as the default input shell for pdb. (Contributed by Tian Gao.)

                                                                                          docs.python.org/3.15/whatsnew/

                                                                                            Wolf boosted

                                                                                            [?]🍂 David Zaslavsky 🍂 » 🌐
                                                                                            @diazona@techhub.social

                                                                                            @dolanor No, it's still pip if you want to use pip. Or conda if you want to use conda. But there are other options for people who have a reason to use them or just prefer something different.

                                                                                            If anyone is telling you that you shouldn't be using pip (or, I imagine, conda) anymore, that it's deprecated or disfavored or obsolete or "on its way out" or anything of that nature, they don't know what they're talking about and you shouldn't listen.

                                                                                              [?]Jannis Leidel » 🌐
                                                                                              @jezdez@publicidentity.net

                                                                                              Seems like there's a heightened number of PyPI CDN Edge Errors at the moment, and the PyPI web UI is failing at login and search for me.

                                                                                              status.python.org/#system-metr

                                                                                                [?]Trey Hunner 🐍 » 🌐
                                                                                                @treyhunner@mastodon.social

                                                                                                “For true randomness, you can use the secrets module, which generates cryptographically secure random numbers.”

                                                                                                Read more 👉 pym.dev/random-numbers/

                                                                                                  [?]Paolo Melchiorre » 🌐
                                                                                                  @paulox@fosstodon.org

                                                                                                  Tonight we had dinner together with members of @pescara and @djangomed participants who just arrived in Pescara 🍕

                                                                                                  A nice way to meet up over dinner by the beach, catching up with old friends and meeting new ones. 🍻

                                                                                                  And now we’re ready: Django on the Med 2026 starts tomorrow morning! 🏖️

                                                                                                  People having dinner

                                                                                                  Alt...People having dinner

                                                                                                  People having a drink

                                                                                                  Alt...People having a drink

                                                                                                    [?]Django » 🌐
                                                                                                    @django@fosstodon.org

                                                                                                    📅 Applications close at the end of Tuesday (**today**), September 22, 2026, anywhere on Earth (AoE).

                                                                                                    Want to be our first Django Software Foundation Executive Director and lead our foundation? It's your last call to apply!

                                                                                                    djangoproject.com/weblog/2026/

                                                                                                      [?]Hugo van Kemenade » 🌐
                                                                                                      @hugovk@mastodon.social

                                                                                                      One week until Python 3.15.0 final!!
                                                                                                      hugovk.dev/next-release/

                                                                                                      What are you most looking forward to?
                                                                                                      docs.python.org/3.15/whatsnew/

                                                                                                        [?]Trey Hunner 🐍 » 🌐
                                                                                                        @treyhunner@mastodon.social

                                                                                                        Python Tip #265 (of 365):

                                                                                                        Use next() to get the first line in a file.

                                                                                                        Reading a CSV file and need to skip the first row of headers?

                                                                                                        Pass your file object (or csv.reader object) to the built-in next function:

                                                                                                        headers = next(reader)

                                                                                                        File objects keep track of your position within an open file, so the next time you read (or loop) you'll start up where you left off.

                                                                                                        🧵 (1/3)

                                                                                                          [?]Python Software Foundation » 🌐
                                                                                                          @ThePSF@fosstodon.org

                                                                                                          PSF Diversity & Inclusion Workgroup के Monthly Office Hours अगले हफ्ते PSF Discord पर! September 29th 1PM UTC को -diversity में जुड़ें। बातचीत करें, सवाल पूछें और Python में अपने projects, open source contributions या learning journey शेयर करें! 🐍🌍
                                                                                                          pyfound.blogspot.com/2026/07/t

                                                                                                            [?]Python Software Foundation » 🌐
                                                                                                            @ThePSF@fosstodon.org

                                                                                                            The PSF Diversity & Inclusion Workgroup monthly office hours are next week on the PSF Discord! Join us on September 29th 1PM UTC in -diversity to chat, ask questions, and share what you're working on 🐍🗺️
                                                                                                            pyfound.blogspot.com/2026/07/t

                                                                                                              [?]Hugo van Kemenade » 🌐
                                                                                                              @hugovk@mastodon.social

                                                                                                              And @akx has updated the Babel project's security policy in a similar way:

                                                                                                              github.com/python-babel/babel/

                                                                                                                [?]codingjoe :django: :python: » 🌐
                                                                                                                @codingjoe@fosstodon.org

                                                                                                                I had my little agent friend whip up a trust-me-bro for Django task frameworks.

                                                                                                                Happy to see my human coding skills are still worth something.

                                                                                                                github.com/codingjoe/threadmill

                                                                                                                Tasks per second with one worker: threadmill 4,989, celery 2,363, django-tasks-db 2,179, django-tasks-redis 1,712.

                                                                                                                Alt...Tasks per second with one worker: threadmill 4,989, celery 2,363, django-tasks-db 2,179, django-tasks-redis 1,712.

                                                                                                                  [?]Trey Hunner 🐍 » 🌐
                                                                                                                  @treyhunner@mastodon.social

                                                                                                                  “To navigate block-by-block, you can use Ctrl+P to go to the previous block and Ctrl+N to go to the next block.”

                                                                                                                  Read more 👉 pym.dev/repl-features/

                                                                                                                    [?]Lobsters » 🤖 🌐
                                                                                                                    @lobsters@mastodon.social

                                                                                                                    The last mile of a long road: faster NumPy in the browser lobste.rs/s/zakub6
                                                                                                                    notebook.link/blog/the-last-mi

                                                                                                                      [?]Trey Hunner 🐍 » 🌐
                                                                                                                      @treyhunner@mastodon.social

                                                                                                                      Python Tip #264 (of 365):

                                                                                                                      Don't use the file readlines method.

                                                                                                                      Do this:
                                                                                                                      lines = list(file)

                                                                                                                      Not this:
                                                                                                                      lines = file.readlines()

                                                                                                                      Both give the same list of lines. So why prefer list?

                                                                                                                      Files are iterables of lines, and list(...) is THE way to say "loop over this iterable and store the results in a new list".

                                                                                                                      With file.readlines(), it's not as obvious that we're making a list.

                                                                                                                      🧵 (1/2)

                                                                                                                        [?]Paolo Melchiorre » 🌐
                                                                                                                        @paulox@fosstodon.org

                                                                                                                        RE: fosstodon.org/@mattip/11730281

                                                                                                                        Oh, welcome back PyPy 👋

                                                                                                                        PyPy 8.0.0 is out with Python 3.12 support, so it looks like Django can finally start testing against PyPy again.

                                                                                                                        code.djangoproject.com/ticket/

                                                                                                                          [?]Trey Hunner 🐍 » 🌐
                                                                                                                          @treyhunner@mastodon.social

                                                                                                                          Python Tip #260 (of 365):

                                                                                                                          Bookmark a date format cheat sheet.

                                                                                                                          Is "%M" month or minute? Is "%H" 12 or 24 hour time? Which one shows a long month name? And a short one?

                                                                                                                          You COULD memorize all of Python's many date/time format codes, but is that worth it?

                                                                                                                          It might be worth memorizing the formats you use all the time ("%Y-%m-%d" and "%H:%M:%S" maybe).

                                                                                                                          But for MOST formats, you can look them up when you need them.

                                                                                                                          🧵 (1/3)

                                                                                                                            🗳

                                                                                                                            [?]Trey Hunner 🐍 » 🌐
                                                                                                                            @treyhunner@mastodon.social

                                                                                                                            What do you call __these__ in ?

                                                                                                                            magic methods:6
                                                                                                                            special methods:0
                                                                                                                            dunder methods:61
                                                                                                                            show results:1

                                                                                                                            Closed

                                                                                                                              [?]Trey Hunner 🐍 » 🌐
                                                                                                                              @treyhunner@mastodon.social

                                                                                                                              Python Tip #263 (of 365):

                                                                                                                              Parse messy dates with the third-party dateutil library.

                                                                                                                              Its parse function guesses the format from the string itself:

                                                                                                                              >>> from dateutil.parser import parse
                                                                                                                              >>> parse("September 20, 2026")
                                                                                                                              datetime.datetime(2026, 9, 20, 0, 0)
                                                                                                                              >>> parse("20 Sep 2026 14:30")
                                                                                                                              datetime.datetime(2026, 9, 20, 14, 30)
                                                                                                                              >>> parse("9/20/26")
                                                                                                                              datetime.datetime(2026, 9, 20, 0, 0)

                                                                                                                              dateutil.readthedocs.io

                                                                                                                              🧵 (1/4)

                                                                                                                                [?]Jeff Triplett » 🌐
                                                                                                                                @webology@mastodon.social

                                                                                                                                I woke up to find my PR merged and deployed, giving python.org/blogs/ a fresh take and fixing the "Latest News" section on the homepage.

                                                                                                                                It was confusingly linking to Python Insider's homepage, even though it was only one of several data sources.

                                                                                                                                We were also only showing the latest five posts. Six if we include the top header, and I'd like to fix the spacing.

                                                                                                                                github.com/python/pythondotorg

                                                                                                                                Thank you to everyone involved.

                                                                                                                                  [?]Adam Johnson :django: :python: » 🌐
                                                                                                                                  @adamchainz@fosstodon.org

                                                                                                                                  🔧 I’m excited to host this optimization workshop in Lisbon next month.

                                                                                                                                  Come join me to learn about profiling and optimizing Python code, and maybe even contribute to Django itself.

                                                                                                                                  adamj.eu/tech/2026/09/19/pytho

                                                                                                                                    [?]Trey Hunner 🐍 » 🌐
                                                                                                                                    @treyhunner@mastodon.social

                                                                                                                                    “Pretty much every time I make a temporary file, I need to close the file without actually deleting it so that I can then pass the filename off to other code that actually uses the file.”

                                                                                                                                    Read more 👉 pym.dev/temporary-files/

                                                                                                                                      [?]Trey Hunner 🐍 » 🌐
                                                                                                                                      @treyhunner@mastodon.social

                                                                                                                                      Python Tip #262 (of 365):

                                                                                                                                      Parse dates with date.strptime.

                                                                                                                                      In Python 3.14+, the date class got its own strptime class method:

                                                                                                                                      >>> import datetime as dt
                                                                                                                                      >>> dt.date.strptime("2026-08-19", "%Y-%m-%d")
                                                                                                                                      datetime‍.date(2026, 8, 19)

                                                                                                                                      🧵 (1/2)

                                                                                                                                        [?]Hugo van Kemenade » 🌐
                                                                                                                                        @hugovk@mastodon.social

                                                                                                                                        @mdk Looks like 3.8 is also around 2%.

                                                                                                                                        And with 3.10's EOL next month, 3.11+ is around 75%.

                                                                                                                                          [?]Julien Palard » 🌐
                                                                                                                                          @mdk@mamot.fr

                                                                                                                                          Wow Python 3.7 qui tombe sous les 2 % d’utilisateurs :

                                                                                                                                          git.afpy.org/mdk/python-versio

                                                                                                                                          Oui oui c’est pas une faute de frappe, je parle bien de 3.7, pas 2.7.

                                                                                                                                          (3.12 a ~34% des utilisateurs)

                                                                                                                                            [?]Trey Hunner 🐍 » 🌐
                                                                                                                                            @treyhunner@mastodon.social

                                                                                                                                            “Of course, at some point in your Python coding journey, you will probably find some opportunities to make classes.”

                                                                                                                                            Read more 👉 pym.dev/friendly-classes/

                                                                                                                                              Lily boosted

                                                                                                                                              [?]Django News » 🤖 🌐
                                                                                                                                              @djangonews@mastodon.social

                                                                                                                                              📰 Issue 355: DjangoCon Europe 2027 in Innsbruck and Django Probe

                                                                                                                                              django-news.com/archive/issue-

                                                                                                                                                [?]Trey Hunner 🐍 » 🌐
                                                                                                                                                @treyhunner@mastodon.social

                                                                                                                                                Python Tip #261 (of 365):

                                                                                                                                                Use Python's zoneinfo module when working with time zones.

                                                                                                                                                >>> from zoneinfo import ZoneInfo
                                                                                                                                                >>> pacific = ZoneInfo("America/Los_Angeles")
                                                                                                                                                >>> meeting = datetime(2027, 3, 13, 9, 0, tzinfo=pacific)
                                                                                                                                                >>> print(meeting)
                                                                                                                                                2027-03-13 09:00:00-08:00

                                                                                                                                                🧵 (1/5)

                                                                                                                                                  Joachim boosted

                                                                                                                                                  [?]Bruno Bord [he/him] » 🌐
                                                                                                                                                  @brunobord@dice.camp

                                                                                                                                                  [?]Hugo van Kemenade » 🌐
                                                                                                                                                  @hugovk@mastodon.social

                                                                                                                                                  We've updated our security policy on how to report vulnerabilities:

                                                                                                                                                  github.com/python-pillow/Pillo

                                                                                                                                                  Much of this based on the good stuff in the CPython security policy:

                                                                                                                                                  devguide.python.org/security/p

                                                                                                                                                  Yesterday's 82 reports totalled 226,620 words (144,437 without code), an average of 2,764 each (1,761 without code).

                                                                                                                                                  Moby Dick is 212,796 words (A Tale of Two Cities is 135,886 words).

                                                                                                                                                  I've asked the reporter to re-run their tools and update/close as necessary.

                                                                                                                                                    [?]Hugo van Kemenade » 🌐
                                                                                                                                                    @hugovk@mastodon.social

                                                                                                                                                    What's New in Python 3.15:

                                                                                                                                                    os

                                                                                                                                                    * Add os.statx() on Linux kernel versions 4.11 and later with glibc versions 2.28 and later. (Contributed by Jeffrey Bosboom and @vstinner)

                                                                                                                                                    * os.makedirs() function now has a parent_mode parameter that allows specifying the mode for intermediate directories. This can be used to match the behavior from Python 3.6 and earlier by passing parent_mode=mode. (Contributed by Zackery Spytz and @gpshead)

                                                                                                                                                    docs.python.org/3.15/whatsnew/

                                                                                                                                                      [?]Graham Dumpleton » 🌐
                                                                                                                                                      @grahamdumpleton@mastodon.social

                                                                                                                                                      New post: Writing a workshop for JupyterLab.

                                                                                                                                                      The second post on jupyterlab-workshop builds a small pytest workshop from nothing, covering the manifest, pages, actions that run commands and write files for the learner, checks that gate progress until the work is done, giving the workshop a Python environment of its own, and the lint and self-test that catch problems before a learner does.

                                                                                                                                                      grahamdumpleton.me/posts/2026/

                                                                                                                                                        [?]Trey Hunner 🐍 » 🌐
                                                                                                                                                        @treyhunner@mastodon.social

                                                                                                                                                        “Note that the utilities in Python's random module generate pseudorandom numbers, not true random numbers.”

                                                                                                                                                        Read more 👉 pym.dev/random-numbers/

                                                                                                                                                          [?]Mariatta 🤦🏻‍♀️ :python: » 🌐
                                                                                                                                                          @mariatta@fosstodon.org

                                                                                                                                                          The PyLadiesCon web portal was spammed. 2,249 fake accounts created. Four months before anybody noticed. My write up and reflection about this incident.

                                                                                                                                                          mariatta.ca/posts/pyladiescon-

                                                                                                                                                            [?]Paolo Melchiorre » 🌐
                                                                                                                                                            @paulox@fosstodon.org

                                                                                                                                                            @webology @JessicaTegner when I read grok I think about this old but active Python project I heard about for the first time long time ago from @faassen 🧌
                                                                                                                                                            pypi.org/project/grok/

                                                                                                                                                              [?]Jeff Triplett » 🌐
                                                                                                                                                              @webology@mastodon.social

                                                                                                                                                              ✨ I plan to do a proper write-up, but @django new sponsor pages are up and highlight plans in a much easier-to-grok format. djangoproject.com/sponsor/

                                                                                                                                                              Shout-out to @ericholscher for driving this and pulling it all together.

                                                                                                                                                              @nessita for helping to prioritize it and the last mile.

                                                                                                                                                              Also, to our Fundraising WG (present and past) members for working on the prospectus for over a year to give us data and features to work with.

                                                                                                                                                              cc @priyapahwa @afimaame @ryanhiebert

                                                                                                                                                                [?]Hugo van Kemenade » 🌐
                                                                                                                                                                @hugovk@mastodon.social

                                                                                                                                                                Two weeks until Python 3.15.0 final!
                                                                                                                                                                hugovk.dev/next-release/

                                                                                                                                                                  [?]Trey Hunner 🐍 » 🌐
                                                                                                                                                                  @treyhunner@mastodon.social

                                                                                                                                                                  Want to test your knowledge of datetime formatting, parsing, and arithmetic in ?

                                                                                                                                                                  I just made a 17-question quiz for you: pym.dev/quiz/datetime

                                                                                                                                                                  A warning: it's a bit tricky, even for an experienced Python developer... partly because it DOES test your knowledge of various format codes that I wouldn't usually memorize.

                                                                                                                                                                  If you want to get practice with the questions you get wrong afterward, you can find 3 free datetime Daily Recall packs linked at the end of the quiz.

                                                                                                                                                                  🧵 (3/3)

                                                                                                                                                                    [?]Trey Hunner 🐍 » 🌐
                                                                                                                                                                    @treyhunner@mastodon.social

                                                                                                                                                                    Python Tip #260 (of 365):

                                                                                                                                                                    Bookmark a date format cheat sheet.

                                                                                                                                                                    Is "%M" month or minute? Is "%H" 12 or 24 hour time? Which one shows a long month name? And a short one?

                                                                                                                                                                    You COULD memorize all of Python's many date/time format codes, but is that worth it?

                                                                                                                                                                    It might be worth memorizing the formats you use all the time ("%Y-%m-%d" and "%H:%M:%S" maybe).

                                                                                                                                                                    But for MOST formats, you can look them up when you need them.

                                                                                                                                                                    🧵 (1/3)

                                                                                                                                                                      [?]Hugo van Kemenade » 🌐
                                                                                                                                                                      @hugovk@mastodon.social

                                                                                                                                                                      @treyhunner What do you think of this idea from @bswck?

                                                                                                                                                                      When you paste code into the REPL, it'll strip any `>>>` / `...`/ output you'd inadvertently copied.

                                                                                                                                                                      Could be useful for learners?

                                                                                                                                                                      github.com/python/cpython/issu

                                                                                                                                                                        [?]pvergain (framapiaf) » 🌐
                                                                                                                                                                        @pvergain@framapiaf.org

                                                                                                                                                                        [?]Python Software Foundation » 🌐
                                                                                                                                                                        @ThePSF@fosstodon.org

                                                                                                                                                                        The PSF is excited to announce the results of the 2026 election for the PSF Board! Sending a big thank you to the candidates, our outgoing Board members, and our community for participating this year- we are so grateful to be in community with all of you 💙💛
                                                                                                                                                                        pyfound.blogspot.com/2026/09/a

                                                                                                                                                                          [?]Python Software Foundation » 🌐
                                                                                                                                                                          @ThePSF@fosstodon.org

                                                                                                                                                                          The PSF is pleased to announce the results of the inaugural election for the Python Packaging Council! Sending a big thank you to the candidates and our community for participating in this long awaited election. We're excited to see the council start its work!
                                                                                                                                                                          pyfound.blogspot.com/2026/09/a

                                                                                                                                                                            David Gerard boosted

                                                                                                                                                                            [?]@pndc » 🌐
                                                                                                                                                                            @pndc@social.treehouse.systems

                                                                                                                                                                            I'm a software developer and sysadmin who could really use being .

                                                                                                                                                                            What I'd really like to do is Rust, but once you ignore the dubious scammy stuff, there seems to be nothing out there. Prove me wrong with a counterexample!

                                                                                                                                                                            I've spent decades fixing Enterprise mudballs mostly written in . If you've got a crufty legacy system that everybody else is too scared to touch, I'm your man. I love fixing stuff like that.

                                                                                                                                                                            I've also done commercial , , /#C++, and although I don't usually admit it on my CV but these are now Trying Times when everything is on the table, even (the longest six months of my life).

                                                                                                                                                                            Perl naturally leads into Unix system administration and infrastructure. I've built and maintained mail clusters, VoIP systems, network monitoring, DNS management platforms, that sort of thing. If it's non-sexy but something which needs to be done, I'm there.

                                                                                                                                                                            Available immediately, for contract or permie, onsite in Amsterdam/Randstad or remote to anywhere.

                                                                                                                                                                            Drop me a private mention or mail peter@mooli.net if you have or know of something.

                                                                                                                                                                              [?]Trey Hunner 🐍 » 🌐
                                                                                                                                                                              @treyhunner@mastodon.social

                                                                                                                                                                              Python Tip #259 (of 365):

                                                                                                                                                                              Use datetime arithmetic and comparisons to check whether a date is within a range.

                                                                                                                                                                              Sputnik launched before the moon landing:

                                                                                                                                                                              >>> sputnik_launch = datetime(1957, 10, 4)
                                                                                                                                                                              >>> moon_landing = datetime(1969, 7, 20)
                                                                                                                                                                              >>> sputnik_launch < moon_landing
                                                                                                                                                                              True

                                                                                                                                                                              One datetime is "less than" another when it represents an earlier moment in time.

                                                                                                                                                                              🧵 (1/3)

                                                                                                                                                                                [?]Graham Dumpleton » 🌐
                                                                                                                                                                                @grahamdumpleton@mastodon.social

                                                                                                                                                                                New blog post introducing jupyterlab-workshop, a JupyterLab extension I wrote for guided interactive workshops.

                                                                                                                                                                                Instructions sit in a side panel. Each step is a clickable action that does something real in the JupyterLab session beside it, and the workshop checks what you did before you move on. A workshop is a directory of Markdown files and runs wherever JupyterLab does: mybinder, Codespaces, and even JupyterLite in the browser.

                                                                                                                                                                                grahamdumpleton.me/posts/2026/

                                                                                                                                                                                  [?]Tim Schilling » 🌐
                                                                                                                                                                                  @CodenameTim@mastodon.social

                                                                                                                                                                                  Oohh, Daksh's Django Commons lightning talk from @europython is published 🥳

                                                                                                                                                                                  youtube.com/watch?v=cNkCy7a41x

                                                                                                                                                                                  If you're maintaining a or package and would like to make a community package, there's a home for you.

                                                                                                                                                                                    [?]Adam Johnson :django: :python: » 🌐
                                                                                                                                                                                    @adamchainz@fosstodon.org

                                                                                                                                                                                    🧪 I just released unittest-parametrize 1.9.0.

                                                                                                                                                                                    This package helps you make parametrized tests that work with the grain of unittest, but can still be run with pytest.

                                                                                                                                                                                    This release adds new skip/expected_failure features, fixes a bug when using Coverage.py's dynamic contexts, and tidies up error messages and usage docs.

                                                                                                                                                                                    github.com/adamchainz/unittest

                                                                                                                                                                                      [?]Trey Hunner 🐍 » 🌐
                                                                                                                                                                                      @treyhunner@mastodon.social

                                                                                                                                                                                      “The syntax for adding a new key-value pair to a dictionary is actually the same as the syntax for updating the value for an existing key.”

                                                                                                                                                                                      Read more 👉 pym.dev/using-dictionaries-in-

                                                                                                                                                                                        [?]Trey Hunner 🐍 » 🌐
                                                                                                                                                                                        @treyhunner@mastodon.social

                                                                                                                                                                                        “The last plate that's added to the top of the stack will be the first plate removed from the top of the stack.”

                                                                                                                                                                                        Read more 👉 pym.dev/stacks-and-queues/

                                                                                                                                                                                          [?]Trey Hunner 🐍 » 🌐
                                                                                                                                                                                          @treyhunner@mastodon.social

                                                                                                                                                                                          Python Tip #258 (of 365):

                                                                                                                                                                                          Format dates with f-strings.

                                                                                                                                                                                          datetime objects support the same format codes in f-string format specifiers that the strftime method uses:

                                                                                                                                                                                          >>> deadline = datetime(2046, 10, 31, 15, 46)
                                                                                                                                                                                          >>> f"{deadline:%m/%d/%Y %I:%M %p}"
                                                                                                                                                                                          '10/31/2046 03:46 PM'

                                                                                                                                                                                          🧵 (1/3)

                                                                                                                                                                                            [?]Trey Hunner 🐍 » 🌐
                                                                                                                                                                                            @treyhunner@mastodon.social

                                                                                                                                                                                            Strings in Python have a startswith method that will check whether a given string is a prefix of our string

                                                                                                                                                                                            Read more 👉 trey.io/dley4p

                                                                                                                                                                                              [?]Trey Hunner 🐍 » 🌐
                                                                                                                                                                                              @treyhunner@mastodon.social

                                                                                                                                                                                              Python Tip #257 (of 365):

                                                                                                                                                                                              Consider "import datetime as dt".

                                                                                                                                                                                              The fact that the datetime module and the datetime class are spelled the same way is VERY confusing.

                                                                                                                                                                                              You could use a "from" import:

                                                                                                                                                                                              from datetime import datetime

                                                                                                                                                                                              Now datetime means the class.

                                                                                                                                                                                              But if later on you also want the date class, you're importing that name too, and hoping no local date variable ever shadows it. I definitely use the variable name date, so this is a problem for me.

                                                                                                                                                                                              🧵 (1/3)

                                                                                                                                                                                                [?]Jeff Triplett » 🌐
                                                                                                                                                                                                @webology@mastodon.social

                                                                                                                                                                                                Hey devs,

                                                                                                                                                                                                Remember when Pillow took over PIL's space?

                                                                                                                                                                                                Do we have that for the requests + httpx + httpx2 space yet?

                                                                                                                                                                                                I have hit my point where having all three installed spark no joy for me.

                                                                                                                                                                                                I don't even care who wins or loses this package off, but I do not need all three installed, and I'll keep my personal preference to myself.

                                                                                                                                                                                                Thid party packages are very opinioned which is why I have all three. I do not want or need all three.

                                                                                                                                                                                                What's the solution?

                                                                                                                                                                                                  [?]PyData Helsinki » 🌐
                                                                                                                                                                                                  @pydata_helsinki@fosstodon.org

                                                                                                                                                                                                  The next is on Tuesday 22 September at Reaktor, Yliopistonkatu 4.

                                                                                                                                                                                                  We'll hear about building a super 8 film scanner at home, how to actually get an intuition for survival models, and what happens when you let a reinforcement learning agent loose on the Pokémon TCG. Plus a lightning talk, snacks, drinks and another round of the (in)famous PyData Helsinki quiz!

                                                                                                                                                                                                  Sign up now!

                                                                                                                                                                                                  pydata-helsinki.fi/events/2026

                                                                                                                                                                                                    [?]codingjoe :django: :python: » 🌐
                                                                                                                                                                                                    @codingjoe@fosstodon.org

                                                                                                                                                                                                    [?]Python Software Foundation » 🌐
                                                                                                                                                                                                    @ThePSF@fosstodon.org

                                                                                                                                                                                                    📣📣 ATTN PSF Voting Members: The 2026 PSF Board election vote closes tomorrow, September 15th- but don't wait, go vote today! If you affirmed your intention to vote in this year's election or voted last year, check your email for voting instructions 🗳️ pyfound.blogspot.com/2026/09/t

                                                                                                                                                                                                      [?]Hugo van Kemenade » 🌐
                                                                                                                                                                                                      @hugovk@mastodon.social

                                                                                                                                                                                                      We're deprecating and removing the IM ("IFUNC Image Memory") image format from @pillow. We're doing this with a two-year deprecation rather than the usual one-year.

                                                                                                                                                                                                      pillow.readthedocs.io/en/lates

                                                                                                                                                                                                      If you need it, please let us know! But unless you're calculating molecular sizes of DNA restriction fragments in Linköping, Sweden in the 1990s, probably not. 🐍🧬

                                                                                                                                                                                                      github.com/python-pillow/Pillo

                                                                                                                                                                                                      We may deprecate some of the other obscure plugins.

                                                                                                                                                                                                      github.com/python-pillow/Pillo

                                                                                                                                                                                                        [?]Trey Hunner 🐍 » 🌐
                                                                                                                                                                                                        @treyhunner@mastodon.social

                                                                                                                                                                                                        Python Tip #256 (of 365):

                                                                                                                                                                                                        Avoid circular imports by decoupling your modules.

                                                                                                                                                                                                        Two modules that import each other will break.

                                                                                                                                                                                                        In users.models:
                                                                                                                                                                                                        from .tasks import send_welcome_email

                                                                                                                                                                                                        And in users.tasks:
                                                                                                                                                                                                        from .models import User

                                                                                                                                                                                                        ImportError: cannot import name 'User' from partially initialized module 'users.models' (most likely due to a circular import)

                                                                                                                                                                                                        🧵 (1/3)

                                                                                                                                                                                                          [?]Graham Dumpleton » 🌐
                                                                                                                                                                                                          @grahamdumpleton@mastodon.social

                                                                                                                                                                                                          Are developer workshops still relevant when anyone can ask an AI? A write-up of my PyCon AU 2026 talk.

                                                                                                                                                                                                          Reading and doing are different things, and AI hasn't touched the doing. AI makes workshop content correct, but not teachable. And the self-serve end is the part under pressure, which raises the question of why I released 24 free wrapture workshops anyway.

                                                                                                                                                                                                          grahamdumpleton.me/posts/2026/

                                                                                                                                                                                                            [?]Trey Hunner 🐍 » 🌐
                                                                                                                                                                                                            @treyhunner@mastodon.social

                                                                                                                                                                                                            “That allows for the practice of goose typing, meaning practicing duck typing with the built-in isinstance function.”

                                                                                                                                                                                                            Read more 👉 pym.dev/goose-typing/

                                                                                                                                                                                                              [?]Hugo van Kemenade » 🌐
                                                                                                                                                                                                              @hugovk@mastodon.social

                                                                                                                                                                                                              What's New in Python 3.15:

                                                                                                                                                                                                              shelve

                                                                                                                                                                                                              * Added new reorganize() method to shelve used to recover unused free space previously occupied by deleted entries. (Contributed by Andrea Oliveri.)

                                                                                                                                                                                                              * Add support for custom serialization and deserialization functions in the shelve module. (Contributed by @furkanonder.bsky.social.)

                                                                                                                                                                                                              docs.python.org/3.15/whatsnew/

                                                                                                                                                                                                                [?]tlohde » 🌐
                                                                                                                                                                                                                @tlohde@fediscience.org

                                                                                                                                                                                                                I had an idea that was vaguely inspired by the s that the is fond of, and by @hyde posting a little snippet about how to export open browser tabs to a text file.

                                                                                                                                                                                                                I made a silly thing that didn't need making that logs and graphs how many open browser tabs I have.

                                                                                                                                                                                                                A tiny bit of , a little bit of and a cron job, and some

                                                                                                                                                                                                                tlohde.com/open-tabs/

                                                                                                                                                                                                                  AodeRelay boosted

                                                                                                                                                                                                                  [?]Oliver Zehentleitner » 🌐
                                                                                                                                                                                                                  @oliverzehentleitner@burningboard.net

                                                                                                                                                                                                                  I added `picows` support to the UNICORN Binance WebSocket API.

                                                                                                                                                                                                                  The benchmark started as a simple library comparison and ended up improving UBWA itself too.

                                                                                                                                                                                                                  Results:

                                                                                                                                                                                                                  ⚡ up to **2× throughput** on small Binance messages
                                                                                                                                                                                                                  🧠 about **26% lower average CPU usage**
                                                                                                                                                                                                                  📨 **138M+ live messages** per implementation
                                                                                                                                                                                                                  ✅ no picows-specific stalls or unrecoverable streams in the 24h soak

                                                                                                                                                                                                                  `websockets` still remains the default for now.

                                                                                                                                                                                                                  Why?

                                                                                                                                                                                                                  Because 24 hours and 138 million messages are strong evidence, but they are not the same as months of production use across many different systems.

                                                                                                                                                                                                                  So picows is opt-in until broader real-world usage proves it further.

                                                                                                                                                                                                                  Full benchmark, bugs found, proxy changes and reasoning:

                                                                                                                                                                                                                  blog.technopathy.club/picows-i

                                                                                                                                                                                                                  picows in UBWA

                                                                                                                                                                                                                  Alt...picows in UBWA

                                                                                                                                                                                                                    [?]Trey Hunner 🐍 » 🌐
                                                                                                                                                                                                                    @treyhunner@mastodon.social

                                                                                                                                                                                                                    Python Tip #255 (of 365):

                                                                                                                                                                                                                    Declare your public API with __all__.

                                                                                                                                                                                                                    from math import sqrt

                                                                                                                                                                                                                    __all__ = ["nth_lucas", "sum_of_squares"]

                                                                                                                                                                                                                    phi = (1+sqrt(5))/2

                                                                                                                                                                                                                    def nth_lucas(n):
                                                                                                                                                                                                                    return round(phi**n + (-1/phi)**n)

                                                                                                                                                                                                                    def sum_of_squares(*nums):
                                                                                                                                                                                                                    return sum(n**2 for n in nums)

                                                                                                                                                                                                                    🧵 (1/6)

                                                                                                                                                                                                                      [?]Trey Hunner 🐍 » 🌐
                                                                                                                                                                                                                      @treyhunner@mastodon.social

                                                                                                                                                                                                                      “If you find subprocess.run to be a little too verbose, you might consider writing a custom wrapper function or two for your own use cases.”

                                                                                                                                                                                                                      Read more 👉 pym.dev/running-subprocesses-i

                                                                                                                                                                                                                        [?]Paolo Melchiorre » 🌐
                                                                                                                                                                                                                        @paulox@fosstodon.org

                                                                                                                                                                                                                        I'm seeing more and more Oepn Source project migrating to Codeberg.

                                                                                                                                                                                                                        I missed the Python library gallery-dl migrated a few months ago github.com/mikf/gallery-dl/iss

                                                                                                                                                                                                                        I used it to download my pictures from conference repository (e.g. flickr) and it worked very well.

                                                                                                                                                                                                                          [?]Graham Dumpleton » 🌐
                                                                                                                                                                                                                          @grahamdumpleton@mastodon.social

                                                                                                                                                                                                                          wrapture is now at 1.0.0b1, along with the wrapture-instrumentation, aws, postgresql and mysql packages. I am happy with the APIs, so what it needs now is people trying it on real code and reporting what works and what doesn't.

                                                                                                                                                                                                                          New post rounds up the ten blog posts so far, the packages and docs, plus 24 hands-on workshops you can run in your browser on mybinder with nothing to install.

                                                                                                                                                                                                                          grahamdumpleton.me/posts/2026/

                                                                                                                                                                                                                            [?]Trey Hunner 🐍 » 🌐
                                                                                                                                                                                                                            @treyhunner@mastodon.social

                                                                                                                                                                                                                            Python Tip #254 (of 365):

                                                                                                                                                                                                                            Use a module instead of a singleton class.

                                                                                                                                                                                                                            When you import a module, Python creates a module object. Import it again (even under a different name) and you get THE EXACT SAME OBJECT:

                                                                                                                                                                                                                            >>> import events
                                                                                                                                                                                                                            >>> import events as again
                                                                                                                                                                                                                            >>> again is events
                                                                                                                                                                                                                            True

                                                                                                                                                                                                                            So instead of a class that's only ever meant to have one instance:

                                                                                                                                                                                                                            class EventTracker:
                                                                                                                                                                                                                            ...

                                                                                                                                                                                                                            tracker = EventTracker()

                                                                                                                                                                                                                            More: pym.dev/making-singletons/

                                                                                                                                                                                                                            🧵 (1/2)

                                                                                                                                                                                                                              [?]Trey Hunner 🐍 » 🌐
                                                                                                                                                                                                                              @treyhunner@mastodon.social

                                                                                                                                                                                                                              You mostly don't need to think about a function's enclosing scope or the think about the closure that it makes.

                                                                                                                                                                                                                              Read more 👉 trey.io/4u4pj0

                                                                                                                                                                                                                                Fred de CLX boosted

                                                                                                                                                                                                                                [?]Accueil - LinuxFr.org [Unofficial] » 🌐
                                                                                                                                                                                                                                @linuxfr.org@web.brid.gy

                                                                                                                                                                                                                                PyConFR 2026, planning et inscriptions

                                                                                                                                                                                                                                L'édition 2026 de la PyConFR aura lieu à Biarritz 🌊 le week-end de la Toussaint (du jeudi 29 octobre au dimanche 1er novembre) !

                                                                                                                                                                                                                                La PyConFR est la conférence annuelle francophone dédiée au langage de programmation Python 🐍 et à sa communauté, entièrement gratuite car organisée par les bénévoles de l'AFPy (Association Francophone Python) avec le soutien de sponsors (voir plus bas).

                                                                                                                                                                                                                                Présentation de l'événement

                                                                                                                                                                                                                                L'événement se déroule donc sur 4 jours en se divisant en deux parties :

                                                                                                                                                                                                                                • 💻 Les sprints ont lieu le jeudi (29/10) et le vendredi (30/10) : il s'agit de sessions participatives de code pour travailler en groupe sur des projets open-source.
                                                                                                                                                                                                                                • 🎤 Les conférences et ateliers ont lieu le samedi (31/10) et le dimanche (01/11) : ce sont des présentations sur divers sujets autour de la programmation en Python ou d'horizons plus larges et des ateliers de codage participatifs.

                                                                                                                                                                                                                                Vous trouverez plus d'informations sur la PyConFR sur le site de l'événement.

                                                                                                                                                                                                                                Inscriptions

                                                                                                                                                                                                                                La conférence est gratuite mais l'inscription reste obligatoire, afin de nous aider à prévoir le nombre de participant·e·s et d'adapter l'événement en fonction.

                                                                                                                                                                                                                                Lors de votre inscription, vous pourrez aussi choisir de commander un t-shirt de l'événement (15€) et une place pour la soirée du samedi qui aura lieu à la brasserie SPOT à proximité du lieu de conférence (30€).

                                                                                                                                                                                                                                Inscriptions à la PyConFR 2026

                                                                                                                                                                                                                                Programme de l'événement

                                                                                                                                                                                                                                Le programme des différents sprints, conférences et ateliers qui auront lieu pendant l'événement a été publié : https://www.pycon.fr/2026/fr/schedule.html.

                                                                                                                                                                                                                                Vous pourrez y retrouver les descriptions complètes des interventions ainsi que les biographies des orateurs et oratrices.

                                                                                                                                                                                                                                Les sujets sont majoritairement en français (l'association s'adresse principalement à la communauté francophone) mais une salle de conférence est réservée aux sujets en anglais pour notre public non-francophone.

                                                                                                                                                                                                                                Conférences plénières

                                                                                                                                                                                                                                L'association, dans le but d'augmenter la diversité de l'événement, fait tenir par des femmes les trois conférences plénières proposées pendant la PyConFR.

                                                                                                                                                                                                                                Les conférences plénières annoncées cette année sont :

                                                                                                                                                                                                                                • « Typographie et code : expérimentations pour la broderie et le tricot » par Amélie Dumont, designer graphique typographe.
                                                                                                                                                                                                                                • « Le mot esquive, l'instrument tranche : autonomie stratégique, souveraineté numérique et l'épreuve de la cyber » par Rayna Stamboliyska, fondatrice et CEO de RS Strategy.
                                                                                                                                                                                                                                • « Sustaining Open Source for the Future » par Georgi Ker, vice-présidente de la Python Software Foundation.

                                                                                                                                                                                                                                Embracing Weird Code, d’Ivana Kellyer
                                                                                                                                                                                                                                Le rêve de tout enfant - devenir DBA ?, de Karen Jex
                                                                                                                                                                                                                                Être un·e allié·e du numérique pour tou·te·s en environnement hostile, de Morgane Rozenn Hauguel

                                                                                                                                                                                                                                Sponsoring

                                                                                                                                                                                                                                L'événement existe grâce aux dons des sponsors qui permettent chaque année de couvrir les différentes dépenses liées à l'organisation (locaux, assurance, captation vidéo, boissons, bourses, etc.).

                                                                                                                                                                                                                                Si vous, votre entreprise ou l'un de vos contact souhaite participer au financement de cet événement, vous pouvez contacter le trésorier de l'AFPy (tresorier@afpy.org) pour discuter des modalités.

                                                                                                                                                                                                                                Les différents niveaux de sponsoring et les contreparties associées sont détaillées sur cette page.

                                                                                                                                                                                                                                Télécharger ce contenu au format EPUB

                                                                                                                                                                                                                                Commentaires : voir le flux Atom ouvrir dans le navigateur

                                                                                                                                                                                                                                [?]Hugo van Kemenade » 🌐
                                                                                                                                                                                                                                @hugovk@mastodon.social

                                                                                                                                                                                                                                The Python Steering Council election is on!

                                                                                                                                                                                                                                hugovk.dev/blog/2025/steering-

                                                                                                                                                                                                                                This year we have six candidates for five seats.

                                                                                                                                                                                                                                This chart shows when the nominations arrived: six is fewer than previous years but they didn't all wait until the last three days.

                                                                                                                                                                                                                                This year we're also using a new "Multi-winner Bloc STAR" voting system: you give between 0-5 stars per candidate.

                                                                                                                                                                                                                                If you're in the core team, remember to vote by Friday!

                                                                                                                                                                                                                                9 nominations in 2019, 4 with in 8-15 days, rest within 2 days.
2020: 10 nominations, fairly well spread out over the two weeks.
2021: 10 nominations, all within 7 days, 6 within last day.
2022: 8 nominations, fairly well spread out.
2023 and 2024: 8 nominations, all within 3 days.
2025: 6 nominations, spread out within 10 days.

                                                                                                                                                                                                                                Alt...9 nominations in 2019, 4 with in 8-15 days, rest within 2 days. 2020: 10 nominations, fairly well spread out over the two weeks. 2021: 10 nominations, all within 7 days, 6 within last day. 2022: 8 nominations, fairly well spread out. 2023 and 2024: 8 nominations, all within 3 days. 2025: 6 nominations, spread out within 10 days.

                                                                                                                                                                                                                                  [?]Hugo van Kemenade » 🌐
                                                                                                                                                                                                                                  @hugovk@mastodon.social

                                                                                                                                                                                                                                  🗳️ I've voted in @ThePSF board election!
                                                                                                                                                                                                                                  🗳️ And in the inaugural Packaging Council election!
                                                                                                                                                                                                                                  🗳️ Remember to vote!

                                                                                                                                                                                                                                  Python Software Foundation Board of Directors Election 2026
Your vote has been received.


Thank you for voting!

                                                                                                                                                                                                                                  Alt...Python Software Foundation Board of Directors Election 2026 Your vote has been received. Thank you for voting!

                                                                                                                                                                                                                                  2026 Python Packaging Council Election
Your vote has been received.

Thank you for voting!

                                                                                                                                                                                                                                  Alt...2026 Python Packaging Council Election Your vote has been received. Thank you for voting!

                                                                                                                                                                                                                                    [?]Hugo van Kemenade » 🌐
                                                                                                                                                                                                                                    @hugovk@mastodon.social

                                                                                                                                                                                                                                    🗳️ I've voted!

                                                                                                                                                                                                                                    The Python Steering Council elections are underway, and there are eight excellent candidates. We'll be in safe hands whichever five are elected.

                                                                                                                                                                                                                                    This year we have 87 eligible core dev voters, compared to 85 last year.

                                                                                                                                                                                                                                    peps.python.org/pep-8105/#cand

                                                                                                                                                                                                                                    hugovk.github.io/python-steeri

                                                                                                                                                                                                                                    Edit: 🧵 Thread continued from: mastodon.social/@hugovk/111415

                                                                                                                                                                                                                                    2024 Python Steering Council Election - vote cast

Helios Voting Bot <no-reply@mail.heliosvoting.org>
to me

Dear Hugo van Kemenade,

You have successfully cast a vote in 2024 Python Steering Council Election.

                                                                                                                                                                                                                                    Alt...2024 Python Steering Council Election - vote cast Helios Voting Bot <no-reply@mail.heliosvoting.org> to me Dear Hugo van Kemenade, You have successfully cast a vote in 2024 Python Steering Council Election.

                                                                                                                                                                                                                                    Chart showing the terms of the 11 people who have served across the past five councils.

                                                                                                                                                                                                                                    Alt...Chart showing the terms of the 11 people who have served across the past five councils.

                                                                                                                                                                                                                                      [?]Hugo van Kemenade » 🌐
                                                                                                                                                                                                                                      @hugovk@mastodon.social

                                                                                                                                                                                                                                      🗳️🗳 I've voted in two elections today!

                                                                                                                                                                                                                                      1. Proxy voted in the UK general election.

                                                                                                                                                                                                                                      2. Online voted in @Thepsf board elections, and yes for the three bylaw changes.

                                                                                                                                                                                                                                        [?]Hugo van Kemenade » 🌐
                                                                                                                                                                                                                                        @hugovk@mastodon.social

                                                                                                                                                                                                                                        🗳️ I've voted in @thepsf.bsky.social board elections!
                                                                                                                                                                                                                                        🗳️ Remember to vote!
                                                                                                                                                                                                                                        🗳️ Remember not to vote for FK!

                                                                                                                                                                                                                                        OpaVote.

Python Software Foundation Board of Directors Election 2025.
Your vote has been received.

Thank you for voting!

                                                                                                                                                                                                                                        Alt...OpaVote. Python Software Foundation Board of Directors Election 2025. Your vote has been received. Thank you for voting!

                                                                                                                                                                                                                                          [?]Hugo van Kemenade » 🌐
                                                                                                                                                                                                                                          @hugovk@mastodon.social

                                                                                                                                                                                                                                          Voted in the Python Steering Council election! 🐍🗳✅

                                                                                                                                                                                                                                          mastodon.social/@hugovk/115688

                                                                                                                                                                                                                                          Ballot Submitted
Thank you for voting!
Election ends 13/12/2025 at 14:00:00

                                                                                                                                                                                                                                          Alt...Ballot Submitted Thank you for voting! Election ends 13/12/2025 at 14:00:00

                                                                                                                                                                                                                                            [?]Python Software Foundation » 🌐
                                                                                                                                                                                                                                            @ThePSF@fosstodon.org

                                                                                                                                                                                                                                            📣📣 ATTN PSF Voting Members: The inaugural Python Packaging Council election vote closes next Tuesday, September 15th- but don't wait, go vote today! If you affirmed your intention to vote, check your email for voting instructions 🗳️
                                                                                                                                                                                                                                            pyfound.blogspot.com/2026/09/i

                                                                                                                                                                                                                                              [?]Python Software Foundation » 🌐
                                                                                                                                                                                                                                              @ThePSF@fosstodon.org

                                                                                                                                                                                                                                              Voting is open for the PSF Board of Directors Election until Tuesday, September 15th, 2:00PM UTC! To all our affirmed and pre-affirmed voters, make sure you check out the candidates and make some time to vote before then 🗳️ pyfound.blogspot.com/2026/09/t

                                                                                                                                                                                                                                                [?]Graham Dumpleton » 🌐
                                                                                                                                                                                                                                                @grahamdumpleton@mastodon.social

                                                                                                                                                                                                                                                Last post in the wrapture tracing series: OpenTelemetry export.

                                                                                                                                                                                                                                                One table in the config and the same events that printed a tree feed a backend while the application runs. Requests become SERVER spans named by route, a failing request carries the 500 and the exception the framework swallowed, and one trace id is shared by the files, the outbound headers and the exported spans, so two services join as one trace.

                                                                                                                                                                                                                                                grahamdumpleton.me/posts/2026/

                                                                                                                                                                                                                                                  [?]Trey Hunner 🐍 » 🌐
                                                                                                                                                                                                                                                  @treyhunner@mastodon.social

                                                                                                                                                                                                                                                  “You can store the data as attributes on each instance of your class, and you can store the functionality as methods on the class itself.”

                                                                                                                                                                                                                                                  Read more 👉 pym.dev/when-are-classes-used/

                                                                                                                                                                                                                                                    [?]Trey Hunner 🐍 » 🌐
                                                                                                                                                                                                                                                    @treyhunner@mastodon.social

                                                                                                                                                                                                                                                    Python Tip #253 (of 365):

                                                                                                                                                                                                                                                    Avoid import side effects in your Python modules.

                                                                                                                                                                                                                                                    As a general rule, the top level of a module should only DEFINE things. Define functions, classes, constants and any other objects meant to be accessed after import. But don't print, prompt for input, write to files, etc.

                                                                                                                                                                                                                                                    🧵 (1/3)

                                                                                                                                                                                                                                                      [?]KeithTheEE [he/him] » 🌐
                                                                                                                                                                                                                                                      @KeithTheEE@mastodon.social

                                                                                                                                                                                                                                                      If you're interested in and Programming, you might be interested in this: A Reading Club going over the "Big Book of Computational Pedagogy"

                                                                                                                                                                                                                                                      In 20 minutes I'll be hosting our third week of reading, and this week we're covering "Semantic Waves" on pg46, and "Go Unplugged" on pg49.

                                                                                                                                                                                                                                                      This reading club is hosted on the Guild of Educators Discord server: guildofeducators.org/join_us and you're welcome to join even if you haven't read the section.

                                                                                                                                                                                                                                                      downloads.ctfassets.net/oshmmv

                                                                                                                                                                                                                                                      A screenshot of 4 pages from the book to show the small scale of what will be covered during reading club. It is too low of a resolution to read from the image, so it's main purpose is to convey the relaxed nature of what we're reading. The pages have lots of images breaking up the text so in total it is not very dense

                                                                                                                                                                                                                                                      Alt...A screenshot of 4 pages from the book to show the small scale of what will be covered during reading club. It is too low of a resolution to read from the image, so it's main purpose is to convey the relaxed nature of what we're reading. The pages have lots of images breaking up the text so in total it is not very dense

                                                                                                                                                                                                                                                      Guild of Educators Reading Club, with three times:  Monday at 23:59 UTC with Elizabeth, Wednesday at 15:00 UTC with Keith, and Thursday at 16:00 UTC with Dominique. The book the reading club covers is "The Big Book of Computing Pedagogy", and the event is hosted by the guild of educators

                                                                                                                                                                                                                                                      Alt...Guild of Educators Reading Club, with three times: Monday at 23:59 UTC with Elizabeth, Wednesday at 15:00 UTC with Keith, and Thursday at 16:00 UTC with Dominique. The book the reading club covers is "The Big Book of Computing Pedagogy", and the event is hosted by the guild of educators

                                                                                                                                                                                                                                                        [?]KeithTheEE [he/him] » 🌐
                                                                                                                                                                                                                                                        @KeithTheEE@mastodon.social

                                                                                                                                                                                                                                                        This week Guild of Educators will be covering Cognitive Load Theory
                                                                                                                                                                                                                                                        downloads.ctfassets.net/oshmmv

                                                                                                                                                                                                                                                        It's wonderfully short and as always, even if you haven't read the section you're welcome to join and listen in

                                                                                                                                                                                                                                                        guildofeducators.org/join_us#:

                                                                                                                                                                                                                                                        It starts in just under an hour at 15:00 UTC, please join us if you're interested!

                                                                                                                                                                                                                                                        Poster showing "Topic of The Week: Cognitive Load Theory (page 20) with "Big Book of Computing Pedagogy" in the center, and the three session times radially spaced to the left, right, and bottom center: Monday at 23:59 UTC with Elizabeth (left), Wednesday at 15:00 UTC with Keith (right), and Thursday at 16:00 UTC with Dominique (bottom center). At the footer is "Join our discord server to find the event links https://discord.gg/8cPdX2bAze", and a second url below that "https://guildofeducators.org/join_us"

                                                                                                                                                                                                                                                        Alt...Poster showing "Topic of The Week: Cognitive Load Theory (page 20) with "Big Book of Computing Pedagogy" in the center, and the three session times radially spaced to the left, right, and bottom center: Monday at 23:59 UTC with Elizabeth (left), Wednesday at 15:00 UTC with Keith (right), and Thursday at 16:00 UTC with Dominique (bottom center). At the footer is "Join our discord server to find the event links https://discord.gg/8cPdX2bAze", and a second url below that "https://guildofeducators.org/join_us"

                                                                                                                                                                                                                                                        A screenshot of 2 pages from the book to show the small scale of what will be covered during reading club's "Cognitive Load Theory" session. It is too low of a resolution to read from the image, so it's main purpose is to convey the relaxed nature of what we're reading. The pages have lots of images breaking up the text so in total it is not very dense

                                                                                                                                                                                                                                                        Alt...A screenshot of 2 pages from the book to show the small scale of what will be covered during reading club's "Cognitive Load Theory" session. It is too low of a resolution to read from the image, so it's main purpose is to convey the relaxed nature of what we're reading. The pages have lots of images breaking up the text so in total it is not very dense

                                                                                                                                                                                                                                                          [?]Hugo van Kemenade » 🌐
                                                                                                                                                                                                                                                          @hugovk@mastodon.social

                                                                                                                                                                                                                                                          Do you know your regular expressions in Python? Do you know the unusual thing re.match() does? Or what soft deprecation is? I've written about the changes coming up in Python 3.15 to help clear things up a bit.

                                                                                                                                                                                                                                                          hugovk.dev/blog/2026/soft-depr

                                                                                                                                                                                                                                                            [?]Python Software Foundation » 🌐
                                                                                                                                                                                                                                                            @ThePSF@fosstodon.org

                                                                                                                                                                                                                                                            🐍 Check out @sethmlarson's talk at @europython 2026: "Learning from the not-so-secret Python security 'cabal'". This talk is a deep dive into how CPython handles coordinated vulnerability disclosure, how the security team is organized, and what it takes to run a sustainable disclosure program. youtube.com/watch?v=Xmr89QEr720

                                                                                                                                                                                                                                                              [?]Trey Hunner 🐍 » 🌐
                                                                                                                                                                                                                                                              @treyhunner@mastodon.social

                                                                                                                                                                                                                                                              Python Tip #252 (of 365):

                                                                                                                                                                                                                                                              Use ALL_CAPS names for module-level constants.

                                                                                                                                                                                                                                                              MAX_RETRIES = 5
                                                                                                                                                                                                                                                              DEFAULT_TIMEOUT = 30

                                                                                                                                                                                                                                                              pym.dev/python-doesnt-have-con

                                                                                                                                                                                                                                                              Python doesn't have constants. There's no keyword that stops a variable from being reassigned:

                                                                                                                                                                                                                                                              >>> MAX_RETRIES = 5
                                                                                                                                                                                                                                                              >>> MAX_RETRIES = 10

                                                                                                                                                                                                                                                              The all-caps name is purely a convention. It's a signal to readers of our code meaning "this value isn't meant to change".

                                                                                                                                                                                                                                                              🧵 (1/2)

                                                                                                                                                                                                                                                                [?]Graham Dumpleton » 🌐
                                                                                                                                                                                                                                                                @grahamdumpleton@mastodon.social

                                                                                                                                                                                                                                                                Fourth post in the wrapture tracing series: finding slow code.

                                                                                                                                                                                                                                                                One endpoint is slow and there are three layers it could be. A stopwatch in each is a code change in a layer that should not know it is being measured; a profiler sees every frame and cannot tell one request from the next. Self time for the handful of methods you chose says which one is slow in its own right, rather than slow because of what it calls.

                                                                                                                                                                                                                                                                grahamdumpleton.me/posts/2026/

                                                                                                                                                                                                                                                                  [?]Trey Hunner 🐍 » 🌐
                                                                                                                                                                                                                                                                  @treyhunner@mastodon.social

                                                                                                                                                                                                                                                                  “The continue statement doesn't break out of its loop; it just skips to the next iteration of the loop.”

                                                                                                                                                                                                                                                                  Read more 👉 pym.dev/breaking-out-of-a-loop/

                                                                                                                                                                                                                                                                    [?]Python Software Foundation » 🌐
                                                                                                                                                                                                                                                                    @ThePSF@fosstodon.org

                                                                                                                                                                                                                                                                    Voting is open for the PSF Board of Directors Election until Tuesday, September 15th, 2:00PM UTC! To all our affirmed and pre-affirmed voters, make sure you check out the candidates and make some time to vote before then 🗳️ pyfound.blogspot.com/2026/09/t

                                                                                                                                                                                                                                                                      [?]Adam Johnson :django: :python: » 🌐
                                                                                                                                                                                                                                                                      @adamchainz@fosstodon.org

                                                                                                                                                                                                                                                                      ⏳ I just released time-machine 3.5.1 with 13 bug fixes.

                                                                                                                                                                                                                                                                      Two were reported by humans. The rest came from prompting Claude Fable with just "Find and fix bugs".

                                                                                                                                                                                                                                                                      None of them had a huge impact (this is a test library, after all), but they were all mistakes. The worst would leave time mocked after a test tearDownClass() failure, which would be pretty hard to debug.

                                                                                                                                                                                                                                                                      Crazy times. These machines can help us build the highest-quality software, if we want.

                                                                                                                                                                                                                                                                      time-machine.readthedocs.io/en

                                                                                                                                                                                                                                                                        [?]Trey Hunner 🐍 » 🌐
                                                                                                                                                                                                                                                                        @treyhunner@mastodon.social

                                                                                                                                                                                                                                                                        “Let's say we have some text that was retrieved from a database, and the original text came from a form submission in a web browser. Web browsers often represent line breaks as a carriage return character, followed by a line feed character.”

                                                                                                                                                                                                                                                                        Read more 👉 pym.dev/splitlines/

                                                                                                                                                                                                                                                                          [?]Graham Dumpleton » 🌐
                                                                                                                                                                                                                                                                          @grahamdumpleton@mastodon.social

                                                                                                                                                                                                                                                                          Third post in the wrapture tracing series: tracing Flask.

                                                                                                                                                                                                                                                                          A WSGI app routes the interesting facts around the return value, so a plain wrapper on it records nothing useful. One config entry naming the Flask instrumentation gives one tree per HTTP request instead, with the view, the template render and the shop's own calls beneath it, and the failing request saying both that it answered 500 and that a KeyError was why.

                                                                                                                                                                                                                                                                          grahamdumpleton.me/posts/2026/

                                                                                                                                                                                                                                                                            [?]Anthony » 🌐
                                                                                                                                                                                                                                                                            @anthony@indieweb.social

                                                                                                                                                                                                                                                                            When OpenAI bought Astral, I feared this was a way to influence the future of . Their latest blog post about Packaging Council endorsements is a clear sign in that direction.

                                                                                                                                                                                                                                                                            And it's no surprise that it's the only post not written by a person ("The Astral Team").

                                                                                                                                                                                                                                                                              [?]Hugo van Kemenade » 🌐
                                                                                                                                                                                                                                                                              @hugovk@mastodon.social

                                                                                                                                                                                                                                                                              The next @pillow release will use lazy imports on Python 3.15, meaning `from PIL import Image` with no further use takes only 10 ms instead of 25 ms! ⚡️🦥⚡️

                                                                                                                                                                                                                                                                              github.com/python-pillow/Pillo

                                                                                                                                                                                                                                                                              import times with Python 3.15 for PIL.Image visualised using a tool called Tuna, from before the change. PIL.Image takes 25 ms, it shows around 16 further modules it imports and how long they take. The biggest are logging at 9 ms and tempfile at 4 ms.

                                                                                                                                                                                                                                                                              Alt...import times with Python 3.15 for PIL.Image visualised using a tool called Tuna, from before the change. PIL.Image takes 25 ms, it shows around 16 further modules it imports and how long they take. The biggest are logging at 9 ms and tempfile at 4 ms.

                                                                                                                                                                                                                                                                              After the change, PIL.Image takes 10 ms, and the two biggest sub-imports are PIL._imaging at 2 ms and typing at 2 ms.

                                                                                                                                                                                                                                                                              Alt...After the change, PIL.Image takes 10 ms, and the two biggest sub-imports are PIL._imaging at 2 ms and typing at 2 ms.

                                                                                                                                                                                                                                                                                [?]Trey Hunner 🐍 » 🌐
                                                                                                                                                                                                                                                                                @treyhunner@mastodon.social

                                                                                                                                                                                                                                                                                Python Tip #251 (of 365):

                                                                                                                                                                                                                                                                                Avoid wildcard imports.

                                                                                                                                                                                                                                                                                Using star imports, like "from something import *", makes for fragile code.

                                                                                                                                                                                                                                                                                The Zen of Python ends with "Namespaces are one honking great idea -- let's do more of those!"

                                                                                                                                                                                                                                                                                Each module automatically makes a namespace, which is great: same-named variables in different modules never accidentally collide.

                                                                                                                                                                                                                                                                                A wildcard import BREAKS that namespacing: "import *" dumps every name from one module into another.

                                                                                                                                                                                                                                                                                🧵 (1/3)

                                                                                                                                                                                                                                                                                  [?]Python Software Foundation » 🌐
                                                                                                                                                                                                                                                                                  @ThePSF@fosstodon.org

                                                                                                                                                                                                                                                                                  🎙️ Check out the "Security and Ethics in the Age of Generative AI" panel from @europython 2026! The PSF's @miketheman and @sethmlarson join other awesome folks from the community to dig into how generative AI is reshaping cybersecurity, from ecosystem-level risks to practical lessons to the ethics of AI. youtube.com/watch?v=4cfgbo912rg

                                                                                                                                                                                                                                                                                    [?]Trey Hunner 🐍 » 🌐
                                                                                                                                                                                                                                                                                    @treyhunner@mastodon.social

                                                                                                                                                                                                                                                                                    Python Tip #250 (of 365):

                                                                                                                                                                                                                                                                                    Sort your import statements in a meaningful way.

                                                                                                                                                                                                                                                                                    The usual convention (from PEP 8): standard library first, then third-party packages, then your own code, with a blank line between each group.

                                                                                                                                                                                                                                                                                    import json
                                                                                                                                                                                                                                                                                    import secrets

                                                                                                                                                                                                                                                                                    from django.http import Http404, HttpResponse
                                                                                                                                                                                                                                                                                    from django.shortcuts import redirect

                                                                                                                                                                                                                                                                                    from exercises.models import Exercise

                                                                                                                                                                                                                                                                                    🧵 (1/3)

                                                                                                                                                                                                                                                                                      [?]Graham Dumpleton » 🌐
                                                                                                                                                                                                                                                                                      @grahamdumpleton@mastodon.social

                                                                                                                                                                                                                                                                                      Second post in the wrapture tracing series: zero-code tracing.

                                                                                                                                                                                                                                                                                      The application you need to see inside is often one you cannot, or should not, edit. The bindings and sink move into a wrapture.toml next to the project, and the program runs untouched under python -m wrapture, or with no launcher at all through autowrapt. Also: streaming the trace to JSON Lines and asking it questions with jq.

                                                                                                                                                                                                                                                                                      grahamdumpleton.me/posts/2026/

                                                                                                                                                                                                                                                                                        [?]Trey Hunner 🐍 » 🌐
                                                                                                                                                                                                                                                                                        @treyhunner@mastodon.social

                                                                                                                                                                                                                                                                                        “Note that passing generator expressions into iterable-accepting functions and classes makes something that looks a bit like a custom comprehension.”

                                                                                                                                                                                                                                                                                        Read more 👉 pym.dev/custom-comprehensions/

                                                                                                                                                                                                                                                                                          Debacle boosted

                                                                                                                                                                                                                                                                                          [?]LWN.net » 🌐
                                                                                                                                                                                                                                                                                          @lwn@fedi.lwn.net

                                                                                                                                                                                                                                                                                          [$] CERN's migration path from CentOS Linux to Debian

                                                                                                                                                                                                                                                                                          The European Laboratory for Particle Physics, usually just called CERN, is not only the birthplace of the World Wide Web, it is home to the Large Hadron Collider (LHC), the world's [...]

                                                                                                                                                                                                                                                                                          lwn.net/Articles/1092512/

                                                                                                                                                                                                                                                                                            [?]Python Software Foundation » 🌐
                                                                                                                                                                                                                                                                                            @ThePSF@fosstodon.org

                                                                                                                                                                                                                                                                                            Voting is open for the Python Packaging Council until Tuesday, September 15th, 2:00PM UTC! To all affirmed voters, make sure you check out the candidates and make some time to vote before then 🗳️ python.org/nominations/electio

                                                                                                                                                                                                                                                                                              [?]Trey Hunner 🐍 » 🌐
                                                                                                                                                                                                                                                                                              @treyhunner@mastodon.social

                                                                                                                                                                                                                                                                                              Python Tip #249 (of 365):

                                                                                                                                                                                                                                                                                              Monkey patch cautiously... and only in your automated tests.

                                                                                                                                                                                                                                                                                              Monkey patching means fundamentally changing how a module or class works WITHOUT editing its code, by reassigning one of its attributes at runtime.

                                                                                                                                                                                                                                                                                              In automated tests, monkey patching can simplify things.

                                                                                                                                                                                                                                                                                              🧵 (1/4)

                                                                                                                                                                                                                                                                                                [?]Graham Dumpleton » 🌐
                                                                                                                                                                                                                                                                                                @grahamdumpleton@mastodon.social

                                                                                                                                                                                                                                                                                                New series on the tracing side of wrapture, starting with live tracing.

                                                                                                                                                                                                                                                                                                Nothing about a binding is specific to testing: it observes a call site and emits events, and what happens to them is decided by whoever is listening. Take away the timeline, register a sink, and the same three bindings from the testing series narrate the shop as it runs, declined card and all.

                                                                                                                                                                                                                                                                                                grahamdumpleton.me/posts/2026/

                                                                                                                                                                                                                                                                                                  [?]Trey Hunner 🐍 » 🌐
                                                                                                                                                                                                                                                                                                  @treyhunner@mastodon.social

                                                                                                                                                                                                                                                                                                  “When looking for an element within a sorted list, binary search can be much faster than regular iteration.”

                                                                                                                                                                                                                                                                                                  Read more 👉 pym.dev/binary-search/

                                                                                                                                                                                                                                                                                                    [?]Julien Riou » 🌐
                                                                                                                                                                                                                                                                                                    @jriou@hachyderm.io

                                                                                                                                                                                                                                                                                                    AI [SENSITIVE CONTENT]

                                                                                                                                                                                                                                                                                                    Out of curiosity, I have asked Claude to rewrite a tiny little SSH wrapper from Python to Go and Rust to check performance.

                                                                                                                                                                                                                                                                                                    Results:
                                                                                                                                                                                                                                                                                                    * Python = 20ms
                                                                                                                                                                                                                                                                                                    * Go = 3ms
                                                                                                                                                                                                                                                                                                    * Rust = 1.5ms

                                                                                                                                                                                                                                                                                                    It's totally useless if you have Mitogen because it opens the SSH connection once but if you don't, every single ms counts.

                                                                                                                                                                                                                                                                                                      [?]Trey Hunner 🐍 » 🌐
                                                                                                                                                                                                                                                                                                      @treyhunner@mastodon.social

                                                                                                                                                                                                                                                                                                      Python Tip #248 (of 365):

                                                                                                                                                                                                                                                                                                      Run "pytest --pdb" to drop into PDB when a test fails.

                                                                                                                                                                                                                                                                                                      With "--pdb", pytest starts PDB in post-mortem mode (see tip #169) as soon as a test fails or raises an exception.

                                                                                                                                                                                                                                                                                                      I find this much nicer than sprinkling print calls through a test and re-running it.

                                                                                                                                                                                                                                                                                                      You can inspect objects, call functions, walk up the stack, and poke at things in real time instead of re-running repeatedly.

                                                                                                                                                                                                                                                                                                      mastodon.social/@treyhunner/11

                                                                                                                                                                                                                                                                                                      🧵 (1/3)

                                                                                                                                                                                                                                                                                                        [?]Trey Hunner 🐍 » 🌐
                                                                                                                                                                                                                                                                                                        @treyhunner@mastodon.social

                                                                                                                                                                                                                                                                                                        “The print function will automatically convert whatever object you give it to a string because it needs to be a string in order to be printed.”

                                                                                                                                                                                                                                                                                                        Read more 👉 pym.dev/print-features/

                                                                                                                                                                                                                                                                                                          [?]Jeff Fortin T. (風の庭園のNekohayo) » 🌐
                                                                                                                                                                                                                                                                                                          @nekohayo@mastodon.social

                                                                                                                                                                                                                                                                                                          I've been looking for a networks channels analyzer app for the desktop, like those found on F-Droid (such as WiFiAnalyzer), and couldn't find one on Flathub.

                                                                                                                                                                                                                                                                                                          Then, searching more broadly, I discovered that Daniel Nylander, oldtime Swedish translator in , has built exactly such an app in recent months, in + GTK4 + libadwaita!
                                                                                                                                                                                                                                                                                                          I tried it out (just do "cd src/ && python app.py"), it works well.

                                                                                                                                                                                                                                                                                                          Flatpak enthusiasts, see github.com/yeager/wifi-analyze

                                                                                                                                                                                                                                                                                                          Screenshot of the WiFi Analyzer desktop application, showing a graph of 5 gigahertz WiFi networks shown as curves spread across a spectrum of channels. A detailed list of those networks is also shown below the graph, providing easily readable names, channel numbers, signal strength, encryption type, etc.

                                                                                                                                                                                                                                                                                                          Alt...Screenshot of the WiFi Analyzer desktop application, showing a graph of 5 gigahertz WiFi networks shown as curves spread across a spectrum of channels. A detailed list of those networks is also shown below the graph, providing easily readable names, channel numbers, signal strength, encryption type, etc.

                                                                                                                                                                                                                                                                                                            [?]Radio CauseCommune » 🌐
                                                                                                                                                                                                                                                                                                            @CauseCommune@framapiaf.org

                                                                                                                                                                                                                                                                                                            Peut-on utiliser l'intelligence artificielle sans vendre son âme aux GAFAM et sans livrer les données de ses auditeurs à la Silicon Valley ?

                                                                                                                                                                                                                                                                                                            Dans son rapport d'activité 2025-2026, Radio Cause Commune détaille sa stack technique 100% libre et auto-hébergée dans le 18ᵉ arrondissement de Paris. 1/x

                                                                                                                                                                                                                                                                                                            [?]Jeff Triplett » 🌐
                                                                                                                                                                                                                                                                                                            @webology@mastodon.social

                                                                                                                                                                                                                                                                                                            I like what Astral is doing from a tech perspective, but I'm not sure this sits right with me.

                                                                                                                                                                                                                                                                                                            When Astral was a small company, it was one thing, but now that Astral is OpenAI, it kind of rubs me the wrong way.

                                                                                                                                                                                                                                                                                                            Is this just me?

                                                                                                                                                                                                                                                                                                            astral.sh/blog/python-packagin

                                                                                                                                                                                                                                                                                                              [?]Jeff Triplett » 🌐
                                                                                                                                                                                                                                                                                                              @webology@mastodon.social

                                                                                                                                                                                                                                                                                                              I'm glad they endorsed their own employee, though.

                                                                                                                                                                                                                                                                                                              That would have been awkward AF if they didn't. 🍿

                                                                                                                                                                                                                                                                                                              (Btw, I throw no shade on anyone from the list or who is running. I just find this to be incredibly cringe to do without reading the room.)

                                                                                                                                                                                                                                                                                                                [?]Trey Hunner 🐍 » 🌐
                                                                                                                                                                                                                                                                                                                @treyhunner@mastodon.social

                                                                                                                                                                                                                                                                                                                Python Tip #247 (of 365):

                                                                                                                                                                                                                                                                                                                Test file processing code with tempfile.

                                                                                                                                                                                                                                                                                                                from pathlib import Path
                                                                                                                                                                                                                                                                                                                from tempfile import TemporaryDirectory

                                                                                                                                                                                                                                                                                                                def test_make_rst_from_md_file():
                                                                                                                                                                                                                                                                                                                with TemporaryDirectory() as directory:
                                                                                                                                                                                                                                                                                                                md_path = Path(directory, "example‍.md")
                                                                                                                                                                                                                                                                                                                md_path.write_text("# Example markdown file")
                                                                                                                                                                                                                                                                                                                make_rst_from_md_file(md_path)
                                                                                                                                                                                                                                                                                                                assert md_path.with_suffix(".rst").is_file()

                                                                                                                                                                                                                                                                                                                🧵 (1/4)

                                                                                                                                                                                                                                                                                                                  [?]Trey Hunner 🐍 » 🌐
                                                                                                                                                                                                                                                                                                                  @treyhunner@mastodon.social

                                                                                                                                                                                                                                                                                                                  “If you need to distinguish between Linux and Mac, you need either the sys.platform string or the platform.system() function.”

                                                                                                                                                                                                                                                                                                                  Read more 👉 pym.dev/operating-system-check

                                                                                                                                                                                                                                                                                                                    [?]Trey Hunner 🐍 » 🌐
                                                                                                                                                                                                                                                                                                                    @treyhunner@mastodon.social

                                                                                                                                                                                                                                                                                                                    New screencast on creating temporary files & directories in Python:
                                                                                                                                                                                                                                                                                                                    youtu.be/dVGNVcy5NqY

                                                                                                                                                                                                                                                                                                                    If you'd rather read than watch, there's also an article version:
                                                                                                                                                                                                                                                                                                                    pym.dev/temporary-files

                                                                                                                                                                                                                                                                                                                      [?]Paolo Melchiorre » 🌐
                                                                                                                                                                                                                                                                                                                      @paulox@fosstodon.org

                                                                                                                                                                                                                                                                                                                      It can be time to update the "Python wrapper around the libmemcached interface" in Django
                                                                                                                                                                                                                                                                                                                      pypi.org/project/pylibmc2/

                                                                                                                                                                                                                                                                                                                        [?]Python Software Foundation » 🌐
                                                                                                                                                                                                                                                                                                                        @ThePSF@fosstodon.org

                                                                                                                                                                                                                                                                                                                        The weekend is great time to get to know the candidates who are running for the PSF Board of Directors this year! Find their statements on the 2026 nominees page 🤩 If you affirmed your intention to vote in this year's election or voted last year, make sure to check your email 📩
                                                                                                                                                                                                                                                                                                                        python.org/nominations/electio

                                                                                                                                                                                                                                                                                                                          [?]Trey Hunner 🐍 » 🌐
                                                                                                                                                                                                                                                                                                                          @treyhunner@mastodon.social

                                                                                                                                                                                                                                                                                                                          Python Tip #246 (of 365):

                                                                                                                                                                                                                                                                                                                          Measure your test coverage, including BRANCH coverage.

                                                                                                                                                                                                                                                                                                                          $ coverage run --branch -m pytest
                                                                                                                                                                                                                                                                                                                          $ coverage report

                                                                                                                                                                                                                                                                                                                          Or with the pytest-cov plugin:
                                                                                                                                                                                                                                                                                                                          $ pytest --cov --cov-branch

                                                                                                                                                                                                                                                                                                                          Code coverage lets you know WHICH lines of code were run by your automated tests.

                                                                                                                                                                                                                                                                                                                          For Python, coverage‍.py is great for measuring this.

                                                                                                                                                                                                                                                                                                                          Lines that are missing coverage are NEVER EVEN RUN by your tests. Code that isn't run is code that isn't tested.

                                                                                                                                                                                                                                                                                                                          🧵 (1/4)

                                                                                                                                                                                                                                                                                                                            [?]Trey Hunner 🐍 » 🌐
                                                                                                                                                                                                                                                                                                                            @treyhunner@mastodon.social

                                                                                                                                                                                                                                                                                                                            Python Morsels now includes Daily Recall: a spaced repetition system for Python & Python-adjacent learning.

                                                                                                                                                                                                                                                                                                                            It's basically Whereabouts.Earth but for Python.

                                                                                                                                                                                                                                                                                                                            I've been talking about this idea for YEARS, dogfooding it for months, and now it's finally live.

                                                                                                                                                                                                                                                                                                                            If you'd like to improve your uv, pytest, Python, etc. skills, I'd love you to try it & leave feedback!

                                                                                                                                                                                                                                                                                                                            treyhunner.com/2026/09/python-

                                                                                                                                                                                                                                                                                                                              [?]Trey Hunner 🐍 » 🌐
                                                                                                                                                                                                                                                                                                                              @treyhunner@mastodon.social

                                                                                                                                                                                                                                                                                                                              “Note that while auto-formatters will affect blank lines between classes and functions, most blank lines are under your control.”

                                                                                                                                                                                                                                                                                                                              Read more 👉 pym.dev/embrace-whitespace/

                                                                                                                                                                                                                                                                                                                                [?]Graham Dumpleton » 🌐
                                                                                                                                                                                                                                                                                                                                @grahamdumpleton@mastodon.social

                                                                                                                                                                                                                                                                                                                                Fourth post in the wrapture unit testing series: beyond callables.

                                                                                                                                                                                                                                                                                                                                Not everything a test controls is a call: attributes, environment variables, settings dicts imported by reference, registry entries, generators. wrapture spells each as a binding with one lifecycle, and a binding can observe as well as hold: it can even tell you a loop stopped early and left its generator half-consumed.

                                                                                                                                                                                                                                                                                                                                grahamdumpleton.me/posts/2026/

                                                                                                                                                                                                                                                                                                                                  [?]Trey Hunner 🐍 » 🌐
                                                                                                                                                                                                                                                                                                                                  @treyhunner@mastodon.social

                                                                                                                                                                                                                                                                                                                                  Default values are great, but they have one gotcha that Python developers sometimes overlook.

                                                                                                                                                                                                                                                                                                                                  Read more 👉 trey.io/rbi1o4

                                                                                                                                                                                                                                                                                                                                    [?]Trey Hunner 🐍 » 🌐
                                                                                                                                                                                                                                                                                                                                    @treyhunner@mastodon.social

                                                                                                                                                                                                                                                                                                                                    Python Tip #245 (of 365):

                                                                                                                                                                                                                                                                                                                                    Use approximate comparisons for floating point numbers in your tests.

                                                                                                                                                                                                                                                                                                                                    As noted back in tip #203, floating point numbers have precision gotchas:

                                                                                                                                                                                                                                                                                                                                    >>> one_two = 0.1 + 0.02
                                                                                                                                                                                                                                                                                                                                    >>> one_two == 0.12
                                                                                                                                                                                                                                                                                                                                    False
                                                                                                                                                                                                                                                                                                                                    >>> one_two
                                                                                                                                                                                                                                                                                                                                    0.12000000000000001

                                                                                                                                                                                                                                                                                                                                    🧵 (1/3)

                                                                                                                                                                                                                                                                                                                                      [?]Graham Dumpleton » 🌐
                                                                                                                                                                                                                                                                                                                                      @grahamdumpleton@mastodon.social

                                                                                                                                                                                                                                                                                                                                      Third post in the wrapture unit testing series: phased behaviour.

                                                                                                                                                                                                                                                                                                                                      Testing retry logic, circuit breakers and polling loops means a collaborator that behaves differently as the test progresses: fail twice then succeed, open after the third error, report pending until told otherwise. wrapture spells that as phases on a binding, changing on a count, a condition, an exhausted sequence, or a signal from elsewhere in the test.

                                                                                                                                                                                                                                                                                                                                      grahamdumpleton.me/posts/2026/

                                                                                                                                                                                                                                                                                                                                        [?]advokatt » 🌐
                                                                                                                                                                                                                                                                                                                                        @km@mastodon.babb.no

                                                                                                                                                                                                                                                                                                                                        @mwl ugh, i thought it was about

                                                                                                                                                                                                                                                                                                                                          [?]Adam Johnson :django: :python: » 🌐
                                                                                                                                                                                                                                                                                                                                          @adamchainz@fosstodon.org

                                                                                                                                                                                                                                                                                                                                          🎲 Just released pytest-randomly 5.0.0

                                                                                                                                                                                                                                                                                                                                          The headline breaking change fixes combination with other test reordering plugins, including pytest-django. Previously, the same seed could produce different test orders between nearly-identical environments. Oops!

                                                                                                                                                                                                                                                                                                                                          Software is never finished: even this 11 year old well-scoped plugin needs the occasional big fix!

                                                                                                                                                                                                                                                                                                                                          pypi.org/project/pytest-random

                                                                                                                                                                                                                                                                                                                                            [?]Trey Hunner 🐍 » 🌐
                                                                                                                                                                                                                                                                                                                                            @treyhunner@mastodon.social

                                                                                                                                                                                                                                                                                                                                            “It's often more readable to give a name to an object instead of just a number.”

                                                                                                                                                                                                                                                                                                                                            Read more 👉 pym.dev/avoid-indexes-in-pytho

                                                                                                                                                                                                                                                                                                                                              [?]Graham Dumpleton » 🌐
                                                                                                                                                                                                                                                                                                                                              @grahamdumpleton@mastodon.social

                                                                                                                                                                                                                                                                                                                                              Second post in the wrapture unit testing series: recording calls.

                                                                                                                                                                                                                                                                                                                                              What wrapture's timeline and tape actually record, what one event holds, and the whole-tape views that answer questions about the flow between calls rather than any one of them. Worked through on a resource leak, the kind of bug where the failure is an absence and asserting on an absence needs a record of what really happened.

                                                                                                                                                                                                                                                                                                                                              grahamdumpleton.me/posts/2026/

                                                                                                                                                                                                                                                                                                                                                [?]Hugo van Kemenade » 🌐
                                                                                                                                                                                                                                                                                                                                                @hugovk@mastodon.social

                                                                                                                                                                                                                                                                                                                                                RE: mastodon.social/@hugovk/117196

                                                                                                                                                                                                                                                                                                                                                Here's how to join the cool testers' club! 😎

                                                                                                                                                                                                                                                                                                                                                hugovk.dev/blog/2026/help-test

                                                                                                                                                                                                                                                                                                                                                [?]Hugo van Kemenade » 🌐
                                                                                                                                                                                                                                                                                                                                                @hugovk@mastodon.social

                                                                                                                                                                                                                                                                                                                                                🐍🚀 Out now: final Python 3.15 release candidate!

                                                                                                                                                                                                                                                                                                                                                It's your last chance to say that YOU helped test 3.15 before the big day on 1st October!

                                                                                                                                                                                                                                                                                                                                                How?

                                                                                                                                                                                                                                                                                                                                                💡 Try out the new features
                                                                                                                                                                                                                                                                                                                                                💡 Try your project with it
                                                                                                                                                                                                                                                                                                                                                💡 Add 3.15 to your CI
                                                                                                                                                                                                                                                                                                                                                💡 Library maintainer? An extra task for you: upload wheels to PyPI, especially binary wheels
                                                                                                                                                                                                                                                                                                                                                🐞 Report bugs!

                                                                                                                                                                                                                                                                                                                                                discuss.python.org/t/python-3-

                                                                                                                                                                                                                                                                                                                                                In return?

                                                                                                                                                                                                                                                                                                                                                😎 Join the cool testers' club!
                                                                                                                                                                                                                                                                                                                                                🦥 Lazy imports
                                                                                                                                                                                                                                                                                                                                                🧊 frozendict
                                                                                                                                                                                                                                                                                                                                                💂 sentinel
                                                                                                                                                                                                                                                                                                                                                🏎️ Tachyon
                                                                                                                                                                                                                                                                                                                                                🫶 and much, much more!

                                                                                                                                                                                                                                                                                                                                                    [?]James Bennett [he/him] » 🌐
                                                                                                                                                                                                                                                                                                                                                    @ubernostrum@infosec.exchange

                                                                                                                                                                                                                                                                                                                                                    Four years ago I published a post on how to manage dependencies in as “boring” a manner as I could manage.

                                                                                                                                                                                                                                                                                                                                                    Today I’ve published a revised version catching up on developments in the ecosystem since then:

                                                                                                                                                                                                                                                                                                                                                    b-list.org/weblog/2022/may/13/

                                                                                                                                                                                                                                                                                                                                                      [?]Trey Hunner 🐍 » 🌐
                                                                                                                                                                                                                                                                                                                                                      @treyhunner@mastodon.social

                                                                                                                                                                                                                                                                                                                                                      Python Tip #151 (of 365):

                                                                                                                                                                                                                                                                                                                                                      For truly unpredictable randomness, use the secrets module

                                                                                                                                                                                                                                                                                                                                                      Python's random module relies on pseudo-randomness, meaning it generates numbers in a predictable order. If someone can guess the random "seed" (it's based on the current time) they can predict the numbers produced.

                                                                                                                                                                                                                                                                                                                                                      For true randomness, use Python's secrets module instead.

                                                                                                                                                                                                                                                                                                                                                      🧵 (1/3)

                                                                                                                                                                                                                                                                                                                                                        [?]Trey Hunner 🐍 » 🌐
                                                                                                                                                                                                                                                                                                                                                        @treyhunner@mastodon.social

                                                                                                                                                                                                                                                                                                                                                        Python Tip #244 (of 365):

                                                                                                                                                                                                                                                                                                                                                        Use a seed to test code that relies on randomness.

                                                                                                                                                                                                                                                                                                                                                        import random

                                                                                                                                                                                                                                                                                                                                                        def generate_code():
                                                                                                                                                                                                                                                                                                                                                        characters = "ABCDEFGHJKLPQRTUVWXY234679"
                                                                                                                                                                                                                                                                                                                                                        return "".join([random.choice(characters) for _ in range(16)])

                                                                                                                                                                                                                                                                                                                                                        def test_generate_code():
                                                                                                                                                                                                                                                                                                                                                        random.seed(5)
                                                                                                                                                                                                                                                                                                                                                        assert generate_code() == "YJ6P9462VAT7H2BF"

                                                                                                                                                                                                                                                                                                                                                        The utilities in Python's random module generate PSEUDORANDOM numbers using a deterministic algorithm.

                                                                                                                                                                                                                                                                                                                                                        🧵 (1/3)

                                                                                                                                                                                                                                                                                                                                                          [?]rixx » 🌐
                                                                                                                                                                                                                                                                                                                                                          @rixx@chaos.social

                                                                                                                                                                                                                                                                                                                                                          I was trying to explain why I don't really use Python's match statements much and by explaining my take on them came around from a very mild dislike to an equally mild like

                                                                                                                                                                                                                                                                                                                                                          very mildly confusing

                                                                                                                                                                                                                                                                                                                                                          (this was after running github.com/15r10nk/matchify on my main code base to see what strong use of match statements looks like – obviously not all of the changed statements were good or sensible, but I'm coming around to liking some of them)

                                                                                                                                                                                                                                                                                                                                                            [?]Python Software Foundation » 🌐
                                                                                                                                                                                                                                                                                                                                                            @ThePSF@fosstodon.org

                                                                                                                                                                                                                                                                                                                                                            ATTN PSF Voting Members: The inaugural Python Packaging Council election vote is open now until September 15th! If you affirmed your intention to vote in the election, you should have an email with voting instructions 🗳️ Learn more on the PSF blog. pyfound.blogspot.com/2026/09/i

                                                                                                                                                                                                                                                                                                                                                              [?]Python Software Foundation » 🌐
                                                                                                                                                                                                                                                                                                                                                              @ThePSF@fosstodon.org

                                                                                                                                                                                                                                                                                                                                                              ATTN PSF Voting Members: The 2026 PSF Board election vote is open now until September 15th! If you affirmed your intention to vote in this year's election, or voted last year, you should have an email with voting instructions 🗳️ Learn more on the PSF blog.
                                                                                                                                                                                                                                                                                                                                                              pyfound.blogspot.com/2026/09/t

                                                                                                                                                                                                                                                                                                                                                                [?]Hugo van Kemenade » 🌐
                                                                                                                                                                                                                                                                                                                                                                @hugovk@mastodon.social

                                                                                                                                                                                                                                                                                                                                                                🐍🚀 Out now: final Python 3.15 release candidate!

                                                                                                                                                                                                                                                                                                                                                                It's your last chance to say that YOU helped test 3.15 before the big day on 1st October!

                                                                                                                                                                                                                                                                                                                                                                How?

                                                                                                                                                                                                                                                                                                                                                                💡 Try out the new features
                                                                                                                                                                                                                                                                                                                                                                💡 Try your project with it
                                                                                                                                                                                                                                                                                                                                                                💡 Add 3.15 to your CI
                                                                                                                                                                                                                                                                                                                                                                💡 Library maintainer? An extra task for you: upload wheels to PyPI, especially binary wheels
                                                                                                                                                                                                                                                                                                                                                                🐞 Report bugs!

                                                                                                                                                                                                                                                                                                                                                                discuss.python.org/t/python-3-

                                                                                                                                                                                                                                                                                                                                                                In return?

                                                                                                                                                                                                                                                                                                                                                                😎 Join the cool testers' club!
                                                                                                                                                                                                                                                                                                                                                                🦥 Lazy imports
                                                                                                                                                                                                                                                                                                                                                                🧊 frozendict
                                                                                                                                                                                                                                                                                                                                                                💂 sentinel
                                                                                                                                                                                                                                                                                                                                                                🏎️ Tachyon
                                                                                                                                                                                                                                                                                                                                                                🫶 and much, much more!

                                                                                                                                                                                                                                                                                                                                                                  [?]Trey Hunner 🐍 » 🌐
                                                                                                                                                                                                                                                                                                                                                                  @treyhunner@mastodon.social

                                                                                                                                                                                                                                                                                                                                                                  Python Tip #243 (of 365):

                                                                                                                                                                                                                                                                                                                                                                  Write automated tests.

                                                                                                                                                                                                                                                                                                                                                                  You can test manually (run your code to make sure it works), or write automated tests: code that tests your code, like this:

                                                                                                                                                                                                                                                                                                                                                                  def test_no_tax():
                                                                                                                                                                                                                                                                                                                                                                  assert calculate_total([3.50, 13.75], apply_tax=False) == 17.25

                                                                                                                                                                                                                                                                                                                                                                  Every time you change your code, your automated tests can tell you whether you broke something... without you needing to manually check every possible scenario.

                                                                                                                                                                                                                                                                                                                                                                  🧵 (1/3)

                                                                                                                                                                                                                                                                                                                                                                    [?]Graham Dumpleton » 🌐
                                                                                                                                                                                                                                                                                                                                                                    @grahamdumpleton@mastodon.social

                                                                                                                                                                                                                                                                                                                                                                    First follow-up to the wrapture announcement: unit testing with wrapture.

                                                                                                                                                                                                                                                                                                                                                                    I take one small piece of code and write its tests twice, once with unittest.mock and once with wrapture, focusing on the cases where the difference is structural: where wrapping the real code rather than replacing it lets a test say something substitution cannot.

                                                                                                                                                                                                                                                                                                                                                                    More posts on the testing side coming over the next few days.

                                                                                                                                                                                                                                                                                                                                                                    grahamdumpleton.me/posts/2026/

                                                                                                                                                                                                                                                                                                                                                                      [?]Trey Hunner 🐍 » 🌐
                                                                                                                                                                                                                                                                                                                                                                      @treyhunner@mastodon.social

                                                                                                                                                                                                                                                                                                                                                                      “The sorted function accepts an optional reverse argument.”

                                                                                                                                                                                                                                                                                                                                                                      Read more 👉 pym.dev/sorting-in-python/

                                                                                                                                                                                                                                                                                                                                                                        [?]Pete Prodoehl 🍕 » 🌐
                                                                                                                                                                                                                                                                                                                                                                        @rasterweb@mastodon.social

                                                                                                                                                                                                                                                                                                                                                                        I finally got around to working on my bike mapping project enough to publish the results...

                                                                                                                                                                                                                                                                                                                                                                        rasterweb.net/bike/

                                                                                                                                                                                                                                                                                                                                                                        I take the GPX files from my bike rides, run some Python scripts, and get these maps.

                                                                                                                                                                                                                                                                                                                                                                        It's still not done, but I've procrastinated enough and wanted to get something out there since I've been working on it since last fall.

                                                                                                                                                                                                                                                                                                                                                                          [?]Trey Hunner 🐍 » 🌐
                                                                                                                                                                                                                                                                                                                                                                          @treyhunner@mastodon.social

                                                                                                                                                                                                                                                                                                                                                                          “The name deque stands for "double-ended queue", meaning deque objects are actually a sort of hybrid structure: they can be used as a stack, used as a queue, or used as both:”

                                                                                                                                                                                                                                                                                                                                                                          Read more 👉 pym.dev/stacks-and-queues/

                                                                                                                                                                                                                                                                                                                                                                            [?]Trey Hunner 🐍 » 🌐
                                                                                                                                                                                                                                                                                                                                                                            @treyhunner@mastodon.social

                                                                                                                                                                                                                                                                                                                                                                            Python Tip #242 (of 365):

                                                                                                                                                                                                                                                                                                                                                                            Prefer isinstance over type for type checking.

                                                                                                                                                                                                                                                                                                                                                                            Do this:
                                                                                                                                                                                                                                                                                                                                                                            isinstance(value, int)

                                                                                                                                                                                                                                                                                                                                                                            Not this:
                                                                                                                                                                                                                                                                                                                                                                            type(value) == int

                                                                                                                                                                                                                                                                                                                                                                            Unlike comparing with type(...), using isinstance respects inheritance.

                                                                                                                                                                                                                                                                                                                                                                            A "type(...) == ..." check fails for subclasses:

                                                                                                                                                                                                                                                                                                                                                                            >>> counts = Counter("hello")
                                                                                                                                                                                                                                                                                                                                                                            >>> isinstance(counts, dict)
                                                                                                                                                                                                                                                                                                                                                                            True
                                                                                                                                                                                                                                                                                                                                                                            >>> type(counts) == dict
                                                                                                                                                                                                                                                                                                                                                                            False

                                                                                                                                                                                                                                                                                                                                                                            Checking with type means nobody can inherit from your class without breaking your type check.

                                                                                                                                                                                                                                                                                                                                                                            🧵 (1/2)

                                                                                                                                                                                                                                                                                                                                                                              [?]PyLadies Zurich » 🌐
                                                                                                                                                                                                                                                                                                                                                                              @zurich_pyladies@mastodon.social

                                                                                                                                                                                                                                                                                                                                                                              Thank you all for participating in today's workshop on open source contribution and !

                                                                                                                                                                                                                                                                                                                                                                              two workshop participants looking at a laptop screen

                                                                                                                                                                                                                                                                                                                                                                              Alt...two workshop participants looking at a laptop screen

                                                                                                                                                                                                                                                                                                                                                                              three workshop participants working on django and chatting

                                                                                                                                                                                                                                                                                                                                                                              Alt...three workshop participants working on django and chatting

                                                                                                                                                                                                                                                                                                                                                                              crocheted django pony sitting on a table, with pyladies zurich stickers next to it

                                                                                                                                                                                                                                                                                                                                                                              Alt...crocheted django pony sitting on a table, with pyladies zurich stickers next to it

                                                                                                                                                                                                                                                                                                                                                                              speaker presenting on open source contribution. slide with the title "why contribute to open source?"

                                                                                                                                                                                                                                                                                                                                                                              Alt...speaker presenting on open source contribution. slide with the title "why contribute to open source?"

                                                                                                                                                                                                                                                                                                                                                                                [?]Hugo van Kemenade » 🌐
                                                                                                                                                                                                                                                                                                                                                                                @hugovk@mastodon.social

                                                                                                                                                                                                                                                                                                                                                                                What's New in Python 3.15:

                                                                                                                                                                                                                                                                                                                                                                                locale

                                                                                                                                                                                                                                                                                                                                                                                * setlocale() now supports language codes with @-modifiers. @-modifiers are no longer silently removed in getlocale(), but included in the language code. (Contributed by Serhiy Storchaka.)

                                                                                                                                                                                                                                                                                                                                                                                * Undeprecate the locale.getdefaultlocale() function. (Contributed by @vstinner.)

                                                                                                                                                                                                                                                                                                                                                                                docs.python.org/3.15/whatsnew/

                                                                                                                                                                                                                                                                                                                                                                                  [?]Trey Hunner 🐍 » 🌐
                                                                                                                                                                                                                                                                                                                                                                                  @treyhunner@mastodon.social

                                                                                                                                                                                                                                                                                                                                                                                  “When you need to look up one value based on another in Python, you can use a dictionary as a mapping of key-value pairs.”

                                                                                                                                                                                                                                                                                                                                                                                  Read more 👉 pym.dev/using-dictionaries-in-

                                                                                                                                                                                                                                                                                                                                                                                    [?]Trey Hunner 🐍 » 🌐
                                                                                                                                                                                                                                                                                                                                                                                    @treyhunner@mastodon.social

                                                                                                                                                                                                                                                                                                                                                                                    Python Tip #241 (of 365):

                                                                                                                                                                                                                                                                                                                                                                                    Let dataclasses write your dunder methods.

                                                                                                                                                                                                                                                                                                                                                                                    The dataclass decorator writes __init__, __repr__, and __eq__ for you:

                                                                                                                                                                                                                                                                                                                                                                                    from dataclasses import dataclass

                                                                                                                                                                                                                                                                                                                                                                                    @dataclass
                                                                                                                                                                                                                                                                                                                                                                                    class Comment:
                                                                                                                                                                                                                                                                                                                                                                                    text: str
                                                                                                                                                                                                                                                                                                                                                                                    line: int

                                                                                                                                                                                                                                                                                                                                                                                    Back in tips 63, 64, and 66 I recommended giving every class an initializer, a friendly string representation, and (sometimes) a custom sense of equality.

                                                                                                                                                                                                                                                                                                                                                                                    That's three methods of boilerplate for even a simple class:

                                                                                                                                                                                                                                                                                                                                                                                    🧵 (1/3)

                                                                                                                                                                                                                                                                                                                                                                                      [?]andros » 🌐
                                                                                                                                                                                                                                                                                                                                                                                      @andros@activity.andros.dev

                                                                                                                                                                                                                                                                                                                                                                                      «htmx and Django LiveView, side by side»

                                                                                                                                                                                                                                                                                                                                                                                      If you use htmx and are considering migrating to Django LiveView, this is for you: not an exhaustive comparison, but a run-through of the most common cases and how each one solves them.

                                                                                                                                                                                                                                                                                                                                                                                      https://en.andros.dev/blog/94d14a9e/htmx-and-django-liveview-side-by-side/

                                                                                                                                                                                                                                                                                                                                                                                      #Web #Python #Django #Htmx #DjangoChannels #DjangoLiveView

                                                                                                                                                                                                                                                                                                                                                                                        [?]Trey Hunner 🐍 » 🌐
                                                                                                                                                                                                                                                                                                                                                                                        @treyhunner@mastodon.social

                                                                                                                                                                                                                                                                                                                                                                                        Python Tip #240 (of 365):

                                                                                                                                                                                                                                                                                                                                                                                        Dunder methods are meant to be defined, but not called.

                                                                                                                                                                                                                                                                                                                                                                                        Do this:
                                                                                                                                                                                                                                                                                                                                                                                        str(today)

                                                                                                                                                                                                                                                                                                                                                                                        Not this:
                                                                                                                                                                                                                                                                                                                                                                                        today.__str__()

                                                                                                                                                                                                                                                                                                                                                                                        Why avoid calling dunder methods?

                                                                                                                                                                                                                                                                                                                                                                                        Mostly because you're not supposed to.

                                                                                                                                                                                                                                                                                                                                                                                        Dunder methods are a contract between Python and whoever wrote the class: Python calls them, we use the operations they power.

                                                                                                                                                                                                                                                                                                                                                                                        🧵 (1/3)

                                                                                                                                                                                                                                                                                                                                                                                          [?]Trey Hunner 🐍 » 🌐
                                                                                                                                                                                                                                                                                                                                                                                          @treyhunner@mastodon.social

                                                                                                                                                                                                                                                                                                                                                                                          “So if you need a stack-like structure in Python, use a list.”

                                                                                                                                                                                                                                                                                                                                                                                          Read more 👉 pym.dev/stacks-and-queues/

                                                                                                                                                                                                                                                                                                                                                                                            [?]Curated Hacker News » 🤖 🌐
                                                                                                                                                                                                                                                                                                                                                                                            @CuratedHackerNews@mastodon.social

                                                                                                                                                                                                                                                                                                                                                                                            HTTPX2 – A next-generation HTTP client for Python

                                                                                                                                                                                                                                                                                                                                                                                            github.com/pydantic/httpx2

                                                                                                                                                                                                                                                                                                                                                                                              [?]Lien Rag » 🌐
                                                                                                                                                                                                                                                                                                                                                                                              @lienrag@mastodon.tedomum.net

                                                                                                                                                                                                                                                                                                                                                                                              Dires les pythoneux, y'a un moyen de savoir de quel fichier (d'un répertoire donné) on doit importer les modules qu'on veut utiliser ?
                                                                                                                                                                                                                                                                                                                                                                                              J'avais du code qui fonctionnait avec une version précédente de FreeOrion mais depuis ils ont complètement réorganisé les modules donc y'a plus rien qui marche...

                                                                                                                                                                                                                                                                                                                                                                                                [?]Trey Hunner 🐍 » 🌐
                                                                                                                                                                                                                                                                                                                                                                                                @treyhunner@mastodon.social

                                                                                                                                                                                                                                                                                                                                                                                                Python Tip #239 (of 365):

                                                                                                                                                                                                                                                                                                                                                                                                When implementing __eq__, return NotImplemented for objects you don't know how to work with.

                                                                                                                                                                                                                                                                                                                                                                                                Filling in __eq__ on yesterday's Version class (__lt__ would need the same check):

                                                                                                                                                                                                                                                                                                                                                                                                class Version:
                                                                                                                                                                                                                                                                                                                                                                                                ... # self.‍parts is (major, minor, patch)
                                                                                                                                                                                                                                                                                                                                                                                                def __eq__(self, other):
                                                                                                                                                                                                                                                                                                                                                                                                if not isinstance(other, Version):
                                                                                                                                                                                                                                                                                                                                                                                                return NotImplemented
                                                                                                                                                                                                                                                                                                                                                                                                return self.‍parts == other.‍parts

                                                                                                                                                                                                                                                                                                                                                                                                🧵 (1/3)

                                                                                                                                                                                                                                                                                                                                                                                                  [?]Trey Hunner 🐍 » 🌐
                                                                                                                                                                                                                                                                                                                                                                                                  @treyhunner@mastodon.social

                                                                                                                                                                                                                                                                                                                                                                                                  “But duck typing and the isinstance function are not mutually exclusive.”

                                                                                                                                                                                                                                                                                                                                                                                                  Read more 👉 pym.dev/goose-typing/

                                                                                                                                                                                                                                                                                                                                                                                                    [?]Trey Hunner 🐍 » 🌐
                                                                                                                                                                                                                                                                                                                                                                                                    @treyhunner@mastodon.social

                                                                                                                                                                                                                                                                                                                                                                                                    My screencast on Python's special NotImplemented value is now public.

                                                                                                                                                                                                                                                                                                                                                                                                    Screencast: youtu.be/wI4K7faxZ_Q

                                                                                                                                                                                                                                                                                                                                                                                                    Article: pym.dev/when-to-use-notimpleme

                                                                                                                                                                                                                                                                                                                                                                                                    NotImplemented is something you'll want to know if you ever implement __eq__ or various other "operate on another object"-style dunder methods.

                                                                                                                                                                                                                                                                                                                                                                                                    This:

                                                                                                                                                                                                                                                                                                                                                                                                    >>> 2 == 2.0
                                                                                                                                                                                                                                                                                                                                                                                                    True

                                                                                                                                                                                                                                                                                                                                                                                                    Isn't the same as:

                                                                                                                                                                                                                                                                                                                                                                                                    >>> (2).__eq__(2.0)
                                                                                                                                                                                                                                                                                                                                                                                                    NotImplemented

                                                                                                                                                                                                                                                                                                                                                                                                      [?]codingjoe :django: :python: » 🌐
                                                                                                                                                                                                                                                                                                                                                                                                      @codingjoe@fosstodon.org

                                                                                                                                                                                                                                                                                                                                                                                                      Q: What does a company need to become an open source champion? I want to launch another one (soon). And I want to really weave it into its DNA. Thoughts?

                                                                                                                                                                                                                                                                                                                                                                                                        [?]Hugo van Kemenade » 🌐
                                                                                                                                                                                                                                                                                                                                                                                                        @hugovk@mastodon.social

                                                                                                                                                                                                                                                                                                                                                                                                        🔤🦥 isort 9.0 0 now supports Python 3.15 and sorting lazy imports 🎉
                                                                                                                                                                                                                                                                                                                                                                                                        github.com/PyCQA/isort/release

                                                                                                                                                                                                                                                                                                                                                                                                          [?]Hugo van Kemenade » 🌐
                                                                                                                                                                                                                                                                                                                                                                                                          @hugovk@mastodon.social

                                                                                                                                                                                                                                                                                                                                                                                                          🇪🇺🐍📽️ The EuroPython videos are all out!

                                                                                                                                                                                                                                                                                                                                                                                                          youtube.com/playlist?list=PLd3

                                                                                                                                                                                                                                                                                                                                                                                                          Reply with your picks and let's build a thread of recommendations!

                                                                                                                                                                                                                                                                                                                                                                                                            [?]Trey Hunner 🐍 » 🌐
                                                                                                                                                                                                                                                                                                                                                                                                            @treyhunner@mastodon.social

                                                                                                                                                                                                                                                                                                                                                                                                            Python Tip #238 (of 365):

                                                                                                                                                                                                                                                                                                                                                                                                            Don't write ordering methods by hand.

                                                                                                                                                                                                                                                                                                                                                                                                            Want your objects to support <, >, <=, and >=?

                                                                                                                                                                                                                                                                                                                                                                                                            You don't need to write them all!

                                                                                                                                                                                                                                                                                                                                                                                                            Implement __eq__ and ONE ordering method (like __lt__), then decorate with functools.total_ordering:

                                                                                                                                                                                                                                                                                                                                                                                                            @total_ordering
                                                                                                                                                                                                                                                                                                                                                                                                            class Version:
                                                                                                                                                                                                                                                                                                                                                                                                            ...
                                                                                                                                                                                                                                                                                                                                                                                                            def __eq__(self, other): ...
                                                                                                                                                                                                                                                                                                                                                                                                            def __lt__(self, other): ...

                                                                                                                                                                                                                                                                                                                                                                                                            🧵 (1/3)

                                                                                                                                                                                                                                                                                                                                                                                                              [?]Julien Riou » 🌐
                                                                                                                                                                                                                                                                                                                                                                                                              @jriou@hachyderm.io

                                                                                                                                                                                                                                                                                                                                                                                                              Hit by the Patroni HTTP API stuck issue, again.

                                                                                                                                                                                                                                                                                                                                                                                                              I have upgraded dozens of servers from Patroni 4.1.0 to 4.1.5 without issue last week. This morning, I continued to upgrade a couple more clusters. Today, we had two different freshly upgraded clusters down because the Patroni HTTP API is unresponsive. HAproxy stopped to send traffic because it thinks nodes are down, but Patroni and PostgreSQL looks healthy.

                                                                                                                                                                                                                                                                                                                                                                                                              This issue has been on and off for the last 10 years I've been using Patroni. Apparently, it's caused by a recent change in Python that brings back the issue.

                                                                                                                                                                                                                                                                                                                                                                                                              github.com/python/cpython/issu
                                                                                                                                                                                                                                                                                                                                                                                                              patroni.readthedocs.io/en/late

                                                                                                                                                                                                                                                                                                                                                                                                              I'm on call tonight. I've been paged twice already. I have set up the MALLOC_ARENA_MAX=1 and PG_MALLOC_ARENA_MAX environment variables on the last failing cluster and hope I'll have a good night sleep before pushing them everywhere tomorrow 🤞🏻

                                                                                                                                                                                                                                                                                                                                                                                                                [?]Trey Hunner 🐍 » 🌐
                                                                                                                                                                                                                                                                                                                                                                                                                @treyhunner@mastodon.social

                                                                                                                                                                                                                                                                                                                                                                                                                “What if we only want to continue onward if the subprocess exited successfully?”

                                                                                                                                                                                                                                                                                                                                                                                                                Read more 👉 pym.dev/running-subprocesses-i

                                                                                                                                                                                                                                                                                                                                                                                                                  [?]Marcos Dione » 🌐
                                                                                                                                                                                                                                                                                                                                                                                                                  @mdione@en.osm.town

                                                                                                                                                                                                                                                                                                                                                                                                                  @0xabad1dea TBF, 2) could also apply to at least , if not other languages.

                                                                                                                                                                                                                                                                                                                                                                                                                    [?]andros » 🌐
                                                                                                                                                                                                                                                                                                                                                                                                                    @andros@activity.andros.dev

                                                                                                                                                                                                                                                                                                                                                                                                                    I redesigned the Django LiveView website. I hope you like it!

                                                                                                                                                                                                                                                                                                                                                                                                                    https://django-liveview.andros.dev

                                                                                                                                                                                                                                                                                                                                                                                                                    #python #django #djangoliveview #liveview

                                                                                                                                                                                                                                                                                                                                                                                                                      WhilelM boosted

                                                                                                                                                                                                                                                                                                                                                                                                                      [?]anarcat » 🌐
                                                                                                                                                                                                                                                                                                                                                                                                                      @Anarcat@kolektiva.social

                                                                                                                                                                                                                                                                                                                                                                                                                      [?]Trey Hunner 🐍 » 🌐
                                                                                                                                                                                                                                                                                                                                                                                                                      @treyhunner@mastodon.social

                                                                                                                                                                                                                                                                                                                                                                                                                      Python Tip #237 (of 365):

                                                                                                                                                                                                                                                                                                                                                                                                                      Need a read-only attribute? Use a property.

                                                                                                                                                                                                                                                                                                                                                                                                                      Properties are read-only by default:

                                                                                                                                                                                                                                                                                                                                                                                                                      >>> s = Square(4)
                                                                                                                                                                                                                                                                                                                                                                                                                      >>> s.length
                                                                                                                                                                                                                                                                                                                                                                                                                      4
                                                                                                                                                                                                                                                                                                                                                                                                                      >>> s.length = 10
                                                                                                                                                                                                                                                                                                                                                                                                                      Traceback (most recent call last):
                                                                                                                                                                                                                                                                                                                                                                                                                      ...
                                                                                                                                                                                                                                                                                                                                                                                                                      AttributeError: property 'length' of 'Square' object has no setter

                                                                                                                                                                                                                                                                                                                                                                                                                      🧵 (1/3)

                                                                                                                                                                                                                                                                                                                                                                                                                        [?]Marcos Dione » 🌐
                                                                                                                                                                                                                                                                                                                                                                                                                        @mdione@en.osm.town

                                                                                                                                                                                                                                                                                                                                                                                                                        Any users also using the bindings for ? If you didn't know, `python3-mapnik` has been removed from the unstable and testing releases; it still works in stable.

                                                                                                                                                                                                                                                                                                                                                                                                                        I have spent a few days building new packages based on the 4.3.0 release. I'm looking for potential testers; it WorksForMe™, but I want to make sure it doesn't break other setups. Have in account that this release has made some changes to the bindings, so your code might not work as is (mine didn't).

                                                                                                                                                                                                                                                                                                                                                                                                                          [?]Python Software Foundation » 🌐
                                                                                                                                                                                                                                                                                                                                                                                                                          @ThePSF@fosstodon.org

                                                                                                                                                                                                                                                                                                                                                                                                                          The PSF Board election vote kicks off in a week 🗳️🐍 In an effort to promote informed voting, the PSF Board Election Team has invited this year’s candidates to participate in a written interview. Check out the interviews on the PSF blog ⬇️

                                                                                                                                                                                                                                                                                                                                                                                                                          pyfound.blogspot.com/search/la

                                                                                                                                                                                                                                                                                                                                                                                                                            [?]Trey Hunner 🐍 » 🌐
                                                                                                                                                                                                                                                                                                                                                                                                                            @treyhunner@mastodon.social

                                                                                                                                                                                                                                                                                                                                                                                                                            “In Computer Science, stacks and queues are data structures that are optimized to make it inexpensive to remove either the most recently added item or the least recently added item.”

                                                                                                                                                                                                                                                                                                                                                                                                                            Read more 👉 pym.dev/stacks-and-queues/

                                                                                                                                                                                                                                                                                                                                                                                                                              [?]Trey Hunner 🐍 » 🌐
                                                                                                                                                                                                                                                                                                                                                                                                                              @treyhunner@mastodon.social

                                                                                                                                                                                                                                                                                                                                                                                                                              Python Tip #236 (of 365):

                                                                                                                                                                                                                                                                                                                                                                                                                              Don't write getter and setter methods in Python.

                                                                                                                                                                                                                                                                                                                                                                                                                              If you need to customize what happens when an attribute is accessed or assigned, use a property.

                                                                                                                                                                                                                                                                                                                                                                                                                              In Java, it's best practice to use getters and setters instead of direct attribute access, in case you ever need to customize them.

                                                                                                                                                                                                                                                                                                                                                                                                                              In Python, we just use attributes.

                                                                                                                                                                                                                                                                                                                                                                                                                              When we DO need to customize attribute access, we make a property. Here's one that rejects negative stock values:

                                                                                                                                                                                                                                                                                                                                                                                                                              🧵 (1/4)

                                                                                                                                                                                                                                                                                                                                                                                                                                [?]marcink » 🌐
                                                                                                                                                                                                                                                                                                                                                                                                                                @marcink@stolat.town

                                                                                                                                                                                                                                                                                                                                                                                                                                Three days left until the first no-gen-AI meetup in ! We meet in Le Taille Crayon on Monday at 19:00.
                                                                                                                                                                                                                                                                                                                                                                                                                                We will have a third presentation: using to write macros for . That is in addition to the previous two: a comparison of and , and building a community around the open source app.
                                                                                                                                                                                                                                                                                                                                                                                                                                If you are interested: please register, see stolat.town/@marcink/117079431
                                                                                                                                                                                                                                                                                                                                                                                                                                If you know someone who might be: please help us by boosting or forwarding the link!

                                                                                                                                                                                                                                                                                                                                                                                                                                  [?]Ned Batchelder » 🌐
                                                                                                                                                                                                                                                                                                                                                                                                                                  @nedbat@hachyderm.io

                                                                                                                                                                                                                                                                                                                                                                                                                                  In the Discord, someone was trying to understand how Python code is executed without ever being turned into native CPU instructions. So I wrote a tiny programming language compiling to bytecodes. 300 lines of Python.
                                                                                                                                                                                                                                                                                                                                                                                                                                  nedbatchelder.com/blog/202608/

                                                                                                                                                                                                                                                                                                                                                                                                                                    [?]Trey Hunner 🐍 » 🌐
                                                                                                                                                                                                                                                                                                                                                                                                                                    @treyhunner@mastodon.social

                                                                                                                                                                                                                                                                                                                                                                                                                                    “Even if our code was inside a function, it is sometimes useful to break out of a loop without also returning from our function.”

                                                                                                                                                                                                                                                                                                                                                                                                                                    Read more 👉 pym.dev/breaking-out-of-a-loop/

                                                                                                                                                                                                                                                                                                                                                                                                                                      [?]Trey Hunner 🐍 » 🌐
                                                                                                                                                                                                                                                                                                                                                                                                                                      @treyhunner@mastodon.social

                                                                                                                                                                                                                                                                                                                                                                                                                                      Python Tip #235 (of 365):

                                                                                                                                                                                                                                                                                                                                                                                                                                      Don't use super() when "self" would work instead

                                                                                                                                                                                                                                                                                                                                                                                                                                      super() has one primary job: calling the parent class's version of a method you're overriding.

                                                                                                                                                                                                                                                                                                                                                                                                                                      A super() call that isn't doing that job probably shouldn't be there.

                                                                                                                                                                                                                                                                                                                                                                                                                                      Here's a subclass of a tree-like Node class:

                                                                                                                                                                                                                                                                                                                                                                                                                                      class DoublyLinkedNode(Node):
                                                                                                                                                                                                                                                                                                                                                                                                                                      ...
                                                                                                                                                                                                                                                                                                                                                                                                                                      def parents(self):
                                                                                                                                                                                                                                                                                                                                                                                                                                      return super().parents()

                                                                                                                                                                                                                                                                                                                                                                                                                                      That parents method shouldn't exist. Each parent method is inherited by default.

                                                                                                                                                                                                                                                                                                                                                                                                                                      🧵 (1/3)

                                                                                                                                                                                                                                                                                                                                                                                                                                        [?]Curated Hacker News » 🤖 🌐
                                                                                                                                                                                                                                                                                                                                                                                                                                        @CuratedHackerNews@mastodon.social

                                                                                                                                                                                                                                                                                                                                                                                                                                        Thinking in Python by Bruce Eckel

                                                                                                                                                                                                                                                                                                                                                                                                                                        thinkinginpython.com/

                                                                                                                                                                                                                                                                                                                                                                                                                                          [?]Trey Hunner 🐍 » 🌐
                                                                                                                                                                                                                                                                                                                                                                                                                                          @treyhunner@mastodon.social

                                                                                                                                                                                                                                                                                                                                                                                                                                          Python Tip #234 (of 365):

                                                                                                                                                                                                                                                                                                                                                                                                                                          Don't inherit from list or dict. You could end up with some weird bugs.

                                                                                                                                                                                                                                                                                                                                                                                                                                          Say we make a bi-directional dictionary by customizing __setitem__:

                                                                                                                                                                                                                                                                                                                                                                                                                                          class TwoWayDict(dict):
                                                                                                                                                                                                                                                                                                                                                                                                                                          def __setitem__(self, key, value):
                                                                                                                                                                                                                                                                                                                                                                                                                                          super().__setitem__(key, value)
                                                                                                                                                                                                                                                                                                                                                                                                                                          super().__setitem__(value, key)

                                                                                                                                                                                                                                                                                                                                                                                                                                          >>> d = TwoWayDict()
                                                                                                                                                                                                                                                                                                                                                                                                                                          >>> d[3] = 8
                                                                                                                                                                                                                                                                                                                                                                                                                                          >>> d
                                                                                                                                                                                                                                                                                                                                                                                                                                          {3: 8, 8: 3}

                                                                                                                                                                                                                                                                                                                                                                                                                                          And it seems to work... except when it doesn't:

                                                                                                                                                                                                                                                                                                                                                                                                                                          >>> d.update({9: 7})
                                                                                                                                                                                                                                                                                                                                                                                                                                          >>> d
                                                                                                                                                                                                                                                                                                                                                                                                                                          {3: 8, 8: 3, 9: 7}

                                                                                                                                                                                                                                                                                                                                                                                                                                          🧵 (1/3)

                                                                                                                                                                                                                                                                                                                                                                                                                                            [?]Trey Hunner 🐍 » 🌐
                                                                                                                                                                                                                                                                                                                                                                                                                                            @treyhunner@mastodon.social

                                                                                                                                                                                                                                                                                                                                                                                                                                            “And if you find yourself wanting to ask about the common or unique values between two collections, you can use set arithmetic.”

                                                                                                                                                                                                                                                                                                                                                                                                                                            Read more 👉 pym.dev/practical-uses-of-sets/

                                                                                                                                                                                                                                                                                                                                                                                                                                              [?]Mariusz Felisiak » 🌐
                                                                                                                                                                                                                                                                                                                                                                                                                                              @felixxm@fosstodon.org

                                                                                                                                                                                                                                                                                                                                                                                                                                              Django 6.1 was released this month 🎉 with exciting features such as database-level delete options, fetch modes, or UUID7() database function 🤩 Big thanks to all 210 contributors who pushed 907 commits and to the other anonymous heroes who made it possible 👏 👏 💚

                                                                                                                                                                                                                                                                                                                                                                                                                                              gist.github.com/felixxm/8f6689

                                                                                                                                                                                                                                                                                                                                                                                                                                                [?]Mariatta 🤦🏻‍♀️ :python: » 🌐
                                                                                                                                                                                                                                                                                                                                                                                                                                                @mariatta@fosstodon.org

                                                                                                                                                                                                                                                                                                                                                                                                                                                10 years of public speaking and 10 years of Ice cream selfie.

                                                                                                                                                                                                                                                                                                                                                                                                                                                Next one's at PyCon Portugal

                                                                                                                                                                                                                                                                                                                                                                                                                                                See you there?

                                                                                                                                                                                                                                                                                                                                                                                                                                                2026.pycon.pt/

                                                                                                                                                                                                                                                                                                                                                                                                                                                Alt...10 years of public speaking and ice cream selfie. Next one's at PyCon Portugal. Register and see you there.

                                                                                                                                                                                                                                                                                                                                                                                                                                                  [?]Project Jupyter » 🌐
                                                                                                                                                                                                                                                                                                                                                                                                                                                  @ProjectJupyter@hachyderm.io

                                                                                                                                                                                                                                                                                                                                                                                                                                                  JupyterLite 0.8 is here, and it's a big one for running Jupyter fully in the browser with zero server setup.

                                                                                                                                                                                                                                                                                                                                                                                                                                                  New in this release: a Copy Shareable Link button for REPLs, a refreshed loading screen, file system reliability fixes, an in-browser terminal running real WebAssembly tools (ls, git, vim, grep, and more), more kernels through jupyterlite-xeus, and Python 3.14 via the updated Pyodide kernel.

                                                                                                                                                                                                                                                                                                                                                                                                                                                  9 new features, 11 bug fixes, 13 contributors.

                                                                                                                                                                                                                                                                                                                                                                                                                                                  Try it now, no install needed: jupyter.org/try-jupyter

                                                                                                                                                                                                                                                                                                                                                                                                                                                    [?]Johnny Graber » 🌐
                                                                                                                                                                                                                                                                                                                                                                                                                                                    @JGraber@mastodon.social

                                                                                                                                                                                                                                                                                                                                                                                                                                                    [?]Paolo Melchiorre » 🌐
                                                                                                                                                                                                                                                                                                                                                                                                                                                    @paulox@fosstodon.org

                                                                                                                                                                                                                                                                                                                                                                                                                                                    Hey @freakboy3742 it can be interesting collecting all mobile apps written in Python like this attempt done for gtk4 based android application
                                                                                                                                                                                                                                                                                                                                                                                                                                                    gtk4android.geopjr.dev/

                                                                                                                                                                                                                                                                                                                                                                                                                                                      [?]Trey Hunner 🐍 » 🌐
                                                                                                                                                                                                                                                                                                                                                                                                                                                      @treyhunner@mastodon.social

                                                                                                                                                                                                                                                                                                                                                                                                                                                      Python Tip #233 (of 365):

                                                                                                                                                                                                                                                                                                                                                                                                                                                      Don't return self from a method just to allow method chaining.

                                                                                                                                                                                                                                                                                                                                                                                                                                                      In Python, methods that mutate an object usually return None.

                                                                                                                                                                                                                                                                                                                                                                                                                                                      Functions and methods either RETURN a thing or DO a thing, but usually not both.

                                                                                                                                                                                                                                                                                                                                                                                                                                                      You may be tempted to make a mutating method return self so that calls can be chained:

                                                                                                                                                                                                                                                                                                                                                                                                                                                      tasks = (
                                                                                                                                                                                                                                                                                                                                                                                                                                                      TodoList()
                                                                                                                                                                                                                                                                                                                                                                                                                                                      .add_task("Publish weekly email")
                                                                                                                                                                                                                                                                                                                                                                                                                                                      .add_task("Record screencast")
                                                                                                                                                                                                                                                                                                                                                                                                                                                      )

                                                                                                                                                                                                                                                                                                                                                                                                                                                      This works, but it's VERY unconvntional!

                                                                                                                                                                                                                                                                                                                                                                                                                                                      🧵 (1/4)

                                                                                                                                                                                                                                                                                                                                                                                                                                                        [?]Pffff... » 🌐
                                                                                                                                                                                                                                                                                                                                                                                                                                                        @1HommeAzerty@mamot.fr

                                                                                                                                                                                                                                                                                                                                                                                                                                                        Je vous raconte, c'est tordu.

                                                                                                                                                                                                                                                                                                                                                                                                                                                        J'exécute subprocess.Popen(["ipython", "kernel", f"-f={cfg}"]) pour lancer un kernel et m'y connecter plus tard.

                                                                                                                                                                                                                                                                                                                                                                                                                                                        Si cfg est un chemin relatif (genre "./toto"), rien à signaler. Mais si cfg est un chemin absolu (genre "/home/azerty/foo/toto"), alors mon son parent ("foo") reçoit le bit t. C'est n'importe quoi...

                                                                                                                                                                                                                                                                                                                                                                                                                                                        Pour arranger les choses, les dev de ont limité la soumission de bugs aux devs du projet. Bah on va vivre avec ça du coup...

                                                                                                                                                                                                                                                                                                                                                                                                                                                          AodeRelay boosted

                                                                                                                                                                                                                                                                                                                                                                                                                                                          [?]Trey Hunner 🐍 » 🌐
                                                                                                                                                                                                                                                                                                                                                                                                                                                          @treyhunner@mastodon.social

                                                                                                                                                                                                                                                                                                                                                                                                                                                          LWN covered my talk on pathlib from !

                                                                                                                                                                                                                                                                                                                                                                                                                                                          If you're using and not using the pathlib module, check it out. I think that it's one of the most underused modules in the Python standard library.

                                                                                                                                                                                                                                                                                                                                                                                                                                                          lwn.net/SubscriberLink/1088781

                                                                                                                                                                                                                                                                                                                                                                                                                                                            [?]Python Software Foundation » 🌐
                                                                                                                                                                                                                                                                                                                                                                                                                                                            @ThePSF@fosstodon.org

                                                                                                                                                                                                                                                                                                                                                                                                                                                            ¡Para la próxima semana el grupo de trabajo de Diversidad e Inclusión de PSF tendrá un espacio en el Discord de la PSF!

                                                                                                                                                                                                                                                                                                                                                                                                                                                            Únete el August 25 9 PM UTC en el canal -diversity para charlar, hacer preguntas y compartir en qué estás trabajando 🐍🗺️

                                                                                                                                                                                                                                                                                                                                                                                                                                                            pyfound.blogspot.com/2026/07/t

                                                                                                                                                                                                                                                                                                                                                                                                                                                              [?]Python Software Foundation » 🌐
                                                                                                                                                                                                                                                                                                                                                                                                                                                              @ThePSF@fosstodon.org

                                                                                                                                                                                                                                                                                                                                                                                                                                                              The PSF Diversity & Inclusion Workgroup monthly office hours are next week on the PSF Discord!

                                                                                                                                                                                                                                                                                                                                                                                                                                                              Join us August 25 9 PM UTC in -diversity to chat, ask questions, and share what you're working on 🐍🗺️


                                                                                                                                                                                                                                                                                                                                                                                                                                                              pyfound.blogspot.com/2026/07/t

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Lily boosted

                                                                                                                                                                                                                                                                                                                                                                                                                                                                [?]Thayer » 🌐
                                                                                                                                                                                                                                                                                                                                                                                                                                                                @Thayer@mastodon.social

                                                                                                                                                                                                                                                                                                                                                                                                                                                                UK based only - Senior Developer for The Electoral Commission // £70,000 // fully remote possible, hybrid at UK hubs also fine if your preference.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Fancy working with interesting data problems, and services that need to scale to millions of voters? You'll help bring a major voter-information service in-house and shape what comes next.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                YOUR COUNTRY NEEDS YOU! We all need you. Plz.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Interested? I'm sole recruiter for this > thayer@team-prime.com CVs pls!

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  [?]Graham Dumpleton » 🌐
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  @grahamdumpleton@mastodon.social

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  I built a new thing, an idea I have wanted to try for a long time.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Since writing wrapt, the idea was to build on it for two jobs I saw as one: unit testing in the spirit of mock, and tracing execution across real code. Same bindings for both, no changes to the code being observed. wrapture is the answer I ended up with.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  First alpha on PyPI. Curious what people make of it.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  github.com/GrahamDumpleton/wra

                                                                                                                                                                                                                                                                                                                                                                                                                                                                    [?]LWN.net » 🌐
                                                                                                                                                                                                                                                                                                                                                                                                                                                                    @lwn@fedi.lwn.net

                                                                                                                                                                                                                                                                                                                                                                                                                                                                    [$] Representing Python paths using pathlib

                                                                                                                                                                                                                                                                                                                                                                                                                                                                    At the outset of his PyCon US 2026 talk, Trey Hunner said that his goal was for attendees to stop representing filesystem paths as strings and to use pathlib instead. That's kind [...]

                                                                                                                                                                                                                                                                                                                                                                                                                                                                    lwn.net/Articles/1088781/

                                                                                                                                                                                                                                                                                                                                                                                                                                                                      [?]Trey Hunner 🐍 » 🌐
                                                                                                                                                                                                                                                                                                                                                                                                                                                                      @treyhunner@mastodon.social

                                                                                                                                                                                                                                                                                                                                                                                                                                                                      Python Tip #232 (of 365):

                                                                                                                                                                                                                                                                                                                                                                                                                                                                      Try to avoid static methods in Python.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                      A static method is a function that HAPPENS to live on a class. It doesn't know the instance (or class) it's called on.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                      They're usually helper functions that live on a class for organizational reasons:

                                                                                                                                                                                                                                                                                                                                                                                                                                                                      class Hasher:
                                                                                                                                                                                                                                                                                                                                                                                                                                                                      ...
                                                                                                                                                                                                                                                                                                                                                                                                                                                                      @staticmethod
                                                                                                                                                                                                                                                                                                                                                                                                                                                                      def _checksum_matches(hash_object, checksum):
                                                                                                                                                                                                                                                                                                                                                                                                                                                                      checksum_bytes = bytes.fromhex(checksum)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                      return checksum_bytes == hash_object.digest()

                                                                                                                                                                                                                                                                                                                                                                                                                                                                      🧵 (1/3)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                        Hachiko boosted

                                                                                                                                                                                                                                                                                                                                                                                                                                                                        [?]Milka64 » 🌐
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        @milka64@mastodon.social

                                                                                                                                                                                                                                                                                                                                                                                                                                                                        Nouvelle instance (comment ça 10 jours ?), nouvelle intro !
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        Admin sys Linux/BSD et adepte du logiciel libre.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        Je bricole et, code en Python
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        je parle parfois de science.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        Je préfère l’intelligence artisanale à l’intelligence artificielle.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        Héberger ses données plutôt que de les offrir aux GAFAM.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        Team et je m'interresse aux

                                                                                                                                                                                                                                                                                                                                                                                                                                                                          [?]Hugo van Kemenade » 🌐
                                                                                                                                                                                                                                                                                                                                                                                                                                                                          @hugovk@mastodon.social

                                                                                                                                                                                                                                                                                                                                                                                                                                                                          RE: mastodon.world/@hamatti/117127

                                                                                                                                                                                                                                                                                                                                                                                                                                                                          Some neat startup script tips in here, and for Python 3.15 you could do this for nicer pprint output:

                                                                                                                                                                                                                                                                                                                                                                                                                                                                          pp = Printer(expand=True, indent=4)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                            [?]Mariatta 🤦🏻‍♀️ :python: » 🌐
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            @mariatta@fosstodon.org

                                                                                                                                                                                                                                                                                                                                                                                                                                                                            Does your local meetup community need a website? Because I have just the theme for you.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                            Every community I've helped run has needed a website, and every time, we'd spent time hours browsing for themes and ended up rebuilding it from scratch, because none of the themes are meant for communities. Until now.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                            Introducing "Popular", a static site theme built especially for community & meetup groups, works in Hugo & Astro.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                            Blog: mariatta.ca/posts/no-more-rebu

                                                                                                                                                                                                                                                                                                                                                                                                                                                                              [?]Trey Hunner 🐍 » 🌐
                                                                                                                                                                                                                                                                                                                                                                                                                                                                              @treyhunner@mastodon.social

                                                                                                                                                                                                                                                                                                                                                                                                                                                                              Python Tip #231 (of 365):

                                                                                                                                                                                                                                                                                                                                                                                                                                                                              Use class methods as alternate constructors.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                              >>> s = Square.from_area(100)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                              >>> s.length
                                                                                                                                                                                                                                                                                                                                                                                                                                                                              10.0

                                                                                                                                                                                                                                                                                                                                                                                                                                                                              The classmethod decorator makes a method that's meant to be called on the class itself (not on an instance):

                                                                                                                                                                                                                                                                                                                                                                                                                                                                              import math

                                                                                                                                                                                                                                                                                                                                                                                                                                                                              class Square:
                                                                                                                                                                                                                                                                                                                                                                                                                                                                              def __init__(self, length, color=None):
                                                                                                                                                                                                                                                                                                                                                                                                                                                                              self.length = length
                                                                                                                                                                                                                                                                                                                                                                                                                                                                              self.color = color
                                                                                                                                                                                                                                                                                                                                                                                                                                                                              @classmethod
                                                                                                                                                                                                                                                                                                                                                                                                                                                                              def from_area(cls, area, color=None):
                                                                                                                                                                                                                                                                                                                                                                                                                                                                              return cls(math.sqrt(area), color)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                              🧵 (1/4)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                Marcos Dione boosted

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                [?]Glyph » 🌐
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                @glyph@mastodon.social

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                We could really use some help with Twisted's and implementation. Could you DM if these terms of are of interest to you and if you have any spare capacity to review a little bit of code? It would be much appreciated.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  [?]Trey Hunner 🐍 » 🌐
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  @treyhunner@mastodon.social

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  “You can think of abstract base classes that rely on registering as similar to an opt-in duck.”

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Read more 👉 pym.dev/goose-typing/

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    James C boosted

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    [?]Yann Büchau :nixos: » 🌐
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    @nobodyinperson@fosstodon.org

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    Holy cow, remember to clean your cache from time to time, folks 😅

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    UPDATE: Seems to contain some links, deleting the cache only freed like 9GiB, but still...

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    /home/yann/.cache/uv/
27,6 GiB
505.110 Dateien (15 %)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    Alt.../home/yann/.cache/uv/ 27,6 GiB 505.110 Dateien (15 %)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      [?]anarcat » 🌐
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      @Anarcat@kolektiva.social

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      [?]Trey Hunner 🐍 » 🌐
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      @treyhunner@mastodon.social

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      The Python Morsels REPL now runs on the new pyrepl! In browsers that don't support JSPI.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      pym.dev/repl

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      As of very recently, both Chrome and Firefox support the JavaScript Promise Interface, which is what's needed to get pyrepl (the new REPL in Python 3.13+) to work in WebAssembly.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      it falls back to the old REPL.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      Thanks to @ambv & whoever else helped (can't seem to find the PR) with getting pyrepl working in the browser!

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        [?]Hugo van Kemenade » 🌐
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        @hugovk@mastodon.social

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        [?]Python Software Foundation » 🌐
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        @ThePSF@fosstodon.org

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        runs on ~zero AWS cost thanks to @fastlydevs caching 99% of traffic + AWS credits covering the rest. Huge thanks to both! But 2026 broke an 8-year streak: AWS spend is up 69% YoY as agents & CI runs surge.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        @Monorepo, PSF Director of Engineering, on what's changing: pyfound.blogspot.com/2026/08/h

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          Lily boosted

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          [?]rixx » 🌐
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          @rixx@chaos.social

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          Gunicorn now categorises "Framework returns content on HEAD requests" as a bug, and warns about it for every request.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          Django's position is "Web servers should automatically strip the content of responses to HEAD requests while leaving the headers unchanged".

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          So, that's fun! 🫠
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          (Screenshot shows ASGI commit, but it was added to WSGI too.)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          Django docs screenshot, highlight reads "Web servers should automatically strip the content of responses to HEAD requests while leaving the headers unchanged"

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          Alt...Django docs screenshot, highlight reads "Web servers should automatically strip the content of responses to HEAD requests while leaving the headers unchanged"

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          gunicorn commit, message: fix: warn once when ASGI app emits a body for a no-body response
A framework bug — say, returning bytes from a HEAD or 204 handler — is
now logged at WARNING level the first time it happens for a request
so the misbehavior is visible without spamming on multi-chunk streams.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          Alt...gunicorn commit, message: fix: warn once when ASGI app emits a body for a no-body response A framework bug — say, returning bytes from a HEAD or 204 handler — is now logged at WARNING level the first time it happens for a request so the misbehavior is visible without spamming on multi-chunk streams.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            [?]Trey Hunner 🐍 » 🌐
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            @treyhunner@mastodon.social

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            Python Tip #230 (of 365):

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            Use a single underscore prefix for internal attributes.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            This _digits attribute is private... but only by convention:

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            import re

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            class PhoneNumber:
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            def __init__(self, number):
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            self._digits = re.sub(r"\D", "", number)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            ...

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            This (not fully implemented) class includes str() and an area_code attribute as its public interface:

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            >>> wh = PhoneNumber("(202) 456-1414")
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            >>> print(wh)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            202-456-1414
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            >>> wh.area_code
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            '202'

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            🧵 (1/3)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              [?]Adam Johnson :django: :python: » 🌐
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              @adamchainz@fosstodon.org

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              ✍️ I used my leet prompt engineering skillz to fix a bunch of bugs in django-upgrade

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              adamj.eu/tech/2026/08/18/djang

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                [?]Luyin [https://pronouns.page/u/luyin] » 🌐
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                @luyin@lgbtqia.space

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                Alright Fedi, I'm looking for a job out of AI hell. I know chances aren't great for anyone right now, but I'm taking mine anyway.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                I'm a (senior?) developer with 10 years of experience in both and (with a preference for the latter). I can find my way around and don't shy away from . I've done a bit of lately and haven't found it terrible.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                I thrive in team environments where I have time both to work on my own and in pairs or mobs ( mob.sh is a great tool I'd use again, but IntelliJ's Code With Me works too).

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                My greatest passion is automating the tasks around coding away - testing, building, deploying code with either the shortest set of commands or just fully automated from a pipeline on pull/merge requests.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                I won't say no to places that require me to use AI, but I have a strong preference to be able to write my code myself.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                Would love boosts for reach! Also thanks for reading 💖

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  [?]Trey Hunner 🐍 » 🌐
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  @treyhunner@mastodon.social

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  “We can automatically decode the output of this process using the default character encoding, by specifying text=True when we call subprocess.run:”

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Read more 👉 pym.dev/running-subprocesses-i

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    Corentin boosted

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    [?]andros » 🌐
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    @andros@activity.andros.dev

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    «Finger: the 1971 social network that never died»

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    It will surprise more than a few of you to hear that the first social network dates back to 1971; no accounts, no algorithm, no central server, just a plain text file you control.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    https://en.andros.dev/blog/54572bc7/finger-the-1971-social-network-that-never-died/

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    #Gemini #IndieWeb #OpenSource #Python #Linux #OrgSocial

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      Debacle boosted

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      [?]LWN.net » 🌐
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      @lwn@fedi.lwn.net

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      [$] Bootstrappable builds: how and why

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      This year's edition of the Free and Open Source Software Yearly conference, better known as "FOSSY", moved north to the beautiful (and enormous) campus of the University of British [...]

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      lwn.net/Articles/1088279/

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        AodeRelay boosted

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        [?]sven222 » 🌐
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        @sven222@goto.hardwarepunk.de

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        Ich habe mir letzte Woche von einem LLM ein kleines Pythonscript erstellen lassen. Es sollte meine .ssh/config auslesen, dort jeden eingetragenen Host finden, und dann für jeden Host einen übergebenen Befehl ausführen. Also ich rufe "./remote.py apt update" auf, und dadurch soll für jeden Host "ssh hostname apt update" aufgerufen werden. Bis alles funktioniert hat, dauerte es ca. 20min. Leider waren da recht komplexe Regular Expressions drinnen (ein Kenntnis die ich immer noch nicht erlangt habe) und ich habe nicht wirklich jede Zeile verstanden was dort vor sich ging. Wenn ich mich selbst hinsetze und das schreibe, was ich gerade versucht habe, brauche ich auch 20min. Habe dabei aber wieder etwas mehr Python gelernt anstatt prompts so zu formulieren, dass auch das dabei herauskommt was ich möchte. Ein weiterer Vorteil: ich verstehe jede Zeile meines Scripts.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        Mein Script ist übrigens eine Zeile kürzer wie das generierte, auch wenn das nur das "import re" ist, welches wegfällt. Ich programmiere ja viel Automatisierungen in der Industrie. Da sind wir es gewohnt lieber eine Zeile mehr zu programmieren, dafür ist es lesbarer für die Person, die das nach uns maintainen muss.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        Um fair zu sein sollte ich sagen, dass ich einige Fehler schon umgehen konnte, weil das LLM die schong emacht hatte, ich also eventuell selbst 5 - 10min länger gebraucht hätte.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        #linux #homeserver #python #scripting

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          AodeRelay boosted

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          [?]VibeOps » 🌐
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          @vibeops@techhub.social

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          Bei uns steht eine an - die ist weit weg - läuft n Jahr 24/7

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          Mein Ich von 201x würd hier Programm schreiben und ne Kiste verwenden mit ner remote Desktop Lösungen aka anydesk

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          Mein 2025 Ich hat schon dazu gelernt und ich hab n schickes Programm entwickelt... Auf dem - aber das ist lief auch schon testweise aufm

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          Da wir das irgendwo Vorort Aufbau wollen wäre Laptop die beste Lösung - also mal im Schrank geschaut was da noch so ist: hp probook 650 g1 - i5 4gen 8gb RAM SSD drin -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          Debian mit KDE Plasma darauf - installiert - und dann wurde mir erst klar wie genial das wieder mal ist...

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          Hermes mit hat Programm gecloned und automatisch in Betrieb genommen - hätte ich auch noch hinbekommen - Zeit gespart

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          Mit Hermes und der Kommunikation über Matrix brauchen wir uns keine Gedanken über Netzwerk-Ports machen im Ziel Gebäude - alternativ können wir tailscale nach Installatieren

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          Mit Hermes hab ich ein System das die Messung überwachen kann - läuft noch alles? Und dann direkt Bescheid sagt

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          Noch verrückter - er kann mir dort Vorort auch debuggen und ggf fehler beheben obwohl das Gerät schon 400km weg von mir ist - wie wenn ich davor sitze

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          Ich mach das mit den VServer Tag täglich - aber das mein Messtechnik Job so viel einfacher wird - das wird mir jetzt erst klar

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          Könnte theoretisch 100 solche Messungen betreuen 🤯

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            [?]Trey Hunner 🐍 » 🌐
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            @treyhunner@mastodon.social

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            Python Tip #229 (of 365):

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            Don't overuse classes.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            Writing Python code does NOT require writing classes.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            Unlike many programming languages, you can accomplish quite a bit in Python without ever making a class.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            The most common reason to write a class is that a framework REQUIRES one (like Django's Model classes).

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            The best reason to write your OWN class: you have data and functionality that clearly belong together.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            🧵 (1/3)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              [?]Hugo van Kemenade » 🌐
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              @hugovk@mastodon.social

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              RE: fosstodon.org/@dongheena/11711

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              🐍🇰🇷🏃‍♂️ Thanks to all the sprinters for contributing to , and to @dongheena for running this with me!

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                [?]Deuchnord » 🌐
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                @deuchnord@social.deuchnord.fr

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                Maintenant que les démarches administratives sont faites, je peux enfin l'annoncer : je suis maintenant en freelance !
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                Développeur spécialisé dans le Web avec PHP (vanilla & Symfony) et Python (surtout avec Flask), avec de solides connaissances en JS (vanilla & Vue.js), je réalise tous les développements en tenant compte des besoins en accessibilité, en écoconception et du RGPD dès la conception.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                Réalisations entièrement faites par un cerveau biologique.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  [?]Trey Hunner 🐍 » 🌐
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  @treyhunner@mastodon.social

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  “You don't need to implement binary search yourself.”

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Read more 👉 pym.dev/binary-search/

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    [?]Frank Wiles » 🌐
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    @frank@frankwiles.social

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    Not going to make it to Chicago for DjangoCon US 2026? That's ok, I mean I'll miss you, but did you know you can watch all of the talk lives for cheap? Grab a ticket and help support the conference and community! ti.to/defna/djangocon-us-2026

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      [?]Trey Hunner 🐍 » 🌐
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      @treyhunner@mastodon.social

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      Python Tip #228 (of 365):

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      Don't catch NameError exceptions. 🧵

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      This is an issue:

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      try:
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      start, end = parse_date(row["start"]), parse_date(row["end"])
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      except (ValueError, TypeError, KeyError, NameError):
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      print(f"Invalid date on line {n}", file=sys.stderr)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      continue

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      A NameError is raised when a variable isn't defined... which usually means a variable name was MISSPELLED.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      🧵 (1/3)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        [?]Hugo van Kemenade » 🌐
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        @hugovk@mastodon.social

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        You've all started testing the 3.15 release candidate, right?
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        Oh, you can't because it's not on AWS Lambda? Good news, it's now available along with Node.js 26 as a preview:
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        aws-news.com/article/2026-08-1

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          [?]Trey Hunner 🐍 » 🌐
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          @treyhunner@mastodon.social

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          Python Tip #227 (of 365):

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          Don't rely on clever implementation details. 🧵

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          In CPython, two 3's are identical:

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          >>> x = 3
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          >>> y = 3
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          >>> x is y
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          True

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          But two 300's are not always identical:

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          >>> x = 300
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          >>> y = 300
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          >>> x is y
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          False

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          Don't rely on this. Compare numbers with ==.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          In CPython, integers from -5 to 256 are created on launch, so every 200 is identical to every other 200.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          Bigger numbers are only identical sometimes:

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          >>> x, y = 300, 300
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          >>> x is y
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          True

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          🧵 (1/2)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            [?]Trey Hunner 🐍 » 🌐
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            @treyhunner@mastodon.social

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            Alex Martelli coined the term "goose typing" to describe this ability in Python to practice duck typing while also using isinstance and issubclass.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            Read more 👉 pym.dev/goose-typing/

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              [?]Hugo van Kemenade » 🌐
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              @hugovk@mastodon.social

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              Fun first day at , meeting the local community and especially hearing how they're not only building but sustaining communities:

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              🐍 @dongheena building a language support team, starting informally to encourage participation

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              🐍Luna building PyLadies Seoul through asking for help and learning to teach

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              🐍 Jiwoo Oh, Jiyoung Hwang & Juyeong Lee jumped right into a big open-source project and learned early the importance of collaboration

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              the words "PyCon Korea" on a wall, composed from the names of attendees.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              Alt...the words "PyCon Korea" on a wall, composed from the names of attendees.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              Let’s Build a Python Language Support Team
- Donghee Na

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              Alt...Let’s Build a Python Language Support Team - Donghee Na

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              Growth together with PyLadies Seoul
- Luna

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              Alt...Growth together with PyLadies Seoul - Luna

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              "Is it really okay to change it like this...?" An Undergrad's Journey of Contributing to OpenStack (feat. Surviving the Python Ecosystem)
-
Jiwoo Oh, Jiyoung Hwang
, Juyeong Lee

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              Alt..."Is it really okay to change it like this...?" An Undergrad's Journey of Contributing to OpenStack (feat. Surviving the Python Ecosystem) - Jiwoo Oh, Jiyoung Hwang , Juyeong Lee

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                [?]Trey Hunner 🐍 » 🌐
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                @treyhunner@mastodon.social

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                Python Tip #226 (of 365):

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                Don't assign to global variables from within a function.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                You CAN do this in Python. But you really shouldn't.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                Yesterday's tip noted that assignments within a function NORMALLY make local variables.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                But they don't always...

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                Python's "global" statement is the exception:

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                >>> phrase = "Hi world"
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                >>> def set_phrase(name):
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                ... global phrase
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                ... phrase = f"Hello {name}"
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                ...
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                >>> set_phrase("Trey")
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                >>> phrase
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                'Hello Trey'

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                🧵 (1/2)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  [?]Django News » 🤖 🌐
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  @djangonews@mastodon.social

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  [?]Trey Hunner 🐍 » 🌐
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  @treyhunner@mastodon.social

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  “When I need to run multiple subprocesses within the same Python script, I often find myself passing the same keyword arguments over and over to the run function.”

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Read more 👉 pym.dev/running-subprocesses-i

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    [?]Pete Prodoehl 🍕 » 🌐
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    @rasterweb@mastodon.social

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    And here are my bike riding numbers from 2025. I started having back/leg/nerve pain at the end of November. It will always bother me that I didn't get 2,000 miles in 2025.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    (August is when I started riding an ebike and commuting to work and riding a lot, lot, lot more!)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    Graph with bike ride stats from 2025.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    Alt...Graph with bike ride stats from 2025.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    Graph with bike ride stats from 2025.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    Alt...Graph with bike ride stats from 2025.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    Graph with bike ride stats from 2025.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    Alt...Graph with bike ride stats from 2025.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    Graph with bike ride stats from 2025.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    Alt...Graph with bike ride stats from 2025.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      [?]Pete Prodoehl 🍕 » 🌐
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      @rasterweb@mastodon.social

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      My bike riding has been poor this year, due to spinal stenosis and then spinal surgery in June... but hopefully the numbers will go up for the rest of the year.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      (And who knows? Maybe I'll update some of the Python code that generates these.)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      Graph with bike riding data.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      Alt...Graph with bike riding data.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      Graph with bike riding data.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      Alt...Graph with bike riding data.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      Graph with bike riding data.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      Alt...Graph with bike riding data.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      Graph with bike riding data.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      Alt...Graph with bike riding data.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        [?]Trey Hunner 🐍 » 🌐
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        @treyhunner@mastodon.social

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        sincewhen now includes features that are removed from Python and their removal version.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        pym.dev/since or "uvx sincewhen"

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        If you catch features it doesn't handle that you think it should, let me know.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          [?]Kushal Das :python: :tor: 🇸🇪 » 🌐
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          @kushal@toots.dgplug.org

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          Released a new version of my library for @signalapp pypi.org/project/replyfast/

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            [?]Jeff Triplett » 🌐
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            @webology@mastodon.social

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            ⬆️ I updated django-cli-no-admin last night to support Django 6.1, Python 3.15, and Python's free-threaded versions.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            Given the nature of the project, that means pyproject.toml updates 😬

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            I also tried out the trusting publisher thing, and it worked too. 🎉

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            github.com/jefftriplett/django

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              [?]max. » 🌐
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              @makszilla@piaille.fr

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              [?]Trey Hunner 🐍 » 🌐
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              @treyhunner@mastodon.social

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              Python Tip #225 (of 365):

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              Avoid creating local variables that share a name with a global variable.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              This is called SHADOWING, and it can make for confusing code.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              Assigning to a variable inside a function normally makes a LOCAL variable:

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              >>> phrase = "Hi!"
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              >>> def set_phrase(name):
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              ... phrase = f"Hello {name}"
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              >>> set_phrase("Trey")
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              >>> phrase
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              'Hi!'

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              The global phrase never changed. The function makes a LOCAL phrase that disappears when it returns.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              🧵 (1/3)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                [?]Python Software Foundation » 🌐
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                @ThePSF@fosstodon.org

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                We're also excited to announce the nominees for the inaugural Python Packaging Council 🤩 make sure to check out everyone's nomination statements to learn more about this years candidates! (And make sure to affirm your intention to vote by August 25th, 2 PM UTC!) pyfound.blogspot.com/2026/08/a

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  [?]Trey Hunner 🐍 » 🌐
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  @treyhunner@mastodon.social

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  “It's actually possible to use isinstance and practice duck typing at the same time!”

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Read more 👉 pym.dev/goose-typing/

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    [?]Python Software Foundation » 🌐
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    @ThePSF@fosstodon.org

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    We're also excited to announce the nominees for the inaugural Python Packaging Council 🤩 make sure to check out everyone's nomination statements to learn more about this years candidates! (And make sure to affirm your intention to vote by August 25th, 2 PM UTC!) pyfound.blogspot.com/2026/08/a

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      [?]Python Software Foundation » 🌐
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      @ThePSF@fosstodon.org

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      We're excited to announce the nominees for the 2026 PSF Board Election 🤩 make sure to check out everyone's nomination statements to learn more about this years candidates! (And make sure to affirm your intention to vote by August 25th, 2 PM UTC!)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      pyfound.blogspot.com/2026/08/a

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        [?]PyLadies Zurich » 🌐
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        @zurich_pyladies@mastodon.social

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        Are you ready to take your first steps in open source contribution? 🧑‍💻 Or already contributing, but curious about Django? 🦄
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        Either way, we are looking forward to seeing you at our workshop on August 29th!

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        meetup.com/pyladies-zurich/eve

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          [?]Trey Hunner 🐍 » 🌐
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          @treyhunner@mastodon.social

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          Python Tip #224 (of 365):

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          Constants that are specific to a class often belong ON that class.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          class Circle:
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          max_radius = 100
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          def __init__(self, radius):
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          if radius > self.max_radius:
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          raise ValueError(f"Radius can't exceed {self.max_radius}")
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          self.radius = radius

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          But, why make max_radius a class attribute instead of a module-level MAX_RADIUS constant...?

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          🧵 (1/3)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            [?]Trey Hunner 🐍 » 🌐
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            @treyhunner@mastodon.social

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            I decided to play with a silly idea: reorganizing 's junk drawer module (I say "junk drawer" affectionately here).

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            treyhunner.com/2026/08/reorgan

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              [?]Adam Johnson :django: :python: » 🌐
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              @adamchainz@fosstodon.org

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              📦 New package day! This time a Rusty rewrite of the emoji package: 3.5x faster for conversion, 70 times faster for deconversion, and using about 40% less memory.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              adamj.eu/tech/2026/08/12/pytho

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                [?]Glyph » 🌐
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                @glyph@mastodon.social

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                it's that time again! upgrade your on macOS with `mopup`:

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                a terminal running `pipx run --python python3.14 mopup` and upgrading from 3.14.6 to 3.14.7

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                Alt...a terminal running `pipx run --python python3.14 mopup` and upgrading from 3.14.6 to 3.14.7

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  [?]Hugo van Kemenade » 🌐
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  @hugovk@mastodon.social

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  [?]Trey Hunner 🐍 » 🌐
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  @treyhunner@mastodon.social

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  “But self-concatenation doesn't copy anything, so don't try to use it to make lists of mutable values like lists-of-lists.”

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Read more 👉 pym.dev/self-concatenation/

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    Fred de CLX boosted

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    [?]marcink » 🌐
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    @marcink@stolat.town

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    no-gen-AI meetups: it is now possible to sign up for the first event!

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    On keskonfai: keskonfai.fr/events/6e9b14ad-9

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    On meetup.com: meetup.com/code-is-art/events/

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    Use either to sign up (preferably in advance so that we know how many people to expect), boost if you know anyone who might also be interested, maybe suggest a talk if you would like to share something interesting? And show up at Taille Crayon on the 24th, 19:00, see you there!

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    (and and for the first talk on the list)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    Picture of Le Taille Crayon (from their web page): people sitting at tables in a nice courtyard with trees around and lights above.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    Alt...Picture of Le Taille Crayon (from their web page): people sitting at tables in a nice courtyard with trees around and lights above.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      [?]Fabien LOISON (FLOZz) » 🌐
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      @FLOZz@mastodon.social

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      🟣 Nouveau journal de bord sur le blog !

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      ➡️ blog.flozz.fr/2026/08/12/journ

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      Aujourd'hui je vais vous parler un peu d'une amélioration que j'ai développé pour ma lib rst2gemtext suite à un besoin de @Dryusdan, d'un petit changement que j'ai apporté au blog, et d'une réflexion que j'ai eu sur la langue dans laquelle je publie suite à la lecture d'un article de @Edent

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      Bonne lecture ! 😁

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        [?]Trey Hunner 🐍 » 🌐
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        @treyhunner@mastodon.social

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        Python Tip #223 (of 365):

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        Consider copying mutable arguments in your class initializers.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        What happens if two objects are given the SAME list?

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        >>> initial_tasks = ['Watch screencast', 'Brush teeth']
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        >>> mon = TodoList(initial_tasks)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        >>> tue = TodoList(initial_tasks)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        It depends...

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        🧵 (1/4)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          [?]Trey Hunner 🐍 » 🌐
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          @treyhunner@mastodon.social

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          “When you need to launch a subprocess from within Python, I recommend using the run function from Python's subprocess module.”

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          Read more 👉 pym.dev/running-subprocesses-i

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            [?]Mike Driscoll » 🌐
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            @driscollis@mastodon.social

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            Want to know how many cores on your CPU with ? You can use the multiprocessing module for that 🐍🔥

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              [?]andros » 🌐
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              @andros@activity.andros.dev

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              «HTML over WebSockets: real-time SPAs with barely any JavaScript»

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              Building a SPA usually means a JS framework, a JSON API, and two codebases forced to agree on a contract; there is another way that skips all three, and it is not new.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              https://en.andros.dev/blog/ef4968f5/html-over-websockets-real-time-spas-with-barely-any-javascript/

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              #Web #JavaScript #Python #Django #WebSockets #DjangoLiveView

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                [?]Trey Hunner 🐍 » 🌐
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                @treyhunner@mastodon.social

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                Python Tip #222 (of 365):

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                Be careful with mutable default values in function definitions.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                This class has a bug:

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                class TodoList:
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                def __init__(self, tasks=[]):
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                self.tasks = tasks

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                def add_task(self, task):
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                self.tasks.append(task)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                Every TodoList object made without arguments shares the SAME list:

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                >>> mon = TodoList()
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                >>> tue = TodoList()
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                >>> mon.add_task("Work on Python exercise")
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                >>> tue.tasks
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                ['Work on Python exercise']

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                🧵 (1/3)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  [?]Trey Hunner 🐍 » 🌐
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  @treyhunner@mastodon.social

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  “Python's f-strings are great, but if you just need to smoosh a few values together with spaces between them, consider passing separate arguments to print.”

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Read more 👉 pym.dev/print-features/

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    [?]Mariusz Felisiak » 🌐
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    @felixxm@fosstodon.org

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    Who would expect that my tiny contribution would be merged into Python 🐍 🎉 Be patient folks, there is no rush 🧘

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    github.com/python/cpython/pull

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      [?]James Bennett [he/him] » 🌐
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      @ubernostrum@infosec.exchange

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      Last year @yossarian wrote a brief post on the surprising complexity of the "splitlines()" method. As a busy Unicode pedant, it took me a while to write up something explaining *why* it's complex, but here it finally is:

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      b-list.org/weblog/2026/aug/10/

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        [?]trotto » 🌐
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        @trotto@fosstodon.org

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        Release season is on ✨

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        And now it’s time for django-never-cache 0.1.3 🐍

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        This release adds support for Django 6.1, includes a few cleanups and improvements, and now also publishes PyPI attestations automatically, improving transparency and supply-chain verifiability.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        🔗 github.com/trottomv/django-nev

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          [?]LWN.net » 🌐
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          @lwn@fedi.lwn.net

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          Django moves to an annual release cycle

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          lwn.net/Articles/1088059/

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            [?]Python Software Foundation » 🌐
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            @ThePSF@fosstodon.org

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            Need more information on running for the inaugural Python Packaging Council? Check out our blog post: pyfound.blogspot.com/2026/07/g

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              [?]Python Software Foundation » 🌐
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              @ThePSF@fosstodon.org

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              Need more information on running for the PSF Board? Check out our blog post: pyfound.blogspot.com/2026/07/g

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                [?]Python Software Foundation » 🌐
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                @ThePSF@fosstodon.org

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                You have a little more than 24 hours left to submit a PSF Board or Python Packaging Council nomination for yourself or someone else 🩵🐍💛 Submit your nominations by tomorrow, Tuesday, August 11th, 2:00 pm UTC!
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                python.org/nominations/electio

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  [?]Trey Hunner 🐍 » 🌐
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  @treyhunner@mastodon.social

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Python Tip #221 (of 365):

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Implement appropriate dunder methods.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Dunder methods are a contract between your class and the Python interpreter.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  • __add__ & __radd__ power +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  • __eq__ powers ==
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  • __len__ powers len()

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Dunder methods are what third-party library authors use to make their objects feel like NATIVE Python objects.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Django QuerySet objects support indexing, iteration, len(...), and truthiness.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  And Pandas DataFrames support a whole BUNCH of syntax.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  🧵 (1/2)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    [?]Trey Hunner 🐍 » 🌐
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    @treyhunner@mastodon.social

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    “In addition to os.name and sys.platform, there's an even higher level approach to find the platform that your code is running on, with the platform module.”

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    Read more 👉 pym.dev/operating-system-check

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      [?]Trey Hunner 🐍 » 🌐
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      @treyhunner@mastodon.social

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      Python Tip #220 (of 365):

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      Trying quack like a duck? Seek help.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      When implementing a common Python protocol (a sequence, a mapping, etc.), inherit from the matching abstract base class (ABC):

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      from collections.abc import MutableSequence

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      class MyCustomList(MutableSequence):
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      ...

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      Benefits:

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      1. isinstance & issubclass checks work well (i.e. isinstance(x, Sequence))

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      2. Python will complain LOUDLY if you forget to implement a required method for the protocol

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      🧵 (1/3)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        [?]Adam Johnson :django: :python: » 🌐
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        @adamchainz@fosstodon.org

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        ✍️ I just released a new version of my little Python profiler, tprof, with less overhead for more accurate results.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        adamj.eu/tech/2026/08/08/pytho

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          [?]Trey Hunner 🐍 » 🌐
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          @treyhunner@mastodon.social

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          “As you write your code, pause and ask: “what should stand out here at a glance?””

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          Read more 👉 pym.dev/embrace-whitespace/

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            Lily boosted

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            [?]Marijke Luttekes [she/her] » 🌐
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            @mahryekuh@hachyderm.io

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            RE: mastodon.social/@djangonews/11

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            New Django just dropped! 🙌🏻 🚀

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            I’m happy to see an implementation of one of my accessibility feature requests in there as well: `django.db.models.fields.BLANK_CHOICE_LABEL`.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            I don’t have the spoons to explain it right now, but the backstory is in the ticket.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              [?]codingjoe :django: :python: » 🌐
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              @codingjoe@fosstodon.org

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              [?]Trey Hunner 🐍 » 🌐
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              @treyhunner@mastodon.social

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              New article on goose typing in Python (yes, that's actually a thing).

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              You can duck typing WHILE type checking.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              pym.dev/goose-typing

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                [?]Trey Hunner 🐍 » 🌐
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                @treyhunner@mastodon.social

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                Python Tip #219 (of 365):

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                Validate your ducks with goose typing.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                You can use isinstance() WHILE duck typing. This is called goose typing (coined by Alex Martelli).

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                >>> from collections‍.abc import Iterable
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                >>> isinstance([1, 2, 3], Iterable)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                True

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                Point doesn't inherit from Iterable:

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                class Point:
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                def __init__(self, x, y): self.x, self.y = x, y
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                def __iter__(self): yield from (self.x, self.y)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                And yet...

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                >>> isinstance(Point(1, 2), Iterable)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                True

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                🧵 (1/3)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  [?]Adam Johnson :django: :python: » 🌐
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  @adamchainz@fosstodon.org

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  🎨 I’m really enjoying the redesigned PyPI project pages. Thanks to Nicole Harris and team for making these improvements!

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Blog post:

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  blog.pypi.org/posts/2026-07-22

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Django’s project page on PyPI, showcasing the new design.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Alt...Django’s project page on PyPI, showcasing the new design.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    [?]Hugo van Kemenade » 🌐
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    @hugovk@mastodon.social

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    @mgorny The good news is that was merged in 2024 but never actually released, so this change only affects those using unreleased source directly? And it's been archived on PyPI, so perhaps find a replacement.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      [?]Trey Hunner 🐍 » 🌐
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      @treyhunner@mastodon.social

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      Python Tip #218 (of 365):

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      Don't needlessly convert between data types.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      Looping over a file once? There's no reason to convert it to a list first:

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      for line in my_file:
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      print(line, end="")

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      Another example: if you're looping over a set, there's no reason to convert it to a list either:

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      >>> colors = {'red', 'blue', 'yellow'}
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      >>> for color in colors:
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      ... print(color)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      ...
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      red
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      yellow
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      blue

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      "for" loops don't need a list. They accept ANY iterable.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      🧵 (1/2)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        [?]Adam Johnson :django: :python: » 🌐
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        @adamchainz@fosstodon.org

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        🆙 Updated my post on unittest base test cases with a new preferred technique: using a plain class as a container.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        adamj.eu/tech/2025/05/30/pytho

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          [?]Trey Hunner 🐍 » 🌐
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          @treyhunner@mastodon.social

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          Python 3.15.0 release candidate 1 is out!

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          python.org/downloads/release/p

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          Test your code against it and let the core devs know if you find bugs!

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          If you have uv, getting it is easy:

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          uv self update
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          uv python install

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          That even works if you already have an alpha or beta version installed (it'll upgrade it for you).

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            [?]Jeff Triplett » 🌐
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            @webology@mastodon.social

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            RE: fosstodon.org/@ThePSF/11704441

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            For devs who like to fill out surveys... ✅

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            [?]Python Software Foundation » 🌐
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            @ThePSF@fosstodon.org

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            The 2026 Python Type System & Tooling Survey is live 🐍📝❓ No typing experience needed—your perspective as a dev matters most. Take a couple minutes to help improve Python typing for all!

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            surveymonkey.com/r/python_typi

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            This survey was developed with support from the Pyrefly team at Meta, the PyCharm team at JetBrains, the Python team at Microsoft, and the typing community on discourse.python.org.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                [?]Python Software Foundation » 🌐
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                @ThePSF@fosstodon.org

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                The 2026 Python Type System & Tooling Survey is live 🐍📝❓ No typing experience needed—your perspective as a dev matters most. Take a couple minutes to help improve Python typing for all!

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                surveymonkey.com/r/python_typi

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                This survey was developed with support from the Pyrefly team at Meta, the PyCharm team at JetBrains, the Python team at Microsoft, and the typing community on discourse.python.org.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  [?]Trey Hunner 🐍 » 🌐
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  @treyhunner@mastodon.social

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Python Tip #217 (of 365):

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Think in terms of the minimum viable duck.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  In other words: "what's the least this object needs to do to work in this context?"

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  For example, csv.reader is usually given a file object... but it accepts ANY iterable of delimited lines:

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  >>> import csv
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  >>> rows = ['a,b,c', '1,2,3']
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  >>> list(csv.reader(rows))
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  [['a', 'b', 'c'], ['1', '2', '3']]

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  🧵 (1/4)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    [?]Hugo van Kemenade » 🌐
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    @hugovk@mastodon.social

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    [?]Hugo van Kemenade » 🌐
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    @hugovk@mastodon.social

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    Peter's PEP 797 – Shared Object Proxies was also the first PEP rejected for 3.16 as well! ✌️
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    peps.python.org/pep-0797/

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      [?]Hugo van Kemenade » 🌐
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      @hugovk@mastodon.social

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      Forget Python 3.15 (don't forget it, please test!), the first PEP for Python 3.16 has been accepted:

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      PEP 828 – Supporting ‘yield from’ in asynchronous generators, by Peter Bierma

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      peps.python.org/pep-0828/

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        [?]Marcos Dione » 🌐
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        @mdione@en.osm.town

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        TIL that 's `pathlib.Path` is expensive compared to plain `str`ings. I tested by `.walk()`ing a 2 level directory structure with 40M files and it took 9m. When I tried with `os.walk()`, it only took 1m. Of course, I tested this several times to avoid cold vs hot cache.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        Tritium#python@libera.chat tracked it down to the constructor to `pathlib.Path`, which does a lot of things than being just a `str`:

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        github.com/python/cpython/blob

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          [?]yossarian » 🌐
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          @yossarian@infosec.exchange

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          my keynote from europython is online!

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          youtu.be/wMPe_KepOjc

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            [?]Trey Hunner 🐍 » 🌐
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            @treyhunner@mastodon.social

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            Python Tip #216 (of 365):

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            In Python, we often care more about the behavior of an object than its type.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            We say "if it looks like a duck and quacks like a duck, it's a duck".

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            When we check for duckness, we don't test DNA, we observe behavior.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            Instead of asking "what TYPE can I use here?", ask "does my object have the BEHAVIOR that's expected here?"

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            🧵 (1/3)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              [?]Hugo van Kemenade » 🌐
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              @hugovk@mastodon.social

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              Some things sooner than others:

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              3.15 RC 1 is out, but we'll wait until tomorrow to do 3.13 and 3.14 so we can include this fix for macOS that will become a problem in mid-September:

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              github.com/python/cpython/issu

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              3.15 will have another release (1st Sept) before then, but 3.13 and 3.14's next one is in October, so better wait for the fix.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                [?]Hugo van Kemenade » 🌐
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                @hugovk@mastodon.social

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                🐍🚀 Out now: Python 3.15 release candidate 1!

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                Please test and report bugs!

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                We strongly encourage maintainers of to prepare their projects for 3.15 during this phase, and publish Python 3.15 wheels on PyPI to be ready for the final release of 3.15.0, and to help other projects do their own testing.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                Any binary wheels built against Python 3.15.0 release candidates will work with future versions of Python 3.15.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                discuss.python.org/t/python-3-

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  [?]Python Software Foundation » 🌐
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  @ThePSF@fosstodon.org

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  The nomination period for the PSF Board and Python Packaging Council elections is open now, closing next Tuesday, August 11th, 2:00 pm UTC 📝🐍 Don't wait until the last minute, though! Nominate yourself or someone else today: python.org/nominations/electio

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    [?]Hugo van Kemenade » 🌐
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    @hugovk@mastodon.social

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    🔒🐍 Coming soon, Python 3.15 release candidate 1! The 3.15 branch is now locked until 3.15.0 final in October.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    discuss.python.org/t/the-3-15-

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    Also coming soon: Python 3.13.15 and 3.14.7.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    hugovk.dev/next-release/

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      [?]Kushal Das :python: :tor: 🇸🇪 » 🌐
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      @kushal@toots.dgplug.org

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      Jag har också en kurs som hjälper Scratch-generationen att ta steget över till genom den välbekanta miljön. Kursen innehåller även grundläggande hårdvaruprogrammering för att göra inlärningen rolig. Kurserna startar i slutet av augusti. Dela gärna så att fler föräldrar får se detta.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      enkelkod.se/beginner.html

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        [?]Trey Hunner 🐍 » 🌐
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        @treyhunner@mastodon.social

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        Python Tip #215 (of 365):

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        Know what it means to be a "sequence" in Python.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        Lists, strings, and tuples are all sequences:

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        >>> fruits = ["apple", "lemon", "pear"]
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        >>> coordinates = (1, 8, 2)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        >>> greeting = "Hi y'all!"

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        A sequence is an ordered collection that:

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        1. Has a length
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        2. Can be indexed from "0" up to one less than its length
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        3. Can be looped over

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        >>> len(fruits)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        3
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        >>> fruits[0]
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        'apple'
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        >>> for c in coordinates: print(c)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        1
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        8
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        2

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        🧵 (1/3)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          [?]Trey Hunner 🐍 » 🌐
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          @treyhunner@mastodon.social

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          “The defaultdict is very handy, but I find that it's rarely useful enough that I feel the need to use it.”

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          Read more 👉 pym.dev/default-dictionary-val

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            [?]Adam Johnson :django: :python: » 🌐
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            @adamchainz@fosstodon.org

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            ✍️ New post demonstrating the runtime advantage of my package time-machine over its inspiration, freezegun.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            adamj.eu/tech/2026/08/03/pytho

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              Back to top - More...