« first day (3415 days earlier)      last day (1532 days later) » 
04:00 - 19:0019:00 - 23:00

7:09 PM
When it comes to dealing with jsons/xmls parsing, is it better to use for loops or recursive functions? (Speaking in the general case of course)
 
@CeliusStingher neither. Use a parser library.
 
with python loops are always preferred I think on a fundamental level, right?
 
in general yes. Except when it isn't.
 
I interpret this question as "when building a house, is it better to use a hammer or a saw?"
 
ps. yes, i enjoyed writing that statement a bit too much.
sometimes, recursive functions are suited for the task, and iterative approaches just arent. If that's the case, use recursive functions. It's a tool, just like any other.
Textbook example: trees and branching.
more concrete implementation: i'd like to have a word with a guy who managed to implement regex parsers with iteration. if they exist. and are still alive by the time they finish completing an implementation.
ps. exaggaration. maybe. Im not sure actually. Did anyone implement an iterative regex parser? I can't even imagine such a thing. Oh look, is that Tony?
 
7:23 PM
There are also iterative solutions to tree traversal, usually using a deque of children to visit instead of using the call stack with recursion. Python function calls tend to be pretty slow, so if you have a performance-critical section that needs to do tree traversal, you will probably invest in converting a recursive solution to an iterative one.
 
7:49 PM
@ParitoshSingh Depends on what you mean by "regex parsers with iteration". Thompson's Contruction Algorithm is a recursive algorithm that turns a regex pattern into a deterministic finite automaton. You can then iteratively feed a string into that DFA to determine whether it matches the regex pattern.
 
That's pretty nifty, though not quite what i meant.
I'd imagine no recursion involved in any step if i had to call it an iterative implementation of a regex library.
 
Things get a little fuzzy at the edges because any recursive algorithm can be turned into an iterative one, and this arguably happens every time you compile a program into machine code or any other form that doesn't formalize the concept of "recursion"
 
amused smile Kevin, you're genius, you know that, right?
That would be quite a bad headache inducing fact to think about every time someone mentions recursion to me from now on.
 
Perhaps you can formalize it as "a process has recursed if its call stack ever contains the same address in two different places at the same time" but I have a bad feeling that the majority of program languages will have some boilerplate setup code that disqualifies it from counting as non-recursive
 
I think it would be good to perhaps clarify that if it's being called recursive, something that, in the constructs of the language you're working with is enabling recursion, while it's implementation may optimize away to iteration, still counts as recursive. More so than anything, the way i'd see that as being fair is because these constructs in the language allow us to build and work on logic in a manner that we might not be able to write directly in the optimized format, simply too complex.
Though, at that point, Im now seriously wondering whether we could truly rule out someone actually writing it all like that or not. Perhaps no recursion, or iteration needed for that matter. It's all jump statements anyways.
(at least, that's my limited understanding of how the underlying logic to loops and branches actually work. some kind of jump to memory locations)
 
8:07 PM
@Kevin that won't work reliably with TCO.
 
Tangent: I tried to determine whether regular expressions appeared in computer science before or after recursion did. Recursion as a mathematical concept has existed for hundreds of years, but didn't appear in programming languages* until Algol 60 in 1960. Regexes originated in 1951, but didn't enter popular use until 1968.
(*Confidence rating: low. en.wikipedia.org/wiki/Recursion_(computer_science) has no History section, and Google just gives me a lot of Alan Turing quotes about mathematical recursion. Basically I'm going off an anecdote I remember from a lecture in college, and this article)
(Ah, now that I read more closely the article itself refutes me. Lisp had recursion, and it was published in 1958. In any case, suffice to say that recursion existed prior to regex's popularization in 1968.)
@MisterMiyagi Hmm, true. Fuzzier and fuzzier.
 
@Dodge how's that (what?) a humble brag? I wanna do a fun activity with my friends
 
@ParitoshSingh Yep, that's how loops and branches work. You can watch the sausage get made with the dis module. dis.dis("for i in range(10): print(i)") displays, among other things, a JUMP_ABSOLUTE instruction. dis.dis("if i: print(i)") has POP_JUMP_IF_FALSE.
 
8:22 PM
good to know that python is basically assembly
 
@Kevin Just finished reading through that article, it was an absolute treat, and surprisingly almost scandalous. Who would have thought.
 
There's probably a second jump hidden inside the for loop's bytecode as well, since otherwise there's no way to get to the instruction below the JUMP_ABSOLUTE at the end of the loop body
 
@inspectorG4dget humble brag. grins wide ps. don't worry, it's a tongue in cheek remark. Though now i wish i was in the area, i've never tried skiing before.
 
@inspectorG4dget I was kidding (when people subtly mention they are doing fun things we call that a humble brag), translate my comment to: "that sound's like a lot of fun, I'm jealous, hope you have a good time!"
 
user11867329
Im using Google Cloud (Vision) to extract all readable text from PDFs and associate it with the proper label.

When creating the dataset, it's asking to import file(either image or csv) to start up the dataset.
 
user11867329
8:27 PM
I'm basically sending an invoice through Vision to extract all text (works with no issue)

but what am I supposed to do about the dataset
 
@Dodge ahh! oops! I thought I was inadvertently offensive which was not at all what I intended
 
@ParitoshSingh I hope this is not a completely ignorant question, but does it tend to snow where you live?
 
user11867329
a fair amount of the information will be unique (E.g. the phone number of contact person)
 
@ParitoshSingh you should totally come. If you're anywhere along my route, I can pick you up
 
@AndrasDeak Nah, There's only very few regions in India where it snows, and it's not really close.
 
8:28 PM
OK, that was my vague impression, thanks
ah, yeah, you're 200 m above sea level
 
Only in northern states of india...
 
@inspectorG4dget haha, you'd have to be travelling on flight and be doing some kind of fancy maneuver to pick me up on the way Im afraid. :P bit far out
Would be a pretty long detour in any case. :P
 
wim
should we downvote answers that were right, but are outdated?
assume there is no point to edit the answer because it will just make it same as some other answer
 
No imo. we should cry about not having good enough tools to work with depreciated or outdated information :(
 
@ParitoshSingh I wonder if the SkyHook thing they used in The Dark Knight actually works
 
8:31 PM
Im perfectly happy to give it a shot ;)
 
@wim header perhaps to signal obsoleteness? Assuming it's something egregious these days.
 
@wim whats the point of downvoting if that answer helped someone in on or the other way
 
@Codewizard because it's not about helping, it's about letting good information rise to the top and bad ones sink
 
@Codewizard flip it upside down, look at the goal. What's the point of having an answer on top that's wrong now.
I wouldn't want to read an answer when im searching through stuff only to find out i was misled by outdated information
 
@wim I'm in two minds about that. I think edited answers to highlight their applicability and/or retagging/editing questions to specify this is probably a good way to go. The answer instructing how to use a cassette player as a persistent memory device may be outdated...but it's still the answer I need to get that old MSX machine in my dad's shed working again, whereas it doesn't help me add an SSD to my current laptop..
 
8:34 PM
@wim I would not. Answerers can't foresee the future. I'd rather leave a comment and upvote/write a better answer.
 
Sometimes people think they have been helped, when they've actually been hurt. I saw an article about two pieces of software that freeze if they're run at the same time because both development teams copy-pasted a piece of code from Stack Overflow, and the code incorrectly acquires a resource that only one process can use at a time.
 
@Kevin You're talking about the recent .Net debacle?
 
There's a distinction, fine though it may be, between obsolete/depreciated and bad/unsafe, and I believe it's very context specific.
 
.Net may have been involved, yes
 
@AndrasDeak and @ParitoshSingh he claimed that the answer was right so whats the point their to re edit who know others get the chance to think more creative by going through that ans
 
wim
8:37 PM
@AndrasDeak this is my feeling too, but not everybody takes it that way (downvote is on content, not user)
 
@Codewizard yyyeah, "inspired by" is another non-goal of votes on SO, sorry
@wim I can see both downvoting and not downvoting, but "it used to help people" is irrelevant
 
wim
ideally users receiving a downvote on an ancient answer should check the answer to see if it needs to be edited or deleted
 
it's probably only an issue when there are a lot of votes on the stale answer, but in that case there's no realistic chance for it to sink...people never downvote
@wim that could be an argument...if there were notifications for downvotes. There aren't.
 
@wim a comment would suffice to that effect too
 
wim
comment don't help the current answers bubble to the top , though
 
8:40 PM
@AndrasDeak There is a notification on lost points for downvotes.
 
wim
@AndrasDeak I see them, in reputation tab
 
Indeed. Im with you there that there's an issue. Im not with you that downvoting is the answer.
@Codewizard Depending on your "Strictness" of right or wrong, "outdated" can imply wrong, or more roundabout than it needs to be in any case.
 
@wim That's true, but few up/down votes don't change that either. Often enough, slimming the accepted post and seeing some "outdated, use <post below> instead" comment was a much better spotlight.
 
@wim which most people never check, especially not users who are sporadically active
 
Not to mention, if we start group downvoting as the "fix", we're essentially vote mongering, i doubt the votes were ever intended to be used that way, and probably would break some kind of rule on voting anyways
 
wim
8:44 PM
I dunno, I think votes were intended to be used that way.. and users are too timid with them
 
@ParitoshSingh yes, I'm on record for not tolerating that. Whether or not answers in such a situation should be downvoted, without a link to any post, is another matter.
 
Come to Shadow Stack Overflow, where there are no rules
Your invite will be delivered by raven to the nearest crossroads at midnight
 
@ParitoshSingh Votes are de-facto intended for that, as they directly influence answer ordering.
 
except accepts (except self-accepts) :|
 
wim
I am in downtown Chicago - there are always 4 nearest crossroads
 
8:45 PM
@ParitoshSingh i think that there is also no point in upvoting unnecessary but ya if it needs some changes surely it should be improved
 
@wim tricky. I mean, i can see why since votes are our only tool for managing the order of answers, but at the same time, there's something really wrong about eating downvotes for an answer that was spot on correct for it's time.
 
The raven will use sophisticated logical reasoning to determine the optimal crossroad
 
wim
also no ravens, can you send a dirty pigeon instead
 
The ravens have a very strong union but I'll see what I can do
 
it would be a shame to have a nice raven get shot
 
8:47 PM
@wim What do you think should be done with that how to display a float question that I have a rising answer for? %, "python 3's .format and my f-string answer are the top 3, in that order.
 
@MisterMiyagi I guess if i had to really think through with this and actually convert my train(wreck) of thought into words, votes signal good and bad answers, but don't do a sufficiently good job of signaling outdated but good answers. If we then keep sticking by the metric that votes allow us to use, we're essentially using the wrong tool for the job. Like trying to build a house using chainsaws or something?
 
@Kevin Will this be a Craven or a Pyraven?
 
@toonarmycaptain haven't we discussed that already here?
 
I think he mostly works in JS nowadays
 
wim
@AndrasDeak yes after the last tragedy, they said nevermore
 
8:49 PM
@ParitoshSingh We're living in a world of chainsaws, I'm afraid.
 
And that sadly, i can't really disagree with.
 
@AndrasDeak Yes. But it's one of those questions. Arguably some of the answers are outdated, in the absence of specific concerns, but they're still functional and useful solutions.
 
wim
@toonarmycaptain looks ok to me
 
And moreover some people simply copy over the chap for goining upvoted which i think makes no point at all
 
wim
the top 3 answers are what I expect the top 3 answers should be (modulo ordering)
it has "long tail of crap" problem, but at least the good stuff is at the top
btw I don't really consider %-formatting outdated, it's still a feature of Python and there is not really reason to go and exterminate it. The post that made me ask this in chat was concerning a restriction in Python which was removed recently in 3.8
 
8:55 PM
But the correct answer had less upvotes than the second one lmao
 
@Codewizard "correct"
 
If you're going to golf, at least be civil and make it pep8.
 
wim
> If you actually want to change the number itself instead of only displaying it differently use format()
lol wat (from here)
 
% is more frequently used in c nowadays.. I saw in quite many
 
mhmm
 
9:08 PM
@wim That was kinda my point, what is the 'best' or should be the most upvoted answer can be somewhat subjective. If a restriction has been removed, it seems to be that the workaround or info pointing out the restriction should be useful (and prominent) for awhile, but the new 3.8 solution should also be prominent. Just highlighting what context/versions an answer is applicable to goes a long way.
anyways, rhubarb all
 
10:01 PM
Person 1: "I'm looking to teach someone!"
Person 2: "I wanna learn! What’s your teaching methodology?"
Person 1: "Can you please explain what you mean by this?"
I have a feeling this won't end well
 
10:28 PM
@Aran-Fey Can you please explain what you mean by this?
 
[not sure if srs.jpg]
 
[not sure if srs.jpg]
This is weird in a very meta way. ^^
 
lol, yeah, guess it's too late for me
 
yeah, pretty much that. It seems like Person 1 hasn't thought about how they're gonna do this
 
@AndrasDeak same here. ;)
 
10:33 PM
I claim the excuse of "one night's sleep distributed over two nights"
 
thankfully, I can't compete with that
 
good thing it's the weekend now, eh?
 
yeah, and I can go to bed early...uh...or something
 
still earlier than usual :P
 
last night I was working on a PR and right now I'm writing an issue on github... turning my heroin into Narcan I guess
 
04:00 - 19:0019:00 - 23:00

« first day (3415 days earlier)      last day (1532 days later) »