10 ms·
You sometimes see people ask fairly simple Python questions on Stack Overflow, that could be solved by five lines of plain Python, and be answered with some Pan
by Pinus 4y ago
You sometimes see people ask fairly simple Python questions on Stack Overflow, that could be solved by five lines of plain Python, and be answered with some Pandas magic incantation that happens to do what they want with one call. I always find this a bit sad, because it seems to take away the idea that programming is about assembling composable parts, replacing it by a search for the right magic thing from a box of ready-made magic things.
(Plain)TeX always seems the opposite of this. There is never a keyword that does what you want, but you can always do it by using five different mechanisms in concert. You always feel like you are trying to trick the system into doing something it was not designed for.
- galoisgirl 4y ago> There is never a keyword that does what you want Clearly you haven't seen https://github.com/mscroggs/realhats https://github.com/mscroggs/realhats
- enriquto 4y ago> You always feel like you are trying to trick the system into doing something it was not designed for. This is one of the hallmarks of human civilization. Your hands were designed for throwing a stone at the eye of a mammoth. But you can play the violin with them! Yes; it is totally awkward and anti-natural for your hands, obviously not their intended purpose... but so beautiful!
- rland 4y agoI see what you're saying, but the violin was designed for human hands.
- netizen-936824 4y agoNothing in nature was necessarily "designed"
- cosmojg 4y agoSculpted like a riverbed.
- politician 4y agoProponents of the anthropic principal disagree. Nevertheless, it's irrelevant to this thread.
- netizen-936824 4y agoNo, its definitely relevant. Hands were not designed with any specific function in mind. There was not evolutionary pressure to "throw rocks at the eye of a mammoth" Did orangutans evolve hands to throw rocks at mammoths? No, they did not The parent comment is making ridiculous claims without evidence https://www.worldatlas.com/articles/what-do-orangutans-eat.html https://www.worldatlas.com/articles/what-do-orangutans-eat.h...
- samatman 4y agoYou've smoothly shot right past solid ground (evolution doesn't design things) to a fairly wild claim (rock-throwing apes didn't experience evolutionary pressure to get better at throwing rocks). Orangutans aren't humans, so what are you saying, apes which don't throw rocks to kill their prey don't... throw rocks to kill their prey?
- netizen-936824 4y agoPerhaps my example is poor, but it shows that hands are not coupled to predation I'm specifically talking about the evolution of hands, humans are not the only organism with hands.
- ohwellhere 4y agoThis seems accurate to me. Like complex brains are evolutionarily fit because they can solve lots of disparate problems, hands are evolutionarily fit because they can do lots of disparate things. Of course, we do also then design violins for our specific dexterity.
- samatman 4y agoThe poster didn't say "hands", they said "your hands". Your human hands, which co-evolved with throwing things, we have abundant paleontological evidence of this and you may read as many papers on the subject as you would care to.
- tomrod 4y agoI'd go so far to say that linguistically nature is the antithesis of artificial (made by hands). Avoiding silly theological tropes, evolution is often mistakenly referred to as a designer when it's just an emergent property of competing, replicating agents. People don't normally bother with precision though, so we are where we are.
- bernulli 4y agoI always like to see it the other way around, it eliminates entities that are not a good fit, and the remainder is what drives adaptation. Of course, people could argue that's just like Michelangelo [1], and we're back at 'designed'. [1] “The sculpture is already complete within the marble block, before I start my work. It is already there, I just have to chisel away the superfluous material.”
- ohwellhere 4y ago> it eliminates entities But evolution doesn't eliminate entities. Low fitness entities are eliminated by hunger, or predators, or lower reproductive rates. The marble on the other hand is eliminated by Michelangelo. There's a linguistic confusion where because evolution is a noun, we think we can treat it as a subject. But in the person/place/thing/idea delineation, it is an idea. Not only does it not design, not only does it not eliminate: "it" doesn't do anything!
- jgwil2 4y ago
- deleted 4y ago[deleted]
- dev_tty01 4y agoIf you consider a "design" to result from a process where someone sketches out a plan, builds it, and it works first time. I've designed a lot of systems, and it is clearly an iterative process. Balancing tradeoffs, figuring out the essentials, build prototypes, test, etc. If you are patient and diligent a solution emerges. That sounds a lot like evolution, so in my mind everything in nature has been designed by the collective intelligence of an iterative process that rewards useful optimizations.
- netizen-936824 4y agoI think that's a reasonable perspective to take, although I would argue that there is no clear goal in evolution besides survival and reproduction
- Jenk 4y agoThere is no plan in evolution. That's the point. It's a reactionary phenomenon. If it had a plan, it would be a proactive phenomenon. Evolution is happenstance.
- rocqua 4y agoThe nice thing about a goal, is that one goal begets other sub-goals. Or rather, a goal begets a strategy, and a strategy begets sub-goals. Beautifully at some point these sub-goals start being optimized for. A few steps of this is how I believe humans went from the sub goal "Survive, eat, reproduce" to "Make art, understand life, explore the world". The cool thing is that I think this extends beyond humans to tools. Because at some point humans had a sub-goal of "hit thing hard" they made a hammer. And this hammer has a goal (or a purpose) which is "hit things hard". This purpose can be traced back, through human sub-goals, to the final goal of evolution: "reproduce". Note that I am not saying that the point of a hammer is to produce more hammer. But the point of a hammer is (very indirectly) to allow a human to reproduce. Interestingly there is a weird game of telephone that can happen, where the sub-goals are imperfect for achieving the final goal. I would argue that this is (part of) why humans can be truly selfless. Take a soldier going to a battle he considers unwinnable but going out of a sense of duty / fear of ridicule. This will not help him reproduce, since the battle is unwinnable it will not help his progeny reproduce either. From the 'ultimate' goal, this is an irrational step. But there are sub-goals at play. Things like "be honorable", "do your duty". This idea that a sub-goal can subvert the 'ultimate' goal is very beautiful to me. It means that evolution is not some tyranny that sets our purpose in life. Instead evolution brought 'purpose' into the world. And then some stochastic process put you and me on into the universe with some, vaguely related, sense of purpose. But we have our own purpose. Sure our purpose was 'created by' the ultimate purpose of evolution. But our purpose is not subordinate to the ultimate purpose of evolution. A human life can have so much more value that just "continue the genetic line and have children". I find that freeing.
- platz 4y ago> This is one of the hallmarks of human civilization. This is one of the hallmarks of evolution. How do you think wings evolved? By repurposing an appendage that was already had a purpose other than flight.
- NegativeLatency 4y agoWe didn’t evolve to play instruments though, we adapted and created them to suit our existing physical form
- izhak 4y agoI would disagree. You can play the violin firstly because the violin was designed so that it could produce beautiful sounds under _human_hands_. This way, not another.
- falcor84 4y agoIt seems you are actually in agreement with the underlying argument. Humans were able to use their body, originally developed for hunting large prey, to design, build and play violins.
- toolsexist 4y ago
- deleted 4y ago[deleted]
- croes 4y agoNope, we use stones because we can lift and throw it with our hands, not the other way around.
- isitmadeofglass 4y agoOur hands were not designed, and they have no “intended purpose”. We have hands because throughout the extremely long line of evolutionary adaptations the individuals that had them ended up surviving and procreating, and so we ended up having them. This is not true of a violin, which is of cause the product of intelligent design and is designed to fit our hands, no Awkwardness intended. Though naturally there are constraints dictated by the physics of the sound generation.
- dragonwriter 4y ago> Your hands were designed for throwing a stone at the eye of a mammoth. No, they weren't designed at all. And utility in fine as well as gross manipulation of the type you describe is clearly part of what they were selected (not designed) for. > But you can play the violin with them Violins, unlike human hands, were designed, and specifically for people with human hands to use. They aren't just something existing outside of humans in nature that hands happen to work with. So, it's not at all surprising that they can be used with human hands.
- MrVandemar 4y agoYes! Plain python is almost always crystal clear and self explanatory. But "idiomatic python" which people seem to compete to be "more idiomatic than thou" is none of these things. It's actually a barrier to learning the language.
- aulin 4y ago> almost always crystal clear and self explanatory and slow. Most of the time the idiomatic pandas answer takes advantage of its vectorization capabilities while plain python would require nested loops.
- bqmjjx0kac 4y agoThis is one of the advantages of languages with optimizing compilers. In Python, there's a tradeoff between clarity and performance. But in C++ for example, your for-loop is just as fast as any library's for-loop. Edit: My assumption is that many Python libraries are written in C for performance, but maybe that's not the case.
- behnamoh 4y agoExcept that your C loop can be WRITTEN slower than some library’s loop.
- kaba0 4y agoIn case of these libraries it is mostly the case of painstaking optimizations in low level code. No common language has sufficiently smart auto-vectorization to reliably convert for loops in most cases to SIMD instructions - so no, your average C++ for loop wouldn’t be that much faster, unless you spend a lot of time optimizing it for the specific task.
- andrepd 4y ago>But in C++ for example, your for-loop is just as fast as any library's for-loop. This is most definitely not true. Even stuff like subtle aliasing guarantees can make code run an order of magnitude faster or slower.
- amelius 4y agoMy main issue with LaTex is that you can't take a perfectly correct piece of markup, insert it into a container like a table, and expect it to work. LaTeX makes it difficult to compose stuff. Even HTML did this better.
- dougmsmith 4y ago
- moffkalast 4y agoNot to mention that when it fails to compile, at least in Overleaf you get an error log that is hopelessly useless and the only thing you can do is just remove your changes until it works again. LaTeX is a cool idea, but the implementation? Absolutely horrid.
- dhosek 4y agoThere are two big challenges: One is that TeX, the underlying executable behind LaTeX, is pushed to its limits¹ to run. The macro expansion paradigm behind LaTeX made sense in 1982 but there are a lot of decisions underlying the executable and TeX-the-language that were dictated by the computing technology of the 1970s (forget Unicode, standard ASCII wasn’t universally available when Knuth wrote TeX). The other problem was the questionable decision by the LaTeX core team to, rather than release LaTeX3, they instead decided to evolve LaTeX2e which means that they are encumbered by backwards compatibility issues. The noisy output from LaTeX is also not so great. One of the things I’m doing with finl is (a) assuming that there won’t be an attempt to fix errors mid-run (one of those 1982-era decisions that no longer makes sense) so a comprehensive list of errors can be presented to the user (or revealed programmatically) and (2) Adding indications in the output (which can be disabled) of errors in the input. I’m debating between errors being PDF annotations so users would click on an error or warning icon in the PDF to see the message and indication of where the issue was found, or just making it a big blot of overprinting (so many times on tex.stackexchange there are so many issues where a user—usually on Overleaf—ignored the error messages being output. ⸻ 1. Actually beyond its limits. LaTeX will no longer run on a Knuth TeX executable but requires eTeX extensions to run.
- pif 4y ago> I always find this a bit sad, because it seems to take away the idea that programming is about assembling composable parts [OT] Concerning "programming is about assembling composable parts": I always find both sad and ridiculous when self-proclaimed software developers bash Unix because they are not able to appreciate its philosophy.
- kaba0 4y agoIt would help Unix’s case if the glue between the parts wouldn’t be byte streams and some very crude int result code, signals, etc. A monolith can be just as composable if not more, with a much “stronger glue” in the form of language-mandated guarantees. Also, sometimes doing multiple things well is the better direction — IPC is additional complexity and essential complexity can’t be decomposed.
- TheDesolate0 4y agoIn Unix space we use text, almost exclusively. This byte stream thing is a windows/java bs thing.
- tga_d 4y agoWhen contributing to uutils (the coreutils written in Rust), one of the bigger pain points with cross platform support is the way that in Unix, everything, including arguments, is just bytes, while on Windows, arguments are semi-opaque text strings. E.g., the -t option in sort, join, etc. takes an arbitrary byte (other than null, which is supported via \0), so you can sort, join, etc. binary inputs. However, the -t option will not let you use a multi-byte character, even valid Unicode characters like é, which, if Unix actually used text for everything, you would expect it to. Meanwhile, on Windows, uutils still doesn't support non-ASCII byte values for -t, because Windows doesn't provide a way to represent those.
- bee_rider 4y agoUnix has gotten pretty far using just text and return codes. But there's no need to be dogmatic about it I guess, it could be nice to pass objects around, rather than text, like Powershell does. Although, their implementation seems quite verbose. I think to really use something like that, I'd want a well-defined ordering for the fields and the ability to also do something like variable.1 in addition to variable.someLongFieldName This could result in less than obvious scripts, but a shell language also needs to be compact, for interactive usage.
- deleted 4y ago[deleted]