1. 1

    If you’re importing from shapes to register implementations of get_area, and them the maintainer of shapes decides to implement a “get_area friendly” new shape class, won’t that cause a infinite import loop? Because area_calculation imports shapes and then shapes imports area_calculation?

    1. 0

      No.

      1. 1

        That’s not a very helpful reply.

        1. 0

          You’re right.

    1. 1

      Wait. So, you still have no diagnosis nor treatment in the UK? Man, doctors can suck =(

      1. 2

        I quite liked this. Thinking about using it to build my own site (currently trying to use lektor, but I think it might be too complicated).

        Just one question: Is there any way to preview the webpage it will generate?

        Edit: Clarifying, can I add/edit files locally, preview the website that will be generated, and then push to github? I understand that it’s not in the scope of your project to do that, but, is there a way? Have you tried it?

        1. 2

          Since Precis is built over Github Pages which in turn is built over Jekyll, it is possible to preview it locally. Refer to this article about how to set it up.

        1. 14

          Thanks, I feel like a dick, now.

          On a serious note, that hit me right in the feels. I wouldn’t go as far as saying that I am overconfident, but I’m definitely a loudmouth, and tend to argue to exhaustion when I think I’m right.

          I’ve been working for a while in recognizing that I might be wrong and try to clearly communicate that I am open (and in fact, often hoping) to be proven wrong, but it’s a process, and I can’t help but wonder how often have I just been a massive dick and prevented other people from even throwing an idea =(

          1. 8

            I’m almost exactly the opposite. I realize that usually my preferences boil down to: “I like this way because I’m used to it”, or “I don’t think it matters”. I used to be the most experienced C# programmer on my team. My teammates used to ask me questions like “Should I assign a type explicitly or just use ‘var’?” any I would say that that’s a personal preference and it doesn’t really matter. Another programmer with a much more pronounced opinion joined the team, and I noticed that people liked his answers a lot more. Sometimes people just like to be told what to do, especially when the consequences of the choices aren’t so clear.

            1. 5

              Sometimes people just like to be told what to do, especially when the consequences of the choices aren’t so clear.

              This, and also cases where the consequences on either side of a tradeoff are so minor, that the energy spent deliberating them out is costlier than just making a call and moving on. I spent far longer learning this, and fixing my behavior, than I wish I had.

              On so many of these low-impact-low-cost details, where I did not strongly care, where I could expect another senior to reasonably disagree (even just for reasons of “this is what I am used to instead”), I would give teammates a full-depth, longwinded explanation, only to end in an equivocation and let them decide. Maybe one out of a dozen times they learned something, but often I was wasting people’s time when they just wanted a boolean result from the ask_swifthand function.

              The first step in fixing this was realizing why I always led with longwinded explanations. It turned out to be misapplied empathy (which I assume-by-default that I lack, hence it took a while to realize).

              I personally value knowing the detailed ins-and-outs wherever possible, and so I saw extending a full explanation to another person as a sign of respect: share all the learning, and help them make their own decision. But when that comes by wasting their time (on a low-impact-low-cost choice), was not being perceived that way.

              Change was slow. I first changed my explanations to lead with the decision before launching into the explanation, giving a TL;DR to frame their expectation. After some time doing this, I began leading with the decision and then asking “There are reasons I could dive into, but they are subtle and inconsequential. So I’ll leave it there, unless you are curious?” followed by a long, awkward pause while I wait for an answer.

              Due to some personality quirks that pause is the hardest part for me, but it gets the job done. It balances respecting their time by giving them the option to walk away with my desire to extend a courtesy that I would (personally) value of learning more.

              Ironically, I do not always extend this sort of preemptive empathy to the rest of my life’s conversations. The last paragraph in the article really hit home, as I know friends and family often feel my SOLH is overconfidence layered with stubbornness.

              1. 3

                Sometimes people just like to be told what to do, especially when the consequences of the choices aren’t so clear.

                Newbies need to be fed opinions because they don’t have enough experience to have any of their own, and the ones they might have at the moment are more likely to be wrong than right. Like, yes, you can write thousand-line subroutines in Python, that’s certainly something the language allows, but more mature opinion will state that writing smaller subroutines is better for reasons of ease of modification a neophyte hasn’t run into yet.

                Gnomonic pronouncements make things go faster, but once the learner has some experience of their own, pushback is to be expected and should be encouraged. Except with things like styleguides. Those are completely arbitrary and set in stone for precisely that reason.

                So teachers need to have strong opinions because they can’t go over every single thing when they answer a single question, but those opinions must be held loosely enough that students can successfully challenge them as they gain enough knowledge to exercise their own agency.

                1. 2

                  This is one thing that’s true: people like to be told what to do. People should be encouraged to think for themselves. The best of both worlds is perhaps by explaining the difference and explaining why you lean the way you do. That way you teach thought and give a straight answer.

                2. 5

                  tend to argue to exhaustion

                  that doesn’t sound “loosely held” :)

                  1. 1

                    I recently had an argument that went on for an hour until I conceded from frustration. Once we switched from the what to the how they immediately took to my original argument. Loosely held seems like it can be in the eye of the beholder.

                    1. 1

                      Well, for some definition of loosely =P

                    2. 3

                      I am open (and in fact, often hoping) to be proven wrong

                      Say that clearly and directly. Tell the other person that you are not feeling personally attacked and hope to be proven wrong.

                    1. 4

                      On one hand, that’s kinda cool. I know vaguely that there’s precedent to running linux in user space, so ain’t exactly news, but it’s a good idea, because emulation would always be a bit behind.

                      On the other hand … this feels like way friendlier embrace, but still embrace-ish. Can’t help but wonder what the extinguish phase will look like.

                      1. 9

                        There is no “extinguish”, at least not in 2018’s world. The world has changed since back when Microsoft was all powerful.

                        Just look at the tables in this article: https://www.joelonsoftware.com/2003/08/01/rick-chapman-is-in-search-of-stupidity/

                        2001 annual revenue: Microsoft $23bn. Everyone else in the top 10, put together, less than $23bn (!).

                        2018 annual revenue: Microsoft $110bn, Apple $265bn, Alphabet (Google) $136bn, Amazon $232bn, IBM $79bn, Alibaba $39bn, Samsung $210bn, Tencent $50bn, Sony $70bn, Nintendo $10bn.

                        Those are their competitors, in various domains: OSes, browsers, cloud platforms, development tools, games, etc. Notice how 3 of them are 2x the size of Microsoft. Several of them are smaller but they’re market leaders in their markets. Many of those competitors have a vested interest in Linux being healthy and successful.

                        Microsoft could easily bully Adobe around. They can’t bully Apple or Google or Amazon or Samsung.

                        The world has changed.

                        To make things more interesting, their competitors have learned from Microsoft so Apple or Google are just as big a bullies as Microsoft was, if not more, but they do it with a “gentle touch” (better PR).

                        1. 1

                          Thanks for the numbers, that’s an interesting point =)

                      1. 3

                        Anything Gary Bernhardt says, which boils down to “practice, practice, practice” anyway.

                        Also, no wall of text in the slides, definitely do not read from them. Make sure the colors are legible.

                        If you’re sure your jokes are good, go for them, but unless you’re really funny, they probably aren’t. I rather see a clearly explained talk, with good content but potentially “boring” than someone trying to be funny and engaging but only succeeding half the time.

                        Also, avoid live demos like the plague. Murphy hates them.

                        Other than that, good luck, read the other comments, they’re way better than mine. Keep cool and it will be alright =)

                        1. 9

                          I’m doing this little project for a job application, it’s a tiny etl system to load some files with coordinates, geolocate them and save in a database.

                          It’s so fun, though. I’m using flask, and trying to apply some architecture ideas I’ve read about, and it’s been a blast, really. In fact, I’m probably not even taking the job, because I got another, better offer, but I’m still working on this project just cos’ now I wanna see how it ends up!

                          Been doing C# and Powershell at work, and they’re fine, really, but man, did I miss python, and specially flask.

                          1. 1

                            Any support for mobile? I found that I rarely read PDFs on the desktop/laptop.

                            1. 1

                              It has a browser app you could try to use on mobile. I’m not sure how well it supports touch interface, as I haven’t used that one yet. When I log in with Google just now to try it it doesn’t work – it looks like the auth token isn’t properly sent back to the app, I guess.

                              1. 1

                                Looks like people are using it on mobile, based on what I see here: https://github.com/burtonator/polar-bookshelf/issues?utf8=%E2%9C%93&q=is%3Aissue+is%3Aopen+mobile

                                1. 1

                                  I tried opening the web app on my phone’s chrome browser. It looks good but the PDFs don’t open.

                            1. 3

                              Virtualenv is nice if you develop a server, but what would you use for some small command line tools?

                              For example, I have this 200 lines script which parses some CI artefacts and generates a CSV output. This is fine with just the Python standard lib. Now I would like to generate an Excel sheet but that requires an external package. The easiest way would be copy & paste? Better options?

                              1. 1

                                Depends how much upfront work the users are willing to do. If you can convince/guide them to install pipsi, then you’re good: just package your utilities as python packages, and have them install it with pipsi. I think you can even send them the package as a zip, so you don’t even need PyPI.

                                If that’s too much (and sometimes it is), then you’re just screwed. Either take the time to use something like PyInstaller, for Windows, and snap/flatpack/deb/rpm, for Linux, or give up.

                                1. 3

                                  pipsi is basically unmaintained. I would suggest giving pipx a try instead.

                                2. 1

                                  This is the use case for packaging: you have some code, it has at least one dependency that isn’t part of Python itself, and you want to distribute it for use on other computers (possibly, though not necessarily, by other people).

                                  The answer there is to build a package, and then install that package on each computer that needs to run the code. The standard approach to this is to use setuptools, write a setup.py file which specifies what to package and what the dependencies are, and use it to generate the package (preferably a wheel), then use pip to install that package on other machines (you do not need to upload the package to a public index; you can distribute the package any way you like, and people who have a copy of it can pip install from it). There are alternative packaging tools out there, and fans of particular ones will recommend them, but this is the standard workflow for Python.

                                1. 6

                                  I don’t think the description for pyenv is quite correct. While you can use pyenv plugins to manage virtualenvs, the main feature is managing python versions. Having any version or implementation (pypy, jython, etc) available, and be able to set any of those as the global python is the main goal of pyenv, dealing with virtualenvs is just a nice extra, really.

                                  Other than that, nice write up =)

                                  1. 3

                                    FWIW I use pyenv for three things:

                                    1. Creating and managing virtualenvs tied to specific Python versions (so that when I’m developing something I know I’m on exactly the same Python version the production environment will use), and
                                    2. Providing the appropriate Python interpreter versions for tox to use in creating and managing its virtualenvs.
                                    3. Setting my global default python to be whatever the latest is (currently 3.7).
                                    1. 2

                                      Yeah maybe it can be further clarified. I use environments always with the same python version but different dependencies versions so the way I think about them is maybe not representative of the common use cases.

                                      1. 2

                                        Just curious why you would use pyenv for that instead of, say, virtualenv?

                                        1. 2

                                          Personally I don’t. I think that for some people it saves some clicks and mental overhead and I can see why but I personally don’t use it because I need to make lot of switches between virtualenvs during my workflow (because rebuilding the containers appropriately would take too much time) so I prefer control over automation.

                                      2. 1

                                        anyway on a comment on reddit they explained my mistake and yes, I wrote something that was plain wrong. Now it should be correct. What I described is apparently a plugin called pyenv-virtualenv

                                      1. 2

                                        This lady has some very interesting ideas about it, look her (and her company) up: https://twitter.com/mipsytipsy

                                        1. 32

                                          Each side of this debate classifies the other as zealous extremists (as only developers can!), but both of them miss the crux of the matter: Git and its accompanying ecosystem are not yet fit for the task of developing modern cloud-native applications.

                                          So, let me get this straight: Because your source control system doesn’t have innate knowledge of the linkages between your software components, that means it’s not up to the task of developing modern “cloud native” (God that term makes me want to cringe) applications?

                                          I think not. Git is an ugly duckling, its UX is horrible but the arguments the author makes are awfully weak.

                                          IMO expecting your VCS to manage dependencies is a recipe for disaster. Use a language that understands some kind of module and manage your dependencies there using the infrastructure that language provides.

                                          1. 11

                                            well said. I dislike Git too but for different reason - the source code is somewhat of a mess

                                            a hodgepodge of C, Python, Perl and Shell scripts

                                            Git is the perfect project for a rewrite in a modern language like Go, Rust, Nim or Julia. A single Git binary similar to Fossil would make adoption and deployment much better.

                                            1. 18

                                              I think at this point Git demonstrates that skipping on the single binary rhetoric doesn’t actually hamper adoption at all.

                                              1. 8

                                                Bitkeeper was a single binary - and it had a coherent command set. I miss it.

                                                1. 6

                                                  It still exists and is licensed under Apache 2.0: https://www.bitkeeper.org/

                                                  The only issue you have is no public host other than bkbits supporting bk.

                                                  1. 1

                                                    Also no support in most IDEs.

                                                    I know many will point to the command line but having integrated blame/praise, diff, history etc is awesome.

                                                    1. 2

                                                      Honestly, the bigger beef I have with it is how little it comes with an installer and is difficult to package.

                                                  2. 5

                                                    I think fossil has that…

                                                  3. 0

                                                    I thought you are not supposed to use python because that would mean more dependencies… :P

                                                  4. 3

                                                    Arguments are indeed weak, as what is “cloud native”? However, I think he’s onto something – maybe the problem is not just Git, but everything around it as well? I mean, one could create a big giant monorepo in Git, but the rest of the tooling (CI especially) will still do the full checkout and won’t understand that there are different components. Monorepos make a lot of sense, however, it seems to me that we’re trying to use popular tools to tackle the problem they are not meant to solve (that is, Git being a full replacement for SVN/SVK/Perforce and handling monorepos).

                                                    1. 3

                                                      I don’t personally think monorepos make a lot of sense, and I think multi-repos are the way to go. If each separate piece is its own project and you let the language’s packaging / dependency management system handle the rest, I don’t see the problem.

                                                      Examples I can think of where my point applies are Python, Ruby, Perl or Java. Unless maybe you’re using a language with no notion of packages and dependencies - C/C++ perhaps? I don’t see the issue.

                                                      1. 8

                                                        The friction in coordinating branches and PRs across multiple repos has been an issue on every team I’ve worked on. Converting to a monorepo has been a massive improvement every time I’ve done it. Either you’ve used hugely different processes or you’ve never tried using a monorepo.

                                                        1. 1

                                                          The friction in coordinating branches and PRs across multiple repos

                                                          That’s a symptom that the project is not split across the correct boundaries. This is not different from the monolith-vs-services issue.

                                                          Amazon is a good example of splitting a complex architecture. Each team runs one or very few services each with their repos. Services have versioned APIs and PRs across teams are not needed.

                                                          1. 1

                                                            If you have a mature enough project such that every repo has a team and every team can stay in its own fiefdom then I imagine you don’t experience these issues as much.

                                                            But even so, the task of establishing and maintaining a coherent split between repos over the lifetime of a project is non-trivial in most cases. The multi-repo paradigm increases the friction of trying new arrangements and therefore any choices will tend to calcify, regardless of how good they are.

                                                            I’m speaking from the perspective of working on small to mid-sized teams, but large engineering organizations (like Amazon, although I don’t know about them specifically) are the ones who seem to gain the most benefit from monorepos. Uber’s recent SubmitQueue paper has a brief discussion of this with references.

                                                          2. 1

                                                            That’s interesting. Every team I’ve ever worked on had its architecture segmented into services such that cross branches and PRs weren’t an issue since each service was kept separate.

                                                          3. 6

                                                            The advantage of a monorepo is that a package can see all the packages depending on it. That means you can test with all users and even fix them in a single atomic commit.

                                                            The alternative in a large organisation is that you have release versions and you have to support/maintain older versions for quite some time because someone is still using them. Users have the integration effort whenever they update. In a monorepo this integration effort can be shifted to developer who changes the interface.

                                                            I don’t see how you could do continuous integration in a larger organization with multiple-repos. Continuous integration makes the company adapt faster (more agile with a lowercase a).

                                                            1. 4

                                                              Even if you use a language that has good (or some) package support, breaking a project into packages is not always easy. Do it too soon, and it will be at the wrong abstraction boundary and get in the way of refactoring, and to correct you’ll have to either loose historic, or deal with importing/exporting, which ain’t fun.

                                                              But if all your packages/components are in a single repo, you’ll still might get the boundaries wrong, but the source control won’t get much in the way of fixing it.

                                                            2. 1

                                                              100% on the surrounding tooling. CI tooling being based around Git means that a lot of it is super inflexible. We’ve ended up splitting repos just to get CI to do what we need it to do, and adding friction in surrounding processes.

                                                              A rethink of the ecosystem would be very interesting

                                                              1. -1

                                                                Came here to CTRL+F perforce, was not disappointed

                                                            1. 2

                                                              This post (on medium.com…..) seems to be the first post of jimjh, the author of the article, immediately after joining lobste.rs (post is 5hrs old, account is 5hrs old), and there has been no other community engagement since.

                                                              Flagged as spam to alert mods.. Maybe it’s time to consider a cool-down period between joining and posting articles?

                                                              1. 17

                                                                On the flip side, I lurked for a year before asking a friend for an invite. They might have some understanding of the community even if they have a new account. Just a thought.

                                                                1. 0

                                                                  Also, it’s a good post (Brent).

                                                              1. 13

                                                                Rust is superb for these cases, where proper memory management is important. Even preventing you from creating accidental data races, unlike runtime languages such as Java or C#.

                                                                I agree that you can’t blame developers for such bugs. The best of the best developers make mistakes, as bigger applications can become super complex when talking about memory.

                                                                I do blame developers for complaining about memory bugs in C(++) programs though, when choosing a language guaranteeing memory safety like Rust was/is a viable option.

                                                                1. 1

                                                                  Was/is it, though? How often do programmers actually get to choose programming languages or tools to a project? From my (limited, sure) experience, not very often.

                                                                  Also, technical merit is not the only parameter in determining the best tool for a job. New languages have a adoption cost, and a maintenance cost (i.e., how hard is it gonna be to hire more people to work with it). This has to be factored in with deadlines, and since times is money, the final decision is pretty much never made by the programmers.

                                                                  So, no, I don’t think it’s valid to blame programmers for “choosing” c/c++ when that decision is so often not made by them. At least it’s not ok without some extra qualifiers or something.

                                                                1. 1

                                                                  Hopefully it can be pre-hooked so that no one can commit with this statement present in the git repo ;)

                                                                  1. 4

                                                                    I don’t think this warrants such extreme measures, but: it probably has it’s own node type when parsed through ast.parse, so, it’s pretty easy to write a script and use as a hook on pre-commit. I wrote one of those to disallow importing a specific lib without aliasing and OS checking in a project, and as long as you only check for changed files, it’s pretty fast, too.

                                                                  1. 6

                                                                    Possible impossibilities aside, I enjoyed this way more than I thought I would.

                                                                    1. 3

                                                                      This is cool, I wasn’t aware of memoryview()!

                                                                      Though I was expecting this to be about using os level zero-copy to avoid copying into Python at all, i.e. os.sendfile(). The below has 0 memory allocations on my laptop:

                                                                      @profile
                                                                      def read_random_sendfile():
                                                                          from os import sendfile
                                                                          with open("data", "rb") as source:
                                                                              with open("/dev/null", "wb") as target:
                                                                                  sent = sendfile(target.fileno(), source.fileno(), 1024, (1024*10000-1024))
                                                                                  print("Sent %d bytes to /dev/null" % sent)
                                                                      

                                                                      I wasn’t able to get it to work with “/dev/urandom” so I had to dump 10M of data to a file called data.

                                                                      1. 1

                                                                        Noice! Didn’t knew about that, gonna check the docs =)

                                                                      1. 5

                                                                        Maybe I’m a bad programmer, but I just can not cope with modules with over a thousand lines. It’s just too daunting,

                                                                        1. 6

                                                                          I have thought about this a lot recently since I picked up writing some Java code in an IDE when I am normally a VIM + Python/etc person.

                                                                          Turns out that (for me) the tooling determines what is more comfortable. WIth Java and an IDE, I have started to pick up using the IDE to do a lot of things for me and I navigate the code by classes and method names (CTRL-click etc). Before I used an IDE, I found most Java codebases insane, now I am writing such a thing for myself :)

                                                                          With a text editor, I did rely much more on ctags and search strings for browsing through the code. In that working mode larger files are nicer to work with actually, because you have everything quickly reachable with the search functionality of the editor.

                                                                          So far my personal observations. I do think that a lot of other devs can relate.

                                                                          1. 2

                                                                            I have started to pick up using the IDE to do a lot of things for me and I navigate the code by classes and method names

                                                                            VIM surely has an extension which will do this for you. I know emacs does.

                                                                            1. 2

                                                                              Exuberant ctags + FZF has worked wonders for me :)

                                                                              1. 1

                                                                                Isn’t there something language-server based?

                                                                        1. 1

                                                                          Short, but interesting.

                                                                          1. 1

                                                                            Python was my first programming language, and one of favourite things about it was its indentation syntax. It’s a great language, but I really wish things like recursion and lambdas were more painless in that language, because this looks like kind of an annoying quirk to keep in mind when writing recursive functions. It’s a bit sad when stuff you have to learn is not about learning interesting ways of expressing new ideas; but rather learning how to steer around the bugs and design mistakes.

                                                                            For me, I find that Parinfer gives that indentation syntax feel to lisps, and without the limitations from Python, e.g. not being able to write (list 'hello (if (world? 'here) 'world 'non-world).

                                                                            1. 2

                                                                              Counter point: I’ve been working with typescript and c# and, while the full flegged lambdas are useful, the kind of atrocities people commit with it make me miss the restricted lambdas from python.

                                                                              1. 1

                                                                                I’m kind of curious what such a lambda atrocity would look like? I’ve dealt with some lambda-heavy JS code, but I think that’s often more like callback hell, which is perhaps something slightly more specific. Do you have any good examples?

                                                                                1. 3

                                                                                  It’s the holidays, so I don’t have any examples at hand. But my main issue is that people go overboard, writing pretty complex expressions inside lambdas inside other lambdas, all of them with one letter parameters that have no sense or consistency, and it’s hell to debug.

                                                                                  When you pair lambdas with chained methods like the collection methods from typescript and c#‘s LINQ, it’s like a perfect storm of unreadable code. Enormous chains of methods, with very complex lambdas inside, stretching for over 150 columns. I find it pretty much impossible to read without breaking it and formatting first, in almost all cases.