« first day (3512 days earlier)      last day (1436 days later) » 
00:00 - 17:0017:00 - 00:00

5:00 PM
and note that one should never compare numbers with is, only with ==
 
so really you should just do str_list = [adjust(string) for string in str_list]
 
@AndrasDeak Oh. That's new. Any particular reason?
 
yes, there's no guarantee that numbers are singletons
 
@Aran-Fey Is that what they call list comprehension?
 
>>> x = 300 + 1

>>> y = 301

>>> x is y
False
 
5:01 PM
@d4rk4ng31 yep
 
@d4rk4ng31 you just have to make sure that adjust returns the original string if the length != 16
 
*deletes half-finished objection*
 
@AndrasDeak Oh! why does that happen? Please bear with me, I'm a newbie
 
The question is why shouldn't that happen? is compares objects for identity. You can have to Potato() objects without them being identical.
you should only use is when you are looking for exact identity, which is typically against None or some specific pre-existing object you're looking for (you won't need this latter case for a long time)
until you're less of a newbie you can be sure that val is None and val is not None is the only case you have to use is for such a comparison.
 
So, can one say that is is like === in js?
 
5:04 PM
I don't know JS, so I can't answer that
 
I've recently realized that I've been using is too much. It really has very very little use outside of comparing to None, True, False and a handful of other builtin singletons
 
if your going to use a list comprehension you should just use the left adjust function: whatever_string.ljust(16)
 
Uh, well `===` checks for value and type, whereas `==` only checks for value. So, in JS,

string 123 and int 123 are `==` but not `===`
 
@d4rk4ng31 so answering your question: x and y are both equal to 301 but they are different instances of the int class
@d4rk4ng31 it's a bit different from that, exactly because python is strongly typed.
 
hey if i place Matplotlib images on a Tkinter GUI will that solve my 40 windows opening issue?
 
5:06 PM
@d4rk4ng31 is does not check for value and type, it checks for identity. It's different
 
@LinkBerest the SQL tags are a burning garbage heap when it comes to Injection. It would be funny if there wasn't that bit in the back of your brain reminding you that some of these people are likely to be handling your info
 
== calls __eq__ on your objects, but is will only give you True if the two operands are exactly the same object.
 
or .ljust(16)[:16] if you want it to truncate
 
So,
ivar = 2
ivar2 = ivar

In this code, ivar and ivar2 are `is` equal and `==` equal too right?
 
yes, but the former almost always implies the latter
 
5:08 PM
But, in
ivar = 2
ivar2 = 2
ivar and ivar2 are not is equal but only `==` equal
Do I have it right?
 
I have a list of classes that I want to pass to only detect those classes that are mentioned in the list. The list for example is ['item1', 'item2', 'item3'] using tensorflow object detection api, how do I achieve that?
 
@d4rk4ng31 in cpython they will also be identical, but that's an implementation detail
so yeah, they are only guaranteed to be equal ("==") by the language specification
@AshwinPhadke are we talking about classes as in python class, or class as in classification class?
probably the latter, otherwise the question makes no sense
 
Got it. Thanks a lot :)
Just, one last question, In the former piece of code, both ivar and ivar2 point to the same identity right?
 
@AndrasDeak classification class, like a name of each object so there are multiple names so instead of calling them object names they are called classes but they are actually names like mentioned in that list.
 
no
 
5:11 PM
@d4rk4ng31 to the same object, you mean
 
@AndrasDeak Uh, difference? as in object vs identity?
 
in case you haven't been pointed to it yet, here's how names work in python
do you mean that they have the same id?
 
@AndrasDeak Yeah
 
How do you efficiently go backwards through a string searching for a character, stopping at the first instance of it, and return everything after that character?
 
What was your implementation?
 
5:13 PM
@d4rk4ng31 Then yes, a given object has a specific id in its lifetime. But id can confuse you very easily due to memory reuse. I suggest that you forget about id and concentrate on is.
 
@AndrasDeak You pointed me out to that article long back. It really helped me.
 
@JohnnyApplesauce look at str.rindex
 
I'd say that identity is a thing you can have, but not something you can "point to". And the "object" is the thing that has the "identity". Something along those lines
i.e. "identity" is a feature of something else, it can't be by itself
 
@Aran-Fey So, You are the object and Aran is your name, something like that right?😅
 
in case of id() it's probably more "ID", less "identity"
 
5:15 PM
@roganjosh I used to have one test for new DBA interns (& it was one of 3 for backend ones) which was basically "insert something into a database & select it out with a where clause". You only passed if you used preparestatements or an ORM correctly: I remember the failure rate on that was 7/10 :[
 
@d4rk4ng31 yeah, something like that
 
Ah.... Thanks.
 
@LinkBerest and they were beaten to within an inch of their life before they were released into the wild, right? :P
 
@JohnnyApplesauce somethinh like string[: : -1] maybe and check for that character
 
@AshwinPhadke no
they said "efficiently"
 
5:17 PM
@AndrasDeak okay
 
@JohnnyApplesauce might actually need rpartition or rsplit rather than rindex
 
Surely creating two substrings with rsplit is slower than creating just one with rfind and slicing?
 
I have no idea, string methods can be surprising
like split with maxsplit=1 being faster than partition, or something like that
 
@roganjosh with a clue bat!!
 
Yeah, I just realized that I have no idea what the time complexity of slicing a string is
 
5:20 PM
@AndrasDeak if he splits then it will return a list then he'll have to go through it find it and then go back to string and print, I guess that will be more time consuming.
 
@AshwinPhadke s.rsplit(char_to_find, 1)[-1]
whereas you're suggesting something like s[::-1][:s[::-1].index(char_to_find)][::-1]
OK we could spare one slicing if we do some arithmetic
 
@AndrasDeak geez, that's a simple way then what I was suggesting. I guess I know very little about slicing lol.
 
That worked, Andras
Second (and last) part
How turn a list into a dictionary of how many times non-unique objects appeared in the original list?
 
@AndrasDeak I'd go for .rpartition there though instead of limiting split to 1
 
@JohnnyApplesauce google for "python counter"
@JonClements I did say they need either of those, or even rindex. The actual code I posted was directed at Ashwin.
don't have time right now to micro-optimize it
 
5:25 PM
rpartition from what I recall is roughly 60% of the time it takes rsplit with a max size of 1
 
Umm, speaking of list comprehensions, how do we convert
wordList = list()
for line in fhandle:
	for word in line.split():
		wordList.append(word)
to list comprehension?
 
Counter({'jpg': 787, 'json': 2})
Excellent, thanks
 
just... write it all in a single line, pretty much
ok, never mind, you write it backwards
wordList = [word for line in fhandle for word in line.split()]
 
wordList = [for word in (for line in fhandle)]
This is what I tried
Oh okay. Thanks
 
@JonClements how goes the database respawning?
 
5:30 PM
all fixed
 
necromancy!
 
after way too much time on it
invoice sent though and should be paid tomorrow - so always a plus
 
@JonClements Yey! Not as long as I'd mentally penciled in
 
hey... I'm Star Trek's "Scotty" - not when it comes to Warp Engines or anything, but some others bits I'm reasonable enough with
 
"Two weeks, captain" "You have five hours." "Done."
 
5:33 PM
just hoping to definitely not have to repeat that kind of thing again
 
On that theme, I thought Pulling apart a £339 anti-5G USB stick would boil my blood but it is so ridiculous in the claims, I reckon they could make a Futurama episode from it. I can even imagine the voice for the responses
 
With that timeframe, they didn't mess up your backups or replicas too much I take it
 
@roganjosh sounds like stupidity tax
 
@LinkBerest replicas they did, the hot/warm backups were already affected so it was a chore... but I'm trying to forget about it right now :p
 
"we don't know why you allocated all this server space for backups"....famous last words before something goes wrong
 
5:37 PM
@AndrasDeak <cough> It's a "wearable holographic nano-layer catalyser", actually
 
@roganjosh well, everyone knows that 5G is responsible for this pandemic and that Stephen King foresaw it in his novel "The Cell", right? sheesh :p
 
nah, it was the Simpsons
 
Mind you - very confusing... if you read the book "The Cell" and then watch the film... like most King things - you're left wondering if whoever did the film actually bothered basing it on the book of the same title
 
at least those pesky Langoliers are sort of accurate
 
I get the output as [{'id': 1, 'name': 'person'}, {'id': 1, 'name': 'person'}, {'id': 1, 'name': 'person'}, {'id': 1, 'name': 'person'}, after running this for getting classes [category_index.get(i) for i in classes[0]. Now I need to figure out how to pass only the classes I want to get them.
 
5:45 PM
I don't follow that at all
Where do the dictionaries come from in your list comp?
 
one of my favourite King books was "The Stand" (which ironically was based around a flu virus destroying most of the species and led to a conflict between good and evil and all that) - lent my copy to someone ages ago and never had it back - but oh well... once the 2nd hand bookshops are back open
 
@AshwinPhadke Please give an MCVE. I'm not sure why you're taking just the first index with classes[0] or why category_index.get(i) is giving a dict. There's too many unknowns in that
 
the biggest one being the desired output
 
life is full of mysteries
 
Yeah I'll see for an MCVE , it is divided into a lot of files in the library,even I'm trying to figure stuff out.
 
5:51 PM
@JonClements my wife loves The Stand (both book & series) and is very excited about the new version coming out soon
 
@AshwinPhadke It's kind of a requirement if you want complete strangers than know nothing of your problem to be helpful and constructive. If you can't isolate the problem, we're going to struggle even more
 
understood.
 
@LinkBerest the miniseries (or whatever they call it) was not too bad - is the new one a film or a new miniseries?
 
strptime format '%-m/%-d/%Y %-H:%-M'
 
(should probably follow these things a bit closer but)
 
5:59 PM
5/9/2020 6:03
how do i parse this date?
adding -d -m throws bad directive error
 
don't use the -s ?
looks like %m/%d/%Y %H:%M to me
 
The Stand will be a new miniseries on CBS it seems
 
@LinkBerest oh wow... I can totally see Whoopi as Mother Abigail...
 
I asked my wife and she got all exited about Whoopi then had to go online and is now streaming the original mini-series :p :)
 
@JonClements sorry had a different error :D
cbg folks
 
6:03 PM
and Skarsgard as Flagg... oh yes...
 
She started reading the book when all this started but said it was "too real" and moved to "The Dark Tower" (Gunslinger)
 
yeah... got all of those... have you/she seen the film though... I have to admit to being disappointed by it
got 'em all as audiobooks and been listening to a bit each night of the 7th one
 
Yeah, I liked the guy who played Roland but it was just meh (not bad, not great)
 
if you'd never read the books, it was an "okay" action/horror film or something but meh
 
I did recently watch Amazon's series based off of "Electric Sheep" (called Electric Dreams) and was actually pleasantly surprised by that series
 
6:14 PM
@AnttiHaapala Rather than linking directly to that xkcd, you could link to bobby-tables.com
Do electric sheep dream of electric fields?
 
There was a lot of variance but the episode "Real Life" felt absolutely like something Dick would write
 
Err.. does the question about shortening the code belong to stackoverflow or does it belong to codereview?
 
if its working code that you want people to review = codereview
 
Well, it works fully, but I still could use help shortening it
 
in a nutshell, but make sure you read their tour before posting
 
6:21 PM
@d4rk4ng31 That's what they just addressed
Check the guidelines for the site before posting, though
 
AFAIK CodeReview is for full-blown programs. If your question has a smaller scope, like "How do I do X? I can do it with these 10 lines of code, but is there a better way?", it most likely belongs on SO
(in that case the question is really "how do I do X?" and not "how do I improve this code?")
 
@Aran-Fey Oh thanks
@Aran-Fey Well, its only about asking for better and shorter ways to do X. So CR I guess :)
 
Hi Does anyone know anything about function extrapolation in python?
 
Something like this you mean?
 
yes precisely
except I have a bit of a custom request
I want to extrapolate linearly when I go out of the domain on the right side, and extrapolate flat when I go out of the domain on the left side
I'm very puzzled how to make it happen
 
6:29 PM
I don't understand...
<a href="javascript://" class="popupctrl" id="yui-gen11">Page 1 of 5</a>
pagecount = tree.xpath('//a[@class="popupctrl"]/text()') retrieves it but not by itself, but my main concern is...
pagecount = tree.xpath('//a[@id="yui-gen11"]/text()')
doesn't work...it returns an empty list
 
@CharlieShuffler Is this a python problem or a javascript one?
 
Ok, so what is "left" and "right"? Are you referring just to an array or some display?
 
uhm, as an example
given a function f(x)=x^2
with x an input array of like np.linspace(-1,1,100)
I then want to build an extrapolator that returns "1" if I were to fill in a value of -2
 
uhm, who was derivative?
 
6:32 PM
but extrapolate linearly if I fill in 2
so -2 is on the left side, 2 is on the right side
 
@CharlieShuffler yep, got it
 
does that make sense
ok
nice
 
@JossieCalderon is this using the builtin xml or lxml?
 
@CharlieShuffler I don't think there's some fancy way of solving this tbh. To the best of my knowledge it'll take if checks
 
@JonClements I used from lxml import html
 
6:34 PM
@roganjosh I think so too, thanks anyway
 
@JossieCalderon seems fine to me:
    import lxml.html
    s = """<a href="javascript://" class="popupctrl" id="yui-gen11">Page 1 of 5</a>"""
    doc = lxml.html.fromstring(s)
    doc.xpath('//a[@id="yui-gen11"]/text()')
    # ['Page 1 of 5']
 
@AndrasDeak "Correctly"...What about when it comes to debugging?
I could write the ugliest code and it works, but it doesn't mean it works "correctly". No true scotsman
@JonClements It doesn't work for me...I'll just use the workaround by searching the class attribute
 
up to you... seems what you think you have might not be what you have... if you literally just copy/paste the code above - what do you get?
 
@JossieCalderon In which case, what do you mean by "works"?
 
remember though that IDs only need to be unique and can also mean nothing - YUI can just generate 'em for whatever - as long as the element is unique
 
6:46 PM
@JonClements []
Oh
wait
 
If I had a machine that was supposed to pack bags into boxes but it instead threw them on the floor repeatedly, I wouldn't say that "works". It runs but it doesn't work. (That's a common real-life issue in a factory btw)
 
@JonClements I got the right output
 
If the output is right, then it works correctly, doesn't it?
 
This feels like a "This is Fine" moment
 
Depends on whether the room is supposed to be on fire.
 
7:01 PM
It's not in the rules, but I think it's reasonably accepted that arson is not acceptable in the room
 
@roganjosh uh, yeah it is?
It's literally the first rule...'Be Nice.' No flaming.
 
@LinkBerest FWIW, the chat rooms one-box that cartoon if you type "this is fine" in a message by itself. You can test it in the Sandbox room.
 
Sure. It's in the room rules. Arson would necessitate flaming and that's not ok.
 
I've come up with a script to detect the most commonly used words in any webpage
 
I bet it's "class"
 
7:05 PM
That's the most commonly used word in a tree ;)
Fine, most commonly used words in any class='content/postcontent'
 
heh, I didn't want to like to it directly and start a meme fest
 
Me neither
 
in a website? its "a" or "p" (unless you remember to add stop words)
 
@LinkBerest the, a, to (in that order)
 
or its someone who uses br incorrectly
 
7:09 PM
e is the verified to be most commonly used vowel
 
I think Jossie's just talking about the text content of the displayed page, not the raw HTML.
 
I figured that out (its always "a" though): I used to use a classifier which looked for "br" occurances over 5 because it was a good (quick) way of seeing which old webpages needed to be updated - luckily this is rarely needed anymore
.....now I look for "table"
why do people insist on using online repls for things that need real computational power then complain about the speed?
 
it's a general trend, as far as I can tell. people will use the most convenient thing, not the most appropriate.
4
which is often the same, until it isn't anymore.
 
lol
 
"If the output is right, then it works correctly, doesn't it?"
 
7:15 PM
Convenient? Maybe. OTOH, repl.it isn't exactly convenient if your on a phone: it's almost unusable, IMHO.
 
@JossieCalderon There is only correct and not correct. Anything else, we're looking at other criteria than "correct".
 
On a totally different note...
There's a current proposal on MSE to make it more obvious when a question is self-answered: Make it clearer that a question is self answered. From the downvotes, it doesn't appear to be popular, but I think the idea has some merit. Disclosure: I wrote an answer to that question, but I'm not fishing for votes.
 
I hate downvotes...like why is that even downvoted...
 
People downvote questions on meta sites because they disagree, not just because they think the question is bad. On most meta sites, it's not an issue, because it doesn't affect your rep. However, on MSE it does affect your rep. So posting questions there is a very risky business.
 
@PM2Ring The reasoning of the OP took my by surprise. The opposite of what I expected.
 
7:23 PM
hmm...is that about Captain Canada's question. I'm of two-minds - I would like a small banner (like the locked banner) but the OP's wording and reasoning is .... a bit hard to follow
 
Wouldn't it make you mad if people disagreed that 2+2 = 4?
 
I think it's worth noting that things don't necessarily work like the Python tag across the network. At least in my case, I think it jades my opinion
 
2+2 = fish
 
There's no such thing as a fish
 
@JossieCalderon That's operator overloading for you.
After reading some more into that MSE thread, the reasoning of the OP seems really off. That example Q "from bad to good" linked would still have been close-voted if it were in my feed.
 
7:30 PM
 
7:55 PM
@LinkBerest IMHO, a banner like the locked post banner is probably too distracting. I think a self-answered indicator should be a minor thing, similar in impact to the blue bounty score box. It's mostly for the benefit of regulars who may otherwise downvote, or close it as a dupe. And of course, if a self-answered question or its answer are bad they should be subject to the usual closure & downvoting processes.
 
I game for anything that helps people understand why their question was closed as a dupe, how that actually helps improving searching, and helps us keep dupe targets up-to-date: so people can stop complaining about it
I don't hold out much hope for such a thing but I'm game
 
How do I make a header clickable (i.e., a hyperlink) in Dash?
dcc_html.H3(url) displays the link but not clickable.
Docs aren't helping again...dash.plotly.com/dash-html-components/h3
 
html.A()
 
Nice thanks
 
Mar 1 '18 at 18:51, by Andras Deak
@Mierzen I tried looking at plotly once for a question on SO, it seemed to me that their documentation was accidentally replaced by PR Division Weekly Newsletter
 
8:09 PM
The HTML term for that is an anchor
 
Now I know!
 
I say that because there are two types of hyperlinks (well...two main ones): html.link is the first which is how you link to a sytlesheet (CSS) or external javascript library or somesuch. Whereas anchors (html.a) are the typical "clickable" version.
 
Alright
 
@AndrasDeak yeah, their community is pretty good though (or it was as of last year, been a bit since I used plotly)
 
I just wish I could find information on dash.Dash(...)
 
8:14 PM
Now I just have a bunch of d3.js frameworks (flask templates) I load for drill-down dashboards
 
@LinkBerest that's good to hear. It's always sad when a community has to make up for what the official sources won't provide
 
sad: yes; uncommon: no
granted I think flask documentation is some of the best I've found but then have people I work with who think it is the worst so there's always a bit of subjectivity
 
"good"/"bad" is subjective. "Missing or impossible to find" is another ballpark.
 
Tell that to pandas.Series(numeric_only). Broken as an athlete's knee.
 
8:18 PM
@JossieCalderon fyi - that community link I gave shows how to use an anchor with a header (H1)
 
@LinkBerest Haha, yeah. I got it.
 
@AndrasDeak true, plotly was why I excited about the whole SO Docs thing before it turned into something which was just as messy
which is the polite way of saying a flaming garbage pile
 
Whatever happened to SO Docs? Is it still a thing?
 
Good. I stopped using SO for about 3 years, and I left just as they were hyping it up.
 
8:32 PM
it was the first red flag, nay, red tsunami after I started
they just kept going in the face of overwhelming feedback that it was fundamentally broken, and how it should be changed and clarified
anyway there's a third-party mirror of the stack overflow documentation data dump here riptutorial.com
 
I'm not going to start down that dark tunnel again
 
8:52 PM
Anyone here who can help with Tensorflow. Like what models can with datetime?
 
9:07 PM
Removing various \r\n\t's from list?
numOfPages = [''.join(item.split()) for item in numOfPages]
:)
 
 
1 hour later…
10:22 PM
Greetings, I didn't see a separate chat for Pygame. Cool to discuss pygame here?
I have a stupid question. I used a background image larger than my screen, hoping I could it would let the player explore the entire background.
Do I accomplish this by "scrolling background" or by "camera"
 
10:51 PM
When will stack overflow make sicko mode? Im already bored of dark mode
 
@User__1 sicko mode?
 
11:16 PM
I'm waiting for semicolon mode.
 
user11006952
@roganjosh Based on the term "sicko" One where colors are psychedelic. A lot of awful gradients and top answers are in marquees.
 
user11006952
That last message is in no way affiliated with topanswers.xyz -- although I am there, too.
 
00:00 - 17:0017:00 - 00:00

« first day (3512 days earlier)      last day (1436 days later) »