Feeds
Real Python: Differences Between Python's Mutable and Immutable Types
As a Python developer, you’ll have to deal with mutable and immutable objects sooner or later. Mutable objects are those that allow you to change their value or data in place without affecting the object’s identity. In contrast, immutable objects don’t allow this kind of operation. You’ll just have the option of creating new objects of the same type with different values.
In Python, mutability is a characteristic that may profoundly influence your decision when choosing which data type to use in solving a given programming problem. Therefore, you need to know how mutable and immutable objects work in Python.
In this video course, you’ll:
- Understand how mutability and immutability work under the hood in Python
- Explore immutable and mutable built-in data types in Python
- Identify and avoid some common mutability-related gotchas
- Understand and control how mutability affects your custom classes
[ Improve Your Python With đ Python Tricks đ â Get a short & sweet Python Trick delivered to your inbox every couple of days. >> Click here to learn more and see examples ]
The Drop Times: Unlock Advanced Drupal Content Editing: Join Our CKEditor Webinar
Colin Watson: Free software activity in September 2024
Almost all of my Debian contributions this month were sponsored by Freexian.
You can also support my work directly via Liberapay.
PydanticMy main Debian project for the month turned out to be getting Pydantic back into a good state in Debian testing. Iâve used Pydantic quite a bit in various projects, most recently in Debusine, so I have an interest in making sure it works well in Debian. However, it had been stalled on 1.10.17 for quite a while due to the complexities of getting 2.x packaged. This was partly making sure everything else could cope with the transition, but in practice mostly sorting out packaging of its new Rust dependencies. Several other people (notably Alexandre Detiste, Andreas Tille, Drew Parsons, and Timo Röhling) had made some good progress on this, but nobody had quite got it over the line and it seemed a bit stuck.
Learning Rust is on my to-do list, but merely not knowing a language hasnât stopped me before. So I learned how the Debian Rust teamâs packaging works, upgraded a few packages to new upstream versions (including rust-half and upstream rust-idna test fixes), and packaged rust-jiter. After a lot of waiting around for various things and chasing some failures in other packages I was eventually able to get current versions of both pydantic-core and pydantic into testing.
Iâm looking forward to being able to drop our clunky v1 compatibility code once debusine can rely on running on trixie!
OpenSSHI upgraded the Debian packaging to OpenSSH 9.9p1.
YubiHSMI upgraded python-yubihsm, yubihsm-connector, and yubihsm-shell to new upstream versions.
I noticed that I could enable some tests in python-yubihsm and yubihsm-shell; Iâd previously thought the whole test suite required a real YubiHSM device, but when I looked closer it turned out that this was only true for some tests.
I fixed yubihsm-shell build failures on some 32-bit architectures (upstream PRs #431, #432), and also made it build reproducibly.
Thanks to Helmut Grohne, I fixed yubihsm-connector to apply udev rules to existing devices when the package is installed.
As usual, bookworm-backports is up to date with all these changes.
Python teamsetuptools 72.0.0 removed the venerable setup.py test command. This caused some fallout in Debian, some of which was quite non-obvious as packaging helpers sometimes fell back to different ways of running test suites that didnât quite work. I fixed django-guardian, manuel, python-autopage, python-flask-seeder, python-pgpdump, python-potr, python-precis-i18n, python-stopit, serpent, straight.plugin, supervisor, and zope.i18nmessageid.
As usual for new language versions, the addition of Python 3.13 caused some problems. I fixed psycopg2, python-time-machine, and python-traits.
I fixed build/autopkgtest failures in keymapper, python-django-test-migrations, python-rosettasciio, routes, transmissionrpc, and twisted.
buildbot was in a bit of a mess due to being incompatible with SQLAlchemy 2.0. Fortunately by the time I got to it upstream had committed a workable set of patches, and the main difficulty was figuring out what to cherry-pick since they havenât made a new upstream release with all of that yet. I figured this out and got us up to 4.0.3.
Adrian Bunk asked whether python-zipp should be removed from trixie. I spent some time investigating this and concluded that the answer was no, but looking into it was an interesting exercise anyway.
On the other hand, I looked into flask-appbuilder, concluded that it should be removed, and filed a removal request.
I upgraded some embedded CSS files in nbconvert.
I upgraded importlib-resources, ipywidgets, jsonpickle, pydantic-settings, pylint (fixing a test failure), python-aiohttp-session, python-apptools, python-asyncssh, python-django-celery-beat, python-django-rules, python-limits, python-multidict, python-persistent, python-pkginfo, python-rt, python-spur, python-zipp, stravalib, transmissionrpc, vulture, zodbpickle, zope.exceptions (adopting it), zope.i18nmessageid, zope.proxy, and zope.security to new upstream versions.
debmirrorThe experimental and *-proposed-updates suites used to not have Contents-* files, and a long time ago debmirror was changed to just skip those files in those suites. They were added to the Debian archive some time ago, but debmirror carried on skipping them anyway. Once I realized what was going on, I removed these unnecessary special cases (#819925, #1080168).
Robin Wilson: I won two British Cartographic Society awards!
It’s been a while since I posted here – I kind of lost momentum over the summer (which is a busy time with a school-aged child) and never really picked it up again.
Anyway, I wanted to write a quick post to tell people that I won two awards at the British Cartographic Society awards ceremony a few weeks ago.
They were both for my British Placename Mapper web app, which is described in more detail in this blog post. If you haven’t seen it already, I strongly recommend you check it out.
I won a Highly Commended certificate in the Avenza Award for Electronic Mapping, and the First Prize trophy for the Ordnance Survey Award (for any map using OS data).
The certificates came in a lovely frame, and the trophy is enormous – about 30cm high and weighing over 3kg!
I was presented with the trophy at the BCS Annual Conference in London, but they very kindly offered to keep the trophy to save me carrying it across London on my wheelchair and back on the train, so they invited me to Ordnance Survey last week to be presented with it again. I had a lovely time at OS – including 30 minutes with their Director General/CEO and was formally presented with my trophy again (standing in front of the first ever Ordnance Survey map!):
Full information on the BCS awards are available on their website and I strongly recommend submitting any appropriate maps you’ve made for next year’s awards. I need to get my thinking cap on for next year’s entry…
Junichi Uekawa: Hello October.
The Drop Times: A Note of Gratitude for all the Support!
Python Insider: Python 3.12.7 released
I'm pleased to announce the release of Python 3.12.7:
https://www.python.org/downloads/release/python-3127/
Python 3.12 is the newest major release of the Python programming language, and it contains many new features and optimizations. 3.12.7 is the latest maintenance release, containing more than 100 bugfixes, build improvements and documentation changes since 3.12.6.
Major new features of the 3.12 series, compared to 3.11 New features- More flexible f-string parsing, allowing many things previously disallowed (PEP 701).
- Support for the buffer protocol in Python code (PEP 688).
- A new debugging/profiling API (PEP 669).
- Support for isolated subinterpreters with separate Global Interpreter Locks (PEP 684).
- Even more improved error messages. More exceptions potentially caused by typos now make suggestions to the user.
- Support for the Linux perf profiler to report Python function names in traces.
- Many large and small performance improvements (like PEP 709 and support for the BOLT binary optimizer), delivering an estimated 5% overall performance improvement.
- New type annotation syntax for generic classes (PEP 695).
- New override decorator for methods (PEP 698).
- The deprecated wstr and wstr_length members of the C implementation of unicode objects were removed, per PEP 623.
- In the unittest module, a number of long deprecated methods and classes were removed. (They had been deprecated since Python 3.1 or 3.2).
- The deprecated smtpd and distutils modules have been removed (see PEP 594 and PEP 632. The setuptools package continues to provide the distutils module.
- A number of other old, broken and deprecated functions, classes and methods have been removed.
- Invalid backslash escape sequences in strings now warn with SyntaxWarning instead of DeprecationWarning, making them more visible. (They will become syntax errors in the future.)
- The internal representation of integers has changed in preparation for performance enhancements. (This should not affect most users as it is an internal detail, but it may cause problems for Cython-generated code.)
For more details on the changes to Python 3.12, see Whatâs new in Python 3.12.
More resources- Online Documentation.
- PEP 693, the Python 3.12 Release Schedule.
- Report bugs via GitHub Issues.
- Help fund Python directly or via GitHub Sponsors, and support the Python community.
Thanks to all of the many volunteers who help make Python Development and these releases possible! Please consider supporting our efforts by volunteering yourself or through organization contributions to the Python Software Foundation.
Your release team,
Thomas Wouters
Ćukasz Langa
Ned Deily
Steve Dower
GSOC: Week 8 to Week 16
The End is here!
The long journey of GSoC (which got streched into 16 weeks) is nearing to an end. And in this blog, I will share a few of the things I have done, and some of the things I have left to do. Let’s start with the main works.
Snap KCM! It’s here!I have finally succeeded to create a KCM for snaps. This is written using C++, Qt (Qml), Kirigami, Snapd-Glib Api. The flow is something like this
Python Insider: Python 3.13.0 release candidate 3 released
I'm pleased to announce the release of Python 3.13 release candidate 3 (instead of the expected final release).
https://www.python.org/downloads/release/python-3130rc3/
This is the final release candidate of Python 3.13.0
This release, 3.13.0rc3, is the final release preview (no really) of 3.13. This release is expected to become the final 3.13.0 release, barring any critical bugs being discovered. The official release of 3.13.0 is now scheduled for Monday, 2024-10-07.
This extra, unplanned release candidate exists because of a couple of last minute issues, primarily a significant performance regression in specific workloads due to the incremental cyclic garbage collector (introduced in the alpha releases). We decided to roll back the garbage collector change in 3.13 (and continuing work in 3.14 to improve it), apply a number of other important bug fixes, and roll out a new release candidate.
There will be no ABI changes from this point forward in the 3.13 series (and there haven't been any since the beta releases).
Call to actionWe strongly encourage maintainers of Python projects to prepare their projects for 3.13 compatibilities during this phase, and where necessary publish Python 3.13 wheels on PyPI to be ready for the final release of 3.13.0. Any binary wheels built against Python 3.13.0rc1 and later will work with future versions of Python 3.13. As always, report any issues to the Python bug tracker.
Please keep in mind that this is a preview release and while itâs as close to the final release as we can get it, its use is not recommended for production environments.
Core developers: time to work on documentation now- Are all your changes properly documented?
- Are they mentioned in Whatâs New?
- Did you notice other changes you know of to have insufficient documentation?
Some of the new major new features and changes in Python 3.13 are:
New features- A new and improved interactive interpreter, based on PyPyâs, featuring multi-line editing and color support, as well as colorized exception tracebacks.
- An experimental free-threaded build mode, which disables the Global Interpreter Lock, allowing threads to run more concurrently. The build mode is available as an experimental feature in the Windows and macOS installers as well.
- A preliminary, experimental JIT, providing the ground work for significant performance improvements.
- The locals() builtin function (and its C equivalent) now has well-defined semantics when mutating the returned mapping, which allows debuggers to operate more consistently.
- A modified version of mimalloc is now included, optional but enabled by default if supported by the platform, and required for the free-threaded build mode.
- Docstrings now have their leading indentation stripped, reducing memory use and the size of .pyc files. (Most tools handling docstrings already strip leading indentation.)
- The dbm module has a new dbm.sqlite3 backend that is used by default when creating new files.
- The minimum supported macOS version was changed from 10.9 to 10.13 (High Sierra). Older macOS versions will not be supported going forward.
- WASI is now a Tier 2 supported platform. Emscripten is no longer an officially supported platform (but Pyodide continues to support Emscripten).
- iOS is now a Tier 3 supported platform
- Android is now a Tier 3 supported platform as well.
- Support for type defaults in type parameters.
- A new type narrowing annotation, typing.TypeIs.
- A new annotation for read-only items in TypeDicts.
- A new annotation for marking deprecations in the type system.
- PEP 594 (Removing dead batteries from the standard library) scheduled removals of many deprecated modules: aifc, audioop, chunk, cgi, cgitb, crypt, imghdr, mailcap, msilib, nis, nntplib, ossaudiodev, pipes, sndhdr, spwd, sunau, telnetlib, uu, xdrlib, lib2to3.
- Many other removals of deprecated classes, functions and methods in various standard library modules.
- C API removals and deprecations. (Some removals present in alpha 1 were reverted in alpha 2, as the removals were deemed too disruptive at this time.)
- New deprecations, most of which are scheduled for removal from Python 3.15 or 3.16.
(Hey, fellow core developer, if a feature you find important is missing from this list, let Thomas know.)
For more details on the changes to Python 3.13, see Whatâs new in Python 3.13. The next release of Python 3.13 will be the official 3.13.0 release, currently scheduled for Monday, 2024-10-07.
More resources- Online Documentation
- PEP 719, 3.13 Release Schedule
- Report bugs at Issues · python/cpython · GitHub.
- Help fund Python directly (or via GitHub Sponsors), and support the Python community.
Thanks to all of the many volunteers who help make Python Development and these releases possible! Please consider supporting our efforts by volunteering yourself or through organization contributions to the Python Software Foundation.
Your release team,
Thomas Wouters
Ćukasz Langa
Ned Deily
Steve Dower
Real Python: Quiz: When to Use a List Comprehension in Python
In this quiz, you’ll test your understanding of List Comprehension in Python.
By working through this quiz, you’ll revisit how to rewrite loops as list comprehensions, how to choose when to use list comprehensions, how you can use conditional logic in your comprehensions, and how to profile your code to resolve performance questions.
[ Improve Your Python With đ Python Tricks đ â Get a short & sweet Python Trick delivered to your inbox every couple of days. >> Click here to learn more and see examples ]
1xINTERNET blog: DrupalCon Barcelona - A seminal moment in Drupalâs history
DrupalCon is the biannual conference where leaders in Drupal gather to coordinate, collaborate and present the latest developments in digital and web technologies. This week 1xINTERNET attended DrupalCon Barcelona in full force. But this conference was like none before it, this was Starshots World Premier and it exceeded all expectations.
Guido GĂŒnther: Free Software Activities September 2024
Another short status update of what happened on my side last month. Besides the usual amount of housekeeping last month was a lot about getting old issues resolved by finishing some stale merge requests and work in pogress MRs. I also pushed out the Phosh 0.42.0 Release
phosh- Mark mobile-data quick setting as insensitive when modem is off (MR)
- Document handler naming (MR)
- Phosh 0.41.1 (MR)
- Phosh 0.42~rc1 (MR)
- Phosh 0.42.0 (MR)
- Handle per app notification enable setting (MR) (a 3y old MR cleaned up and out of the way)
- Use parent's icon if child doesn't have one (MR (another 1y old MR moved out of draft status)
- Fix Rust build and upcoming events .plugin file (MR)
- Lint markdown (MR)
- Sanitize versions as this otherwise breaks the libphosh-rs build (MR)
- lockscreen: Swap deck and carousel to avoid triggering the plugins page when entering pin and let the lockscreen shrink to smaller sizes (MR) (two more year old usability issues out of the way)
- Let bitfield values end up in the docs again (MR)
- Don't focus incorrect app on launch (MR). This could happen with apps like calls that run a daemon (and needs more work for a clean solution).
- Continue with wallpaper MR (MR) (still draft)
- Brush up and land an old MR to avoid crashes on scale changes (MR). Another five month old MR out of the way.
- API version the shared library (MR)
- Ensure we send enough feedback when phone is blanked/locked (MR). This should be way easier now for apps as they don't need to do anything and we can avoid duplicate feedback sent from e.g. Chatty.
- Fix possible use after free when activating notifications on the lock screen (MR)
- Simplify layer-surface creation / destruction (MR)
- Don't lose preedit when switching applications, opening menus, etc (MR). This fixes the case (e.g. with word completion in phosh-osk-stub enabled) where it looks to the user as if the last typed word would get lost when switching from a text editor to another app or when opening a menu
- Ease focus debugging (MR)
- Release 0.42~rc1 (MR)
- Release 0.42.0 (MR)
- Mention examples in docs and check more things (MR)
- Update Phosh-0.gir with above phosh fixes to unbreak the build (MR)
- Rework to work with API versioned libphosh (MR)
- Add paste button to easy pasting text (MR)
- Add copy button (draft) (MR)
- Fix word salad with presage completer when entering cursor navigation mode (and in some other cases) (MR 1). Presage has the best completion but was marked experimental due to that.
- Submit preedit on changes to terminal and emoji layout (MR)
- Enable hint based completion by default (MR)
- Release 0.42~r1 (MR)
- Release 0.42.0 (MR)
- Weekly image builds of nightly packages are now built in CI and uploaded.
- Handle Fixes: tag in git commit messages as well (MR)
- Let release prep handle non-RC versions as well (MR)
- Add common markdown linter job (MR)
- Update wlr-randr (MR)
- Upload libqmi developement snapshot (MR) (Helps eSIM and CellBroadcast)
- Update phosh to not crash with GSD from GNOME 47 (MR)
- Fix systemd unit path in calls (MR)
- Package wikietractor (MR)
- More work on Cell Broadcast so we can finally undraft (MR)
- Check consistency when building releases (MR
- Object life cycle fixes (MR)
- Use DBus activation (MR). This ensures it spawns quickly rather than phosh's splash screen timing out.
- Add user unit for mpris proxy so it works out of the box (Patch) and one can skip e.g. songs in a cars media unit
- Wrap info-bar more (MR) to fit smalls screens
- Forward metainfo/desktop file updates from Mobian (MR) (patch originally by Arnaud Ferraris)
- Add udev rule to support haptic on Oneplus Fajita / Enchilada's (non-mailine driver) (MR)
- Support alert-slider on OnePlus 6/6T (MR. Based on a script by "isyourbrain foss".
- Release 0.5.0 (MR)
- Improve spec a bit regarding notification events (MR)
- Don't send feedback for notifications (MR). The notification daemon does this already.
- Add event for cellbroadcast messages (MR)
- Switch to DBus activation (MR). This ensures the compositor sees the activation token and is will be useful for unified push.
- Don't let scroll_down button take focus (MR). This prevents the OSK from folding when the text view is focused and ones scrolls to the bottom.
- Use revealer to show/hide scroll_down button (MR) - just to make the visual more appealing
- Unbreak messge display (MR)
- Unbreak application icon (MR)
- Drop special preedit handling (MR).
- Drop margin so we can fit on smaller screens (MR). This helps phosh on lower effective resolutions.
- Backport margin patch (MR)
- Fix doc formatting for g_input_stream_read_all* (MR)
- Add toplevel responsiveness state (MR) so phosh can inform about unresponsive apps
- Modernize docs to use debian/latest instead of debian/sid (commit, commit).
- Use pytest instead of nose as test runner (MR)
- Release 0.9.35
- Unbreak and modernize CI a bit (MR). A passing CI is so much more motivating for contributers and reviewers.
- Fix app-id and hence the icon shown in Phosh's overview (MR)
If you want to support my work see donations. This includes a list of hardware we want to improve support for. Thanks a lot to all current and past donors.
Qt Creator 14.0.2 released
We are happy to announce the release of Qt Creator 14.0.2!
Google Summer of Code 2024
Programmes like Season of KDE (SoK) and Google Summer of Code (GSoC) provide a great opportunity for young talent to become part of the open source community and contribute to open source projects. LabPlot, and KDE in general, has a long history and experience in managing GSoC projects and has benefited from various contributions. In recent years we have taken a break from GSoC, mostly due to personal reasons and time constraints. After a successful SoK 2024 programme this year we decided to participate in GSoC2024 again.
This year we had Israel Gladima and Kuntal Bar who spent 3 months with us working on quite challenging projects aimed at addressing two major feature gaps in LabPlot, namely Python scripting and visualisation of 3D data. These two development topics had already been the subject of several discussions and even initial implementations on our part, but we never managed to finalise them and make these features available to our users. Based on the already available results of the last years’ work, we decided to re-initiate these projects and work on them during GSoC2024. Despite the technical challenges and complexity of these projects, Kuntal and Israel did a very good job this summer and delivered amazing results.
We refer you to their blog posts here and here for more details of the work that has been done. In the coming weeks and months we’ll continue to work to finalise these features and get them ready for the first release. The LabPlot team would like to thank Israel and Kuntal and we’re looking forward to your contributions in the future!
Translating Qt Applications
Translating a Qt application, can be a daunting task. This is an overview from Qt 5 to Qt 6 and what new functionality Qt 6.7 brings.
Continue reading Translating Qt Applications at basysKom GmbH.
Tryton News: Newsletter September 2024
During the last month we mainly focus on bug fixes, behaviour improvements of several things and speeding-up performance issues stepping forward to our next release 7.4 scheduled to the 4th of November. We also added some new features which we would like to introduce to you in this newsletter.
For an in depth overview of the Tryton issues please take a look at our issue tracker or see the issues and merge requests filtered by label.
Changes for the User Sales, Purchases and ProjectsWe add a new sale reporting per promotion.
We add now a relate from promotions to their sales.
We improved the exception handling wizards on sales and purchases. We added two fields to let the user explicitly fill with the records to ignore or to re-create.
Any cancelled record that is not added to one of the fields, will stay in exception state to be proceeded later. Also we changed the view between a MultiSelection to a Many2Many field depending on the number of records in the exception state.
Now, Tryton doesnât add extra lines on sale orders for inactive products. Also Tryton does no longer recommend inactive products.
We removed the Menu: Parties â Parties â Parties Associated to Sales/Purchases entries, because the result is not limited to sales or purchases in state validated or processing. A draft, quotation or cancelled order doesnât qualify a party as a customer or supplier. The functionality is already replaced by the reports in Menu: Sales â Reporting â Sales, Sales per Customer and Menu: Purchases â Reporting â Purchases, Purchases per Supplier which adds the ability to filter per state and per period.
Accounting, Invoicing and PaymentsNow we re-launch the update of the payment customer for Stripe and Braintree in case it failed. Also the users can manually initiate the update process.
Stock, Production and ShipmentsNow we round up weights and the other measurements to two decimals for the shipping carriers DPD, Sendcloud and UPS.
We make package measurements read-only once they are closed.
User InterfaceWe remove the favourite management from the favourite menu, because of
several issues [1] [2] and duplicated functionality.
Now we group links with a similar functional scope together.
In Menu: Administration â User Interface the entries
- View Tree Widths,
- View Tree Optionals,
- View Tree States and
- View Searches
are moved to the Open related records toolbar-menu of Menu: Administration â Models â Models.
We improve the widget for MultiSelection fields in the Tryton clients by adding checkboxes which display the selection state of the row. If the users clicks on a row, the selection state will be changed.
Now we visually remove records from Many2Many fields used in Wizard instead of greying them out.
We keep the CSV export dialogue now opened after exporting, to have a better user experience when fixing bugs, export and again fixing bugs.
Since we moved the functionality from product_price_list_dates to product_price_list, you can open price list lines in a new tab to be able to filtering, search or import import them.
New Documentation or NamingWe improved and unified the stock action naming and re-worked documentation:
- Rename âProduct Quantities By Warehouseâ into âStock Quantities By Warehouse.â
- Remove âLots By Warehouseâ relate as the same view can be opened from the stock location relate.
- Rename prefix âLocations Quantityâ to âStock Locationsâ.
- Document viewing stock levels of lots.
- Rename âProducts by Locationsâ into âProductsâ, as the locations are added to the tab name, there is no need to specify.
We released bug fixes for the currently maintained long term support series
7.0 and 6.0, and for the penultimate series 7.2.
Please update your systems to take care of a security related bug we found last month: trytond allows to execute reports for records for which the user has no read access and also for reports limited to a set of groups that the user is not member of.
Changes for the System AdministratorNow we use a random value for cron next call field when no value is defined.
Now we log the last cron scheduler runs and their durations. A new cron task periodically cleans the log entries. The new cron-section configuration variable clean_days (default 30) sets this period.
Changes for Implementers and DevelopersThe Tryton view-tests now check for some more attributes like sequence and on_write in tree-views or dtstart and dtend in calendar-views.
Now we unify the term âemailâ, as it is now the most common and recommended form.
We add to all âcostâ-terms a âsaleâ-suffix in sale shipment cost fields to improve the naming convention and to avoid collisions or misinterpretations.
1 post - 1 participant
Specbee: Simplifying Drupal and Salesforce integration: A how-to guide
William Minchin: u202409302311
Summary plugin for Pelican v1.3.0 released! Now keeps internal link indicators (like {filename}) from leaking into summaries. on PyPI #Summary (Pelican) #Pelican Plugins #Releases #Python