charolastra

joined 1 year ago
[–] [email protected] 3 points 1 month ago* (last edited 1 month ago)

Keyword "typically". If I'm overriding dunder methods, then I'll typically need to call the super method as well. It's not like it's forbidden.

Consider the following:

class MyStr(str):
     def len(self):
          return len(self)
          # OR
          return self.__len__()

Both of the above return values are perfectly valid Python.

[–] [email protected] 3 points 1 month ago* (last edited 1 month ago) (2 children)

At the end of the day, len(ob) just defers to ob.__len__() so both are correct, just one's more functional and one's more object oriented.

[–] [email protected] 4 points 4 months ago (1 children)
[–] [email protected] 1 points 4 months ago
[–] [email protected] 3 points 5 months ago

Came here to say this

[–] [email protected] 1 points 5 months ago

Well I'll be..! I wonder if that's how they came up with the word?

[–] [email protected] 2 points 7 months ago (1 children)

The second edition was published last Feb (2023) I believe. I read it on my Kindle, having "flicked through" the online version about 6 months prior, and yeah having it page by page with bookmarks etc was almost as good as paper, but far superior to the web version and I was able to read it cover to cover and gain a lot from it. I immediately then read about 4 other books on Rust! Can recommend "Rust Atomics & Locks" by Mara Bos, and "Rust for Rustaceans" by Jon Gjengset for the next level up.

[–] [email protected] 2 points 7 months ago (3 children)

Agree. The official book is a really good start though, and available for free. https://doc.rust-lang.org/stable/book/

[–] [email protected] 1 points 7 months ago

I can relate to this. It takes quite a lot of effort/mindfulness or cannabis (or all of the above) to come down off the work buzz and actually stop working in my head! Otherwise, as much of my day as I can get away with will be either work or personal projects (which are very similar to my work for the most part)

[–] [email protected] 4 points 7 months ago (1 children)

What about figuratively?

[–] [email protected] 3 points 8 months ago

This is already affecting me tbh. Like autotune in popular music though, the majority of people will probably just forget (if they ever notice in the first place) that it exists.

[–] [email protected] 11 points 8 months ago

Crimean River

view more: next ›