« first day (4930 days earlier)      last day (35 days later) » 

2:34 AM
Just found this useful 2021 Q&A:
34
Q: Hook into the builtin python f-string format machinery to override/extend built-in `__format__` methods

RickSummary I really LOVE f-strings. They're bloody awesome syntax. For a while now I've had an idea for a little library- described below*- to harness them further. A quick example of what I would like it do: >>> import simpleformatter as sf >>> def format_camel_case(string): ... """camel cases ...

 
 
7 hours later…
9:59 AM
For some reason my website is receiving lots of duplicated HTTP requests. When someone connects through a browser I get two requests in a row (for the same URL), but when a crawler (like googlebot) connects, I only get a single request. According to the "Network" tab in Firefox, it only sends a single request. Anyone have a clue what could be causing this?
 
Have you tried this for the favicon?
Seems I also had this problem in the past with Chrome. There's a link in the comments under the question to this question
Then again you're using Firefox, so all bets are off. Perhaps firefox now duplicates its behaviour, not sure
 
It happens with all browsers, I've seen Chrome and even something from a Mac
I do have a favicon already, though it's missing the rel="shortcut" part
> The shortcut link type is often seen before icon, but this link type is non-conforming, ignored and web authors must not use it anymore.
Doing it right by sheer coincidence!
 
10:45 AM
Have you checked with Wireshark if the request comes doubled?
 
11:09 AM
I checked the nginx logs and it only outputs 1 request. I guess nginx must be duplicating the request somehow
 
 
2 hours later…
1:03 PM
Shouldn't this be reopened? It does seem like dupe at first glance, but the other post has different limitations (not hashable objects) to this one (no imports *ugh*).

https://stackoverflow.com/questions/78328372/how-to-count-the-most-common-element-in-a-list?noredirect=1#comment138091036_78328372
 
No, because it's already answered here just using a regular dictionary
 
I'd argue that this answer shouldn't be posted to this question in the first place.
"My list items may not be hashable so can't use a dictionary"
 
The non-hashability clause in the question body is indeed troublesome here but I don't see the value in removing the dupe since the answer technically does exist there and the OP in this question has made their own contrivances on how to solve the problem, which is laid out in numerous other ways in that answer (albeit some using libraries)
non-hashability being a much better argument than "no imports just 'cos"
 
1:18 PM
@roganjosh Sure it is, but those are 2 completely different requirements nonetheless. And closing as a dupe because answer which should not even be there happens to solve an issue doesn't feel right to me.
 
They could also use this answer in a different post. I don't have gold power to be able to add the second dupe target though (and I think that no-import approach is gross compared to the dict approach)
Actually, they dismissed that second option (rightly so)
If you feel it should be answered, I will add my reopen vote, but I think the requirement of no imports needs editing into the title. I'm not too fussed either way; I'm not sure the answers will be particularly illuminating, though
 
 
6 hours later…
7:13 PM
@roganjosh Added to dupe target list
 
7:34 PM
I often wonder what "without imports" means to people
They're already using a high-level language and yet want to avoid importing from the standard library, which their underlying code will do anyway. It seems a silly misconception that they're doing things "close to the metal" or some such, but it's already so abstracted away from the actual code that the distinction is meaningless...
Thinking back to my old Chem Eng days, it's like deriving things from first principles of thermodynamics or something, which was actually quite interesting. I don't feel that Python lets you do anything close to that but I guess lecturers haven't communicated that very well
 
I think those people are just so new to programming that they're still trying to figure out how to utilize all of these puzzle pieces (language features). They don't learn anything if the solution to the problem is "use the solution that already exists". They need to see some ifs and whiles and dicts and variables so they can learn how to write code
 
Fair. It's not so long ago I remember seeing d[c] = d.get(c, 0) + 1 (equivalent) in a presentation by Raymond Hettinger to implement a counter. At the time I was somewhat baffled how it actually worked... to be satisfied with that answer is to ignore the rabbit hole of then how CPython works. There's no avoiding the abyss of ignorance :/
 
8:27 PM
@roganjosh Code Review has the reinventing-the-wheel tag for such questions. Use sorted which uses TimSort and is written in C, is sometimes not the best review for a bubble sort implementation.
 

« first day (4930 days earlier)      last day (35 days later) »