Aggregator

A Freedom Perspective. Let's Catch Up

2 months ago

 Reglue: That's when I posed the question to her. "So if Microsoft or any other software company can access and change your machine against your will, then who really owns your computer?"

New Neptune OS V5.4, Slax 9.5.0 Now Available, GNOME Redesigning Icons, KDE Applications 18.08 Enters Beta Testing and Kernel 4.18-rc6 Released

2 months ago

News briefs for July 23, 2018.

Neptune OS released V5.4, which is a complete update with many enhancements and fixes to the Debian-based distro. New features include a GUI makeover with dark themes in mind, increased hardware support, and several software and app updates. See the post on Appuals for all the details and the changelog.

Slax 9.5.0 has been released. Slax is a "minimalistic, fully modular operating system", and you can purchase it "preinstalled on an USB flash drive with hardware-based AES encryption. This device is universally usable because the encryption is performed directly by the drive itself, there is no software to install needed. Once disconnected, the USB drive automatically locks itself again". Payment is accepted only via Bitcoin.

Linux kernel 4.18-rc6 was released. Linus commented "So this was the week when the other shoe dropped....The reason the two previous rc releases were so nice and small was that David hadn't sent me much networking fixes, and they came in this week. That said, it's not really a huge rc this week either, so it's all good." Source: LWN.net.

GNOME developers are redesigning its icons, so your desktop will soon be more colorful, OMG Ubuntu reports. In addition, "GNOME is deprecating the use of tiny icon sizes in favour of symbolic icons, and will only require devs to ship a 'single, scalable, high resolution' app icon."

KDE Applications 18.08 has begun beta testing with version 18.07.80, and the release is scheduled for August 16, 2018. The software suite is adding two new libraries: KPkPass (for reading Apple Wallet pass files) and KItinerary (which consists of "itinerary extraction code and itinerary data model used for data model, data extraction, and data augmentation"). See the announcement and the KDE Community Wiki for more information.

News Distributions GNOME Debian Neptune OS Slax kernel KDE
Jill Franklin

Introducing Python 3.7's Dataclasses

2 months ago
by Reuven M. Lerner

Python 3.7's dataclasses reduce repetition in your class definitions.

Newcomers to Python often are surprised by how little code is required to accomplish quite a bit. Between powerful built-in data structures that can do much of what you need, comprehensions to take care of many tasks involving iterables, and the lack of getter and setter methods in class definitions, it's no wonder that Python programs tend to be shorter than those in static, compiled languages.

However, this amazement often ends when people start to define classes in Python. True, the class definitions generally will be pretty short. But the __init__ method, which adds attributes to a new object, tends to be rather verbose and repetitive—for example:

class Book(object): def __init__(self, title, author, price): self.title = title self.author = author self.price = price

Let's ignore the need for the use of self, which is an outgrowth of the LEGB (local, enclosing, global, builtins) scoping rules in Python and which isn't going away. Let's also note that there is a world of difference between the parameters title, author and price and the attributes self.title, self.author and self.price.

What newcomers often wonder—and in the classes I teach, they often wonder about this out loud—is why you need to make these assignments at all. After all, can't __init__ figure out that the three non-self parameters are meant to be assigned to self as attributes? If Python's so smart, why doesn't it do this for you?

I've given several answers to this question through the years. One is that Python tries to make everything explicit, so you can see what's happening. Having automatic, behind-the-scenes assignment to attributes would violate that principal.

At a certain point, I actually came up with a half-baked solution to this problem, although I did specifically say that it was un-Pythonic and thus not a good candidate for a more serious implementation. In a blog post, "Making Python's __init__ method magical", I proposed that you could assign parameters to attributes automatically, using a combination of inheritance and introspection. This was was a thought experiment, not a real proposal. And yet, despite my misgivings and the skeletal implementation, there was something attractive about not having to write the same boilerplate __init__ method, with the same assignment of arguments to attributes.

Go to Full Article
Reuven M. Lerner