Threads for jscn

  1. 2

    I was shopping for a test runner not long ago. I saw the new Node test runner and experimented with it a bit, but gave it a pass mostly because of its experimental status.

    It kind of reminds me of a test runner I once used called tape, which also generates TAP output. My initial reaction when I found tape was, “Brilliant! Yes, let’s use an existing, standardized test output format.” In practice, I found that I didn’t actually care that the test runner was separate from the output formatter. All I cared about was whether the output showed me what I needed when a test failed. In JavaScript, tests are frequently deep equality checks, either in data that can be serialized as JSON or occasionally in presentation components written in a template or markup language. Someone wrote a TAP output formatter to display Jest-like diffs between expected vs. actual deeply nested values, but I wasn’t able to get it to work with tape. Everything past the second or third layer of a given data structure was incorrectly rendered as NULL. I haven’t tried deep equality checks on the Node test runner yet, but that will be the first thing I check if I ever give it another look.

    TypeScript support (referred to in this article obliquely as transpilation) is also pretty important. I don’t expect the Node test runner to ever support TypeScript since Node doesn’t have first class TypeScript support anywhere else. Lately I’ve been using ts-jest, but I’m kind of regretting it due to some ambiguity about the correct file extension to use on TS module imports, which is arguably a flaw in TypeScript itself rather than ts-jest. Were it not for that, I would be pretty happy with my choice. When a test written in TypeScript fails, I’m far more confident that the cause is a flaw in the source rather than a typo in the test code.

    Is anyone else here writing unit tests in TypeScript? What’s your setup?

    1. 2

      Personally I have been using vitest. It is more straightforward to set up than jest, and supports typescript. Unless you need some very specific feature or integration of jest, I would pick vitest over jest in any situation.

      1. 2

        And it supports esm out of the box, which I could not get working with jest at all.

        1. 1

          To be honest, in my experience, getting Jest to do anything but the basics like trying to break a rock with your head.

          1. 1

            Hah. I haven’t had to configure Jest myself until this recent experience trying to use it in a new esm-only project, but as a user it’s always worked perfectly for me in the past. 🤷🏽‍♀️

      2. 2

        We’re using Jest, and it’s pretty terrible. Slow, memory leaks galore, and diffs in test failures appear to be text-based, so it’s often hard to understand which part of the diff is actually meaningful. First time I’ve heard of vitest, might be worth giving it a try on one of our larger projects.

      1. 20

        Formal methods. I’ve already committed to this since I convinced my team lead that it’s be a good idea to specify our system in TLA+, so I’m gonna read up on it during the holidays and hopefully not prove myself wrong.

        Prolog, wanted to do a web application with its http library and use it as database.

        Some hardware stuff maybe. My BU at work does a lot of hardware/embedded stuff and I’d love to learn how some of it works.

        Reading/writing assembly, so spending a lot of time on Compiler Explorer probably.

        1. 5

          Prolog, wanted to do a web application with its http library and use it as database.

          I’m curious why you’re interested in Prolog. When I was taught Prolog, it was as an example of a category of programming languages that doesn’t really exist. I’ve actually written a non-trivial amount of Prolog (and enjoy it), but the languages that inherit ideas from Prolog tend to be proof assistants and solvers, rather than general purpose languages. SMT solvers such as Z3 are the closest to descendants of Prolog and are a lot more generally useful (Prolog has SLD derivation and cuts to hack it to try to explore the solution space in other directions, most solvers have pluggable tactics). If I were starting today, I’d learn Z3 rather than Prolog.

          1. 2

            Well first of all, Z3 doesn’t really fit my purpose of writing a web application, and my plan was more to write a web application and learn Prolog through the process rather than learning Prolog by itself. I’m admittedly more interested in getting the program done than learn everything about Prolog.

            Second, I don’t really know what I could use Z3 for, or rather, I don’t know what it does exactly and I haven’t found a project that interests me where I think it could be useful. Maybe somebody else could enlighten me on this.

            1. 2

              Z3 is an example of an SMT solver. Those take a set of constraints as input, and try to either return an example set of values that satisfy the constraints, or prove that it’s impossible.

            2. 1

              SMT solvers such as Z3 are the closest to descendants of Prolog

              I’d consider Answer Set Programming (ASP) to be the closest descendant. Current practical implementations also have a “solver” flavor (like Z3) but the language uses close to Prolog syntax, and retains semantics that imo capture many of the interesting features of Prolog, like negation-as-failure, ability to straightforwardly define transitive closure, etc. (it comes out of attempts to come up with a less operational semantics for Prolog, of which one proposal, the “stable model semantics”, became the basis for ASP). I use clingo as the implementation, which is pretty solid.

            3. 4

              Plus one for learning TLA+ this year. I ordered @hwayne’s book a year or so ago and read it but didn’t complete all the exercises.

              I found the whole thing frustratingly almost made sense while remaining just out of reach. I had trouble imagining systems that were both motivating to try to model, and also small / simple enough that I would have a chance of succeeding. Systems that would be really helpful to model at work were just way too complicated for me, but problems that I felt I could probably get working seemed trivial and not interesting enough to motivate me to work on them.

              I’d be very interested if anyone had some suggestions for exercises or problems of various levels of difficulty to practice on. Something like exercism for TLA+ would be awesome.

              1. 1

                I think our system is at a sweet spot where it’s not terribly complicated, but also very prone to missing edge cases, and there’s a few very clear invariants that should hold up all throughout, so I think mapping it to what (admittedly little) I know about TLA+ should be possible without too much pain. I’ll probably also try to write a blog post about it when I’m at a good point in specifying it.

              2. 2

                TLA+ legitimately changed how I view software. That’s really the best case scenario when learning a new tool - it affects the way you think, whether or not you actually end up using it at your day job.

                One of the reasons that TLA+ is so much easier to learn than so many other formal methods tools is that Leslie Lamport is, in my opinion, pretty much the best technical writer there is. So many formal methods books and papers are really tough to follow, even with lots of the background knowledge. I found Specifying Systems to be extremely easy to follow along with, and there’s even asides on math concepts when he feels that it’s useful.

                Can’t recommend going down that path enough.

              1. 3

                Started a new job this week, so I’m trying to get my head around the business, the architecture and how it all hangs together, while learning a whole new stack (TypeScript + DynamoDB). Doesn’t leave much head space for anything else!

                1. 2

                  $work: I handed in my resignation last week, so I am finishing up some things and starting to do hand overs. !work: The new job will be on a different stack (TypeScript and DynamoDB), so I am going to port an old JS project to TS as a way to get my feet wet. I’m also continuing reading Practical TLA+ (thanks @hwayne!). I’m finding the big up front info dump kind of hard going, and hoping the more practical second half of the book will help things click for me.

                  1. 2

                    Hugely surprised to see this is built in New Zealand, I wasn’t aware of any real Clojure presence here.

                    1. 12

                      There are a couple of companies using it here, but not many. But Cursive is built in NZ just because I happen to live here.

                      1. 2

                        Good to hear. I couldn’t find any signs of a local Clojure/Functional Programming/Lisp community here in Christchurch when I was trying to learn Clojure last year (I thought I could convince the powers that be at work to allow me to use it, but that turned out not to be the case so I ended up dropping it). Is there much happening in that sphere in your neck of the woods?

                        1. 2

                          Well, I live in Nelson, so there isn’t much of anything happening from a tech perspective :)

                      2. 0

                        Last time I tried Cursive I think it was a one-person show. Not sure if that’s still true. For all I know that person is the sum of the Clojure presence in NZ :)

                        Edit: Looks like from @lemming’s reply that I was wrong about the size of the Clojure community

                      1. 3

                        Although if you’re in tech I would highly advise mentioning that you need more money if there’s an open office in your next interview (somewhere around 20% as that’s what the estimates say they’re saving in the short term).

                        I really like the sound of this (surprise!), but I don’t see how you could make a plausible argument for it. The employer is using an open office to save costs, so paying you more negates the benefit to the employer. Why would they do that? Particularly as open offices are now the norm (at least in my experience) you’re not likely to have a BATNA on this front.

                        1. 2

                          The argument is: “Cost-saving to the detriment of your employee’s is not reasonable, so you can be cost neutral and I will suffer through, or you can deal me out with some form of shared office or personal space”.

                          Basically, why should the employer unilaterally save on costs? they’re already trying to get you for as cheap as they can, this is a negotiation tactic.

                          I know it costs them roughly 20%, so you can pass on the savings to me or I will pass on your “opportunity”. We have a lot of power in tech right now, we should absolutely be using this to improve working conditions, especially as that will actually make some of us more productive.

                          1. 2

                            So the argument depends on the employer thinking you’re >20% more valuable than the next applicant. I could see that working in some markets. It seems more plausible to me if I were already an employee and the office layout was changed to open plan.

                            Is this a common attitude to negotiations in the US? It seems uncomfortably confrontational to me. I wonder if it is a cultural thing. Or I am terrible at negotiating and am imposter-syndroming my way out of non-trivial chunks of cash.

                            1. 1

                              I’m not from the US, so I wouldn’t know if it’s a common attitude or not.

                              I understand why you’d think it’s confrontational. And it can be if it’s coming to blows.

                              I’m just trying to convey that they should not think that they can get away with ‘saving’ on you, if they’re willing to pay upwards of $3k for a device that makes you more productive, but put you in a meatgrinder to save a buck it’s a little bit hypocritical; the point you’d be making is that there is an added cost for them, it’s not just all savings.

                              1. 2

                                if they’re willing to pay upwards of $3k for a device that makes you more productive, but put you in a meatgrinder to save a buck it’s a little bit hypocritical

                                If you want to be overly charitable: some people can’t get their head around the fact that open-plan offices are not a net cost savings. Maybe they just never had anyone point this out to them, or maybe it just bounced off their brain. Your bringing this up in negotiation is making them aware of a cost (to themselves) that they’d previously incorrectly assumed was zero.

                                1. 1

                                  I’m not from the US, so I wouldn’t know if it’s a common attitude or not.

                                  Sorry for the assumption.

                          1. 1

                            Tweaking HTML for a login flow in a Java application for which I do not have access to the source, and which takes several minutes to compile and deploy to test every time I tweak a form field. Also, continuing to look for a new job!

                            I’ve ordered quite a bit of seed which should be coming in this week. So I’ll be starting some of those off, a little late in the season but better late than never. This is my first year seriously trying to grow a large portion of our vegetables, so it will be a big learning experience.

                            1. 59

                              go fmt is the kind of hero every language deserves.

                              1. 3

                                For those who don’t know about it: The go fmt equivalent for Java is Google Java Format.

                                1. 3

                                  Would just like to mention Prettier here, in case anyone is writing JavaScript / TypeScript and doesn’t know about it.

                                  This has become such an important point for me, I almost consider languages without a tool like this unusable.

                                  1. 7

                                    I think Go takes it a step further by disallowing configuration (unlike Prettier). Much like type systems eliminate a class of errors, go fmt eliminates a class of bickering.

                                    1. 5

                                      You should check out black for Python, it’s really nice and builds on the same ideals.

                                      1. 1

                                        disallowing configuration (unlike Prettier).

                                        That’s one reason I like Standard JS.

                                        1. 1

                                          Absolutely true, and I wish they’d just straight up remove the option. Still, I’m glad it works without configuration, and stubbornness is punished with extra dotfile clutter in your repo that is entirely on you.

                                      2. 1

                                        mix format for Elixir code. Same philosophy too, I believe. No more arguments about formatting.

                                      1. 2

                                        So refreshing to see people reading books other than the latest pop-science / pop-tech / pop-management books.

                                        Recently finished:

                                        Currently reading:

                                        • Fall; or, Dodge in Hell. I can’t not read a book by Neal Stephenson. Despite his inability to write endings, I always enjoy his novels.
                                        • Re-enchanting Humanity. Just started this one. I’m trying to figure out a framework that lets me see some hope for the future. I’m hoping this will help with that.
                                        • OAuth2 in Action. For work. Pretty good book. Unfortunately, due to bit-rot and node.js, the code samples no longer work, and I can’t be bothered to try and bring them up to date. I plan to re-implement the examples in Go or Python instead.
                                        1. 1

                                          the ‘just city’ sequels are worth reading too; i found the final wrap-up very satisfying.

                                          1. 1

                                            That’s good to know, I saw the second one at the public library last week and passed it over, but I’ll try and pick it up next time I’m there.

                                          2. 1

                                            I thought the endings of Anathem and REAMDE and Seveneves were pretty decent, no?

                                            1. 1

                                              I need to read Anathem again, it’s been quite a few years since I read it so I can’t say for sure. Seveneves felt to me like two novels jammed together; while the second part was technically an end to the first part, I’m not sure I could say it was satisfying. Admittedly, REAMDE was decent. Maybe I was a bit unfair :)

                                          1. 6

                                            I most recently finished Metamorphosis by Kafka. I read it on my kindle whilst in the queue to go up the Church of our Savior in Copenhagen. I tend to read multiple books at once so to start and finish a book in a single sitting was pretty unusual but worth it.

                                            Just before that I finished Random Acts of Heroic Love, which I thought was beautifully written.

                                            I’m currently reading through Augustine’s Confessions, Wittgenstein by David Pears, Singer’s Animal Liberation, and Philip K. Dick’s Do Androids Dream of Electric Sheep?

                                            I’m also working through K&R’s The C Programming Language. Next in my backlog is Jeeves in the Offing by Wodehouse and Birdsong by Sebastian Faulks.

                                            1. 4

                                              I read Birdsong a couple of years ago and would recommend it. I found the first part pretty hard going: it read like an over-wrought romance novel, but the rest of it was great, if somewhat haunting.

                                              1. 2

                                                Yeah, I got given it as a birthday present last year, but have had so much else to read I haven’t managed it yet. During high school we had to analyse part of it, and had the kind of English teacher who would encourage everyone to read it and then explain the whole plot, giving the majority of the class no reason to read it. Since then I’ve planned to, but never quite got around to it.

                                              2. 3

                                                Do read Kafka’s other work if you haven’t already. I really loved The Castle (pardon the ssl error): https://bensima.com/2018/01/the-castle-by-kafka/

                                                1. 2

                                                  I definitely intend to, although I’ve got a significant backlog of physical books and epubs to read first. Unfortunately I just caused a bit of an issue for myself by accidentally sitting on my Kindle, so a lot of my epubs I won’t be able to read for a fair bit longer (no way am I reading a book on a backlit screen) - so if I can find a cheap physical copy, I might be reading it sooner!

                                                  1. 2

                                                    no way am I reading a book on a backlit screen

                                                    I love my ebook reader and very strongly agree with this statement. Sorry to hear about your Kindle though D:

                                                    1. 2

                                                      Me too :( gonna have to takevto ebay rather than buy direct though, because I maintain that the models past the Kindle 4 (aka all the touchscreen ones) don’t feel right.

                                              1. 10

                                                Finished Anathem recently, and quickly followed it by Accelerando. Both were fantastic, although Anathem invents a lot of words for the sake of it, and as such I felt that Stross’ Accelerando was a better read.

                                                I’m starting Dragon’s Egg now.

                                                1. 2

                                                  I could not get past half of Anathem. I did love the universe and all, but compared to snow crash it felt so uneventful…

                                                  1. 2

                                                    I seem to have a memory that this book was originally written as a script for graphic novel, which I think explains the pacing and style, as compared to Anathem (or probably any other book by the author).

                                                    1. 2

                                                      Snow Crash was originally the script for a VN, not a graphic novel. Stephenson dropped it when Apple suddenly changed the quickdraw API, breaking all the code he had already written (as discussed in In the Beginning… Was the Command Line).

                                                      It’s a shame, because had Snow Crash come out as a VN in 1993, it might have drastically changed the video game landscape.

                                                    2. 2

                                                      That’s a reasonable reaction to it. A lot of it reads like a Socratic dialogue, and it’d be easy to get bored.

                                                      I couldn’t get through Snow Crash. I’ve never been a fan of cyperpunk, and it comes across as a bit of a parody of it, which I couldn’t really appreciate.

                                                      1. 2

                                                        I found that it all started happening ~300 pages in, and never stopped. Interesting way to go about it.

                                                      2. 1

                                                        If you liked Accelerando, try also Rapture of the nerds.

                                                      1. 15

                                                        A week ago, I finished Good Omens by Terry Pratchett and Neil Gaiman after watching the first four episodes on Amazon and being shamed into reading the book first. I cheated and used an audiobook, but thankfully the deliver was really good. I highly recommend it.

                                                        I just started listening to the audiobook for Snow Crash by Neal Stephenson. Don’t know much about it other than that it was recommended to me by a fellow programmer and it has heavy references to hacker culture. The first chapter is subtle in its humor and not-so-subtle in its nihilism, and it’s an entertaining contrast. I’m pretty excited to read more.

                                                        1. 6

                                                          I really like both books. After you read Snow Crash, I really recommend “The Diamond Age” by Neal Stephenson. In my mind those two books should be read one after the other.

                                                          1. 5

                                                            My favorite Stephenson book after Snow Crash is Cryptonomicon. Prescient to write a book in 1999 about a crypto data haven.

                                                            1. 3

                                                              that is an amazing book :-)

                                                          2. 3

                                                            I read Good Omens years ago while I was in a book club. I’m really glad it wasn’t my first Gaiman book (I read American Gods and Stardust before) because I honestly didn’t really like it. It kinda fizzed and went no where. It’s hard to tell what’s Gaiman and Pratchett too, and I don’t feel like it’s a good mix of authors.

                                                            The book club was in Australia too and it was kinda funny to hear people talk about the “bikies” which is how they say bikers. … Sounds too cute a work for people on motorcycles.

                                                            1. 3

                                                              I think it was my first Gaiman book, but not my first Pratchett book, and I really enjoyed it. But I read it a very long time ago, and I wonder if I would still enjoy it as much today.

                                                              1. 3

                                                                Yeah I was also somewhat disappointed by it. I was also thinking of trying American Gods though, so thanks for the rec!

                                                                1. 3

                                                                  American Gods is good. I really liked it. Actually I’d recommend Stardust as a good Gaiman starter book. It’s shorter and the story is just really neat and fun.

                                                                  1. 3

                                                                    Ok, I’ll consider it as well 😄 I don’t have my hands on Stardust though, since I bought a bunch of Neil Gaiman books at a recent event of his and that wasn’t one of them. Hopefully the local library has a copy.

                                                              2. 2

                                                                I didn’t think Snow Crash was going to be my thing, but it’s great!

                                                              1. 8
                                                                $ sqlite :memory: <<EOF
                                                                .output stderr
                                                                
                                                                create table courses (id unique, title);
                                                                create table enrollments (name, course_id);
                                                                
                                                                .separator ","
                                                                .import courses.csv courses
                                                                .import enrollments.csv enrollments
                                                                
                                                                .output stdout
                                                                
                                                                select *
                                                                from enrollments
                                                                join courses
                                                                on enrollments.course_id = courses.id;
                                                                EOF
                                                                

                                                                The unique constraint on courses.id has the advantage of creating an index to speed up the join.

                                                                1. 4

                                                                  I had never considered using sqlite like this before, thanks!

                                                                  1. 5

                                                                    You are quite welcome. Few people think of using it for this kind of thing, despite sqlite’s near-universal presence. I have written comments about sqlite before on lobste.rs that you might find interesting, in particular this comment on a post sharing the q cli tool.

                                                                1. 12

                                                                  One of the things that intrigues me are extensive personal websites, just full of a huge pile of stuff the site owner finds interesting, has written, etc. Not exactly the same as a prolific blog (though there is overlap), because they tend to be more hypertext structured, in ways other than purely chronological post dates plus tags; more like a big personal wiki in some cases.

                                                                  These were more common in the ‘90s I think, but there are still some around (some dating to then, others a bit newer). Four that come to mind: John Walker’s fourmilab, Pierro Scaruffi’s website, Cosma Shalizi’s bactra.org, and Gwern Branwen’s website.

                                                                  Not necessarily a model for creating a personal website if you don’t have a decade or so to invest in it though! Of those four, it looks like: one is a university professor, one is a wealthy tech entrepreneur, and two are independent writers/researchers.

                                                                  1. 3

                                                                    John Walker & Gwern’s sites are great. In the same vein (but leaning more toward being a blog) is Charlie Stross’s site, which also contains his wife’s font work. (Stross isn’t as prolific on his blog as he used to be – writing two novels a year at 50+ while also dealing with carpal tunnel and trying to use an iPad for some of it lowers productivity in terms of pure word-emission rate – but there’s a community of regulars in the comments there, many of whom have been posting consistently since before I first discovered the site ~10 years ago. Common topics are similar to Farber’s IP list – i.e., ostensibly tech and science fiction, but with a nigh-inexplicable attractor around the history of aviation tech & an abiding interest in espionage and international relations.)

                                                                    Not necessarily a model for creating a personal website if you don’t have a decade or so to invest in it though!

                                                                    My own website has been around for a much shorter time but it growing along a somewhat similar model (though originally just a kind of portfolio for my writing). Presumably, this is what Gwern’s site would have looked like after only a year, if he had way less free time.

                                                                    1. 1

                                                                      I get a SSL_ERROR_BAD_CERT_DOMAIN for your website?

                                                                      1. 1

                                                                        It doesn’t have HTTPS at all. (It’s static & non-secret, so why bother?)

                                                                        1. 2

                                                                          Yeah, but your link is to https and that looks like it’s falling back to the hosting service you’re using.

                                                                          1. 1

                                                                            Hmm… Maybe I made a typo. Lobste.rs doesn’t want me to edit it anymore.

                                                                      2. 1

                                                                        I’m getting some bad cert errors when I visit your personal errors.

                                                                        1. 1

                                                                          I don’t have a cert. My personal errors are 100% public.

                                                                      3. 2

                                                                        I came across https://musicinformationretrieval.com/ recently also.

                                                                        1. 2

                                                                          In a similar vein, I used to enjoy https://ftrain.com/

                                                                          1. 2

                                                                            This page definitely qualifies, a wealth of technical info and images about Nikon cameras and lenses.

                                                                            http://www.mir.com.my/rb/photography/entry.htm

                                                                          1. 2

                                                                            Work: writing more API glue code and associated UI.

                                                                            Non-work-but-work: looking for a new job. I have an interview booked early next week for a role doing the same sort of thing I did years ago. It doesn’t really make sense from a career progression perspective, but I really want to work in greentech and there are not many options available in my location. Companies that do “remote” don’t seem to want to hire someone in UTC+13 :/

                                                                            Actual non-work: starting to lay some plans for a forest garden in the front yard, and some bio-intensive beds in the back yard. I want to run a trial of double-dig vs no-dig on some beds. Also planning some hikes in the near future.

                                                                            Reading:

                                                                            1. 5

                                                                              I really wish that instead of data classes, which force me to invent types for my data, we’d get a nice built-in syntax for named tuples that wouldn’t require importing a module and repeating the record name twice.

                                                                              1. 3

                                                                                I really wish that instead of data classes, which force me to invent types for my data, we’d get a nice built-in syntax for named tuples that wouldn’t require importing a module and repeating the record name twice.

                                                                                Well, you still have to specify the types of your data and do an import, but there is a nice alternative syntax for named tuples if you want to avoid repeating the record name:

                                                                                class Component(NamedTuple):
                                                                                    part_number: int
                                                                                    weight: float
                                                                                    description: Optional[str] = None
                                                                                
                                                                                1. 1

                                                                                  Thanks, I didn’t know about the capitalized NamedTuple.

                                                                                2. 2

                                                                                  I agree, the types seem like an unnecessary complication.

                                                                                1. 12

                                                                                  I used to be a fan of Python but almost all the stuff here seems weirdly tacked on. Added with good intentions for sure but a lot of it seems short-sighted, implemented in the least-effort way.

                                                                                  • f strings are like u strings in Python 2: a compatibility hack to make old code not go bust. Maybe these should’ve been just regular strings in Python 3, but over the entire lifespan format strings were not necessary but we need them mid-way in Python 3? Odd.
                                                                                  • Pathlib uses the division operator in a weird way. I guess maybe this is similar to how + concatenates strings but seems to be overly cute for cuteness sake. Granted, this is a minor point.
                                                                                  • Type hinting. I guess it is nice. Doesn’t seem fully formed, since that was introduced in 3.0 but had no guidelines on how to use it. I’m not necessarily a fan of adding features without a clear idea how to use it but okay, we seem to be getting to some point now.
                                                                                  • Enumerations look like a weird hack, not a language feature. Without matching/dispatching on Enums these don’t feel all that useful. This is like ADTs but without the good parts.
                                                                                  • Data classes or as we in ML call it, records. Useful feature, again as a decorator hack. But I can certainly see it being helpful. Again, no destructuring on them, which would make them much more useful.
                                                                                  • Implicit Package Namespaces. Could you make Python packages more obscure with more special rules? Turns out you can.
                                                                                  1. 17

                                                                                    Why do you feel that Py3’s f strings are like Py2’s u strings? The f stands for “format”, meaning you can avoid the .format() method. The u stands for “unicode”, and is something else entirely. I don’t see how the two compare, would you care to elaborate?

                                                                                    The division operator used in pathlib merely mimics the directory separator in unices. If we have p = pathlib.Path('/path'), then p / 'to' / 'file' is the same as /path/to/file. Pretty easy and convenient, if you ask me.

                                                                                    1. 2

                                                                                      Why do you feel that Py3’s f strings are like Py2’s u strings?

                                                                                      Because both are what strings should’ve been by default. But one couldn’t change Python 2 in a compatible way so Python 3 strings are what were u strings in Python 2. Similarly with f strings, in languages that do format strings this way (Ruby, Shell, PHP come to mind) this is a default behaviour, with a way to opt-out. But that can’t be added in Python 3 because all existing code that might contain formatting characters would start doing unexpected things, so f strings had to be created. A hypothetical Python 4 would probably use f strings as default.

                                                                                      My complaint here is if there is a new formatting syntax introduced, why was it added now and not in a clean syntactic way when Python 3.0 was introduced?

                                                                                      The division operator used in pathlib merely mimics the directory separator in unices.

                                                                                      I understand that it is for that purpose, but it is a “cutesy” misuse of division. The reverse operation of division would be multiplication, but what would multiplication on a path even mean? But as said, this is a minor complaint since Python already has + on strings, with no symmetrical - operation.

                                                                                      Fun fact, Elixir has + on lists and also - on lists. What does it do? I’m leaving this as an exercise to the reader.

                                                                                      1. 1

                                                                                        Thanks, I understand what you’re getting at.

                                                                                      2. 1

                                                                                        Operator overloads, yeah, brilliant. Let’s bless this kind of crap so we can be surprised by more un-obvious, difficult-to-introspect garbage.

                                                                                      3. 2

                                                                                        I kind-of agree. It seems like a lot of recent changes make Python more complicated for not much gain. The language is starting to feel bloated instead of elegant and focused, to me at least. Thankfully they’re almost all opt-in features, so I can continue using Python as I like it, and only pick the new “features” which I genuinely get some benefit from.

                                                                                        1. 2

                                                                                          Data classes implementation is so much nastier than namedtuple, and given the fact that it’s yet-another-decorator-hack, I don’t understand why it has a pep and is in the standard lib.

                                                                                          Type hinting, asyncio (or twisted), fstrings (an abomination)…no wonder Guido bounced. The whole place is going crazy! What happened to the Zen of python? All of the aforementioned seem direct contradictions.

                                                                                          Fuck. I’ll be writing c and Lua if you need me.

                                                                                          1. 1

                                                                                            Implicit Package Namespaces. Could you make Python packages more obscure with more special rules? Turns out you can.

                                                                                            The article is wrong, you should not use this feature as it suggests. It does solve a real problem — packages like zope that are broken into multiple distributions on PyPI — see PEP 420. In this advanced use case it replaces a disgusting setuptools hack so I’d count it as progress.

                                                                                          1. 5

                                                                                            This may not be quite what you’re looking for, but the 500 Lines or Less book has some interesting examples all of which come in (unsurprisingly) under 500 Lines.

                                                                                            1. 6

                                                                                              IME, the best recommendations seem to come from bibliographies and references in other high quality books. The worst seem to come from twitter and HN. (Of course, sometimes a good book is recommended on twitter or HN, but the s:n ratio is much worse.)

                                                                                              1. 1

                                                                                                You’ve gotten bad book recommendations?

                                                                                              1. 3

                                                                                                I last posted around Thanksgiving. Starting the new job and going to India for three weeks last month was pretty enormously distracting. I feel good about handling it, though - sure, my inbox is very far from the usual zero and all my personal projects got paused, but I was on time for work every day, the bills all got paid on time, etc.

                                                                                                • Podcast: Started working with Mandy Moore, who assists with many tech podcasts. Contacting three guests, standing up the site, editing my one interview down to eps. (will probably need to redo my audio, too).
                                                                                                • Lifting: I restarted two weeks ago and it feels great. Instead of 3d/w I’m now going 4 (wednesdays are code + coffee). I’m still rebuilding to my previous norms for the next week or two, but I’d love programming resources for an beginning/intermediate lifter.
                                                                                                • Blog: finish 2018 media reviews, start 2019. Maybe draft one post, depending on social plans this week.
                                                                                                • Work: learned my way around the codebase (that I need to touch regularly - this is several orders of magnitude larger than I’ve worked on before). This week is mostly helping with support tickets and paying down tech debt on a part of the codebase that deals with an annual reporting process.
                                                                                                1. 3

                                                                                                  I really like Jim Wendler’s 5/3/1 for beginners. It’s one of the /r/fitness recommended routines. It’s a great way to increase strength without working near your max. I always had aches and pains and exhaustion when I was running a linear program. 5/3/1 with the 5x5 at the end made me surprisingly strong in a relatively short amount of time without lifting heavy. 5/3/1 for beginners is 3 days a week but there is at least one 4-day variety of 5/3/1. Just one piece of anecdata :)

                                                                                                  1. 2

                                                                                                    I’ve just started lifting again after a long hiatus, I forgot how big a difference it makes to my mental health. I’m doing SS LP and supplementing that with some KB swings and TGUs on off days.

                                                                                                    I’ve heard good things about The Bridge as a good progression for people coming out of a beginner/LP program, so I’ll give that a crack once I’ve stopped making progress on the LP program.

                                                                                                    1. 1

                                                                                                      Out of curiosity what do SS, KB, LP and TGU stand for?

                                                                                                      1. 2

                                                                                                        Sorry: