« first day (2194 days earlier)      last day (2979 days later) » 

19:01
Just to clear things up, in @IljaEverilä's case above it's fine that they posted the request (for a dupe), it's just the format that we're trying to avoid.
So what constitutes a bot like format? The timestamp?
The tag is irrelevant, the user should not factor into anything but exceptional cases, and the timestamp is irrelevant after the 10 minute rule and emphasizes closing things fast.
In this case was already writing an answer and saw the dupe link in the comments and proceeded to vote.
Here I thought I was going overboard by putting the question title in the hotlink
@Kevin you've gone too far! Devote some of that energy towards the tea cannon.
19:06
Kay.
every kiss begins with kay
I'll see myself out of the room.....
Well, the tea cannon could probably use some diamonds. I'm sure there's some science we can do to it with some of those.
I played around with the idea of writing some stories taking place on the Low Orbit Tea Cannon for national novel writing month, but it occurs to me that I know basically nothing about astrophysics.
I could probably maintain star trek levels of scientific accuracy if I tried real hard but in all likelihood it would drop down to hitchhiker's guide pretty fast
can anyone remember a meta post that discusses mass posting the same answer to several questions
I found it
89
Q: Is it acceptable to add a duplicate answer to several questions?

Won'tLet's say there is a user who has found a satisfactory answer to a common question asked on Stack Overflow (or other Stack Exchange website). This answer may be a snippet of code, or an addon, or a framework, or something else. Is it acceptable for this user to formulate an answer for one que...

DSM
DSM
19:21
@Kevin: are we all going to write novels in November this year? I forgot entirely about the voice acting submission until it was too late, which annoyed me because I actually practiced. :-( So I feel like I need to participate in some new everybody-does-something-individually experience.
^^ is this a serious thing?
what's this about now?
Writing a novel is something I would like to have done, but not something that I would like to do.
DSM
DSM
@Kevin: yeah, I hate writing, but love having written. Every now and when one of my stories gets a positive review it's a warm fuzzy that lasts all day.
What was the voice acting thing?
wim
wim
19:26
LMAO at the comment thread here
0
Q: Why is the maximum recursion depth in python 1000?

Zaizer zazzaI was curious about what the MRD (maximum recursion depth) is in python, so i wrote this: def call(n): print (n) return call(n+1) call(1) The end result was 979, wich is a peculiar number for me. I could not find anywhere why this number is the standard. As i am a self taught programm...

DSM
DSM
@davidism: this
wim
wim
it's like those two-year-olds that question everything with "why"
@DSM thanks. This is really awesome.
wim
wim
"why A?" because B.
"ok, why B?" because of C
"ahh. right, but why C" ....
....
RuntimeError: maximum recursion depth exceeded
DSM
DSM
Heh
19:27
heheh
I personally quite dislike having a maximum recursion depth. Other languages don't have them and they don't seem to have a problem with deadlocking your computer. Why can't we do whatever they're doing?
has been 6 days stackoverflow.com/questions/39985344/… can you guys take a look
DSM
DSM
In practice I don't mind it but I don't like it in theory. And for pedagogical purposes it can be annoying.
Sometimes I do need to recurse farther than 1000, like when I'm traversing a connected graph, and I'm really not fond of mangling a natural functional approach into some nasty iterative piece of work with a manually managed stack
@HollyJohnson guess I just forgot to comment before when I voted to close that, but I can't tell what you're trying to do.
19:31
okay so there a good reason for it to be closed therefor an answer exist somewhere thanks
You don't have a form in a for loop, you don't show what the form is or what problem it's causing.
Please see how to write a Minimal, Complete, and Verifiable Example.
If the good reason for a question to be closed is "this question is a duplicate", then yes, an answer exists somewhere. If it's closed for any of the other nine reasons, then there might not be an answer anywhere else.
DSM
DSM
Or not one that we can recognize, anyhow, if the question is unclear.
wim
wim
iirc python doesn't have tail recursion optimization
and the stack gets expensive ..
I would pay upwards of seventeen dollars in programming bounty to get TCO in Python.
wim
wim
19:35
why? you can usually just transform your algorithm
Because I'm lazy obviously.
wim
wim
arguably into something better, and python may be nudging you in that direction by having a relatively small recursion limit ..
emphasis on "arguably"
wim
wim
what happens to the traceback ?
this song is super old and super popular but I'ma post it anyway cause it's great
19:38
The same thing that happens to the traceback in languages that don't have a recursion limit, I suppose
it is annoying when the 1000 is not enough...
wim
wim
well, that would be a shame
Well it's a fairly niche concern. Everyone currently getting stack traces in recursion-limited-python will get the same stack trace in no-recursion-limit-python. It's only the people writing megarecursive functions that will see anything different. In which case, caveat emptor
TCO would be nice as an optimization, but not as a way around the recursion limit ...
The recursion limit is in place to avoid blowing the C stack and all sorts of badness that can cause.
stackoverflow.com/q/40116588 too broad "I don't know Flask, so what should I do?" "Read the tutorial."
19:44
It occurs to me that we might be talking about different things. I initially interpreted "what happens to the traceback?" as "what happens to the traceback if we lift the recursion limit?" but you might have meant "what happens to the traceback if we implement tail call optimization?"
Or the dupe in the comments, I voted before I remembered that.
wim
wim
yes, I meant the latter
the stack frames don't exist because they've been eliminated ..
not fun for debuggers !
I have no idea what happens to the traceback if we implement TCO. That's why I want to pay someone to think of the consequences for me.
You offered 17 dollars? Is that USD? or some other currency?
Kevin brand Fun Bucks, accepted wherever fine Kevin products are sold.
wim
wim
19:46
Someone might do it for 17 bitcoin
Also, IIRC, there are stackless python variants ...
I suppose you could use that for your massively recursive algorithms :-)
I did always hate it when I was trying out an exercise for an online class and the lecture would be like "We can solve this using recursion!" and the exercise would be like "RuntimeError! Build your own stack!"
The old "algorithm works for the first test case where N=10, but fails for the last one where N=10,000" switcheroo
Reminds me of Project Euler where it's easy enough to find the fifth bouncy triangle prime using an O(N!) algorithm, but then the actual submission asks for the ten billionth.
Same Idea -- Yeah. Fortunately, stacks can be managed quite nicely using collections.deque so ... At least that's helpful.
wim
wim
20:07
ahh, project euler. you think with all the math genius behind that website, one of them would have thought to implement a sane auth system
I often find that math geniuses tend to consider sanity overrated
Almost downvoted just for the avatar: stackoverflow.com/q/40117027/344286
hilariously, which I use completely ironically, the OP correctly indented their markdown code, and then wrapped it in ``
holy crap, I actually just read the code
for port in range(80):
    if int(port) == 80:
          ... # this is the only code that really does anything
good gravy... that's so bad
nice
they should clearly be using round() instead of int()
user6568562
20:16
Someone should tell him about zero-based indexation, for starters
Shouldn't that be if int(port) is 80? Isn't is just a more pythonic version of ==?
DSM
DSM
I hear listcomps are useful. What about for port in [port for port in range(80)]:?
I'm sorry to inform you but you clearly misunderstand almost everything that you're doing here. I highly suggest that you go back, start with the official Python tutorial, and once you've done that, come back to this problem. — Wayne Werner 25 secs ago
@DSM -- No, generator expressions are all the rage with the kids these days. Just drop the square brackets and use parenthesis instead!
@mgilson no - not at all. is and == are two different things
DSM
DSM
20:18
@mgilson: are you a wizard
@DSM -- I know.
disclaimer For anyone reading this thread, please don't assume that is and == are the same thing. I said that completely in jest.
Yeah, assumptions are awful. Just use it as an axiom.
It's your choice, so you can even call it an axiom of choice.
DSM
DSM
For anyone reading this, unnecessary use of listcomps is a pet peeve of mine and I do not encourage it!!
@mgilson I wasn't sure... I thought you knew better :P lol
let's see...13k python score... we will never know for sure;)
wim
wim
20:21
the best wtf I saw on stack was something like this:
for i, val in enumerate(my_list):
    index = my_list.index(val)
    # does something with my_list[index]
cargo! cargo! cargo!
@DSM and membership tests on lists are a pet peeve of mine :-)
@mgilson how so?
(unless it's a 1-time deal ... then the overhead of changing it to something else isn't worth it).
@AndrasDeak cargo build
20:23
Membership tests on lists are almost always inefficient.
sorry, cargo build --release
@mgilson if you're already given a list, should you convert it to something else? Or do you just mean that you should avoid ending up with a list to test membership in?
If it's something that is going to be used for a membership test (repeatedly), then you don't want to use a list to begin with.
@wim wow. THat's just bad
wim
wim
@mgilson is just bitter because he got kicked out of a list once as a kid
20:24
Membership tests on lists are slooooooooow
If you're given a list and you're going to do repeated membership tests on it, then you should construct a set from it and then do your tests.
(as long as you can construct a set out of it).
I know because I was using lists at one point for a thing and it was slow.
QED
@mgilson I see, thanks:)
If you're given a list and only have one membership test to do, then I guess it can stay as a list, but you should ask politely for a different data structure next time.
wim
wim
20:26
membership tests on list are quite fine if you can guarantee it will be the first item in the list ... ;)
I'm a man of my own data structures
It's not just about performance. It's also semantics ...
is this the "should lists be heterogeneous" argument?
DSM
DSM
I could imagine caring about whether an element was in an ordered sequence or not, so I don't think semantics by itself rules out x in some_list. I'd be reluctant to dup the data except for performance reasons.
wouldn't a tuple still be faster?
DSM
DSM
20:38
I wouldn't use a tuple vs. a list for performance reasons, only semantic ones. And they both have the same membership behaviour anyhow..
thanks
I still haven't read into why sets are faster, so all this subject to me boils down to "Magic!"
DSM
DSM
Hashes are kind of magic..
they're not necessarily faster, but they can be semantically more correct.
user6568562
@AndrasDeak Maybe because they only contain immutable types
Hashes are faster because they use the data on the object itself to figure out it's index in the memory array.
In the simplest case (integers), consider if you had a bag of numbers {0, 1, 2, 3, ...} -- and you had an array big enough to put them in. What position would you put each one in order to make sure that you could find them quickly?
Obviously, you'd put them in the array so that the value matched the index. Then to check of the object is already in the array, you'd just look at the appropriate index. If there is something (non null) in that slot, then the object exists in the datastructure. If it's null, then the object doesn't exist in the data structure.
And boom, we've just described the worlds simplest hash table (the hash function is the identity function and there is no collision resolution).
In the real world, this ends up being not useable because hash values are frequently sparse.
But it works basically the same.
Python starts out with an array that has 8 slots.
20:54
35 mins ago, by DSM
@mgilson: are you a wizard
Once the array is 2/3 full, it'll resize
you're using magic, so you have to be
But up until that point, python just slices the last 3 bits off an object (since with 3 bits you can have any number from 0 -> 7) and uses those as the bin where it'll store the value.
And since integers hash to themselves, and since values are read out of the hash table in the order that they appear in memory, we can do some neat little experiements to demonstrate this in the interpretter.
is anyone avliable for hire?
20:58
e.g. since 8 and 0 are both going to contend for the same slot in the hash table, if I put them into a set in different order, they will frequently end up in different orders in the output:
@HollyJohnson This is not the right channel for this kind of request. You are probably looking for something like codementor.io
>>> {8, 0}
set([0, 8])
>>> {0, 8}
set([8, 0])
user559633
Why 0 and 8? Because rebalance?
but, e.g. 1 and 2 will always be ordered consistently:
>>> {1, 2}
set([1, 2])
>>> {2, 1}
set([1, 2])
21:00
@tristan base 2 last 3 bits
user559633
Ah, thanks :)
no worries:)
@AndrasDeak -- Exactly.
Of course, once our dictionary has more than 5 elements, it'll resize and the hash function will start using the last 4 bits instead of the last 3.
so...0 and 16?:D
So then 0 and 8 won't collide anymore. It'll be 0 and 16.
21:02
it is fantastic how easy gerrit makes things sometimes.
this sounds like a very minimal setup for a wikipedia-grade time waster
"What are you doing, honey? Coming to bed?" "Not yet, I'm inserting integers into a set."
@idjaw forget that. ill hire only if its one of you guys. i can pay 60 an hr
@HollyJohnson this really isn't the place for that
user559633
@HollyJohnson This isn't a room for recruiting or trying to hire someone.
fine :_( got it
DSM
DSM
21:04
End-of-day rhubarb for all!
rhubarb, DSM
user559633
just realized my data is totally in the wrong shape rhubarb :)
@DSM rbrb dude :) Have a good one
Flask - Write in a plain text unclear, duplicate of the previous one by a new account
jesus there are so many davids
21:07
@Kevin thanks for reminding me I had your nice links script installed
alright. everything committed, system tests running.
time to get this party started
rbrb all
rhubarb
wim
wim
@mgilson this one is fun, if you haven't already seen it ... stackoverflow.com/q/37667277/674039
21:51
@wim -- What I want to know is how you found that behavior without knowing that it was there to look for it :-)
I ported one of my postprocessing/plotting scripts from matlab to python when I started learning the latter. Now I'm sooo thankful to Past Andras for going all the way and implementing every feature it had:D Saved my butt a bit right now.
I was mildly worried that I'll find a huge "TODO: implement this properly", but fortunately this wasn't the case (for a change; Past Andras can be an asshole)
wow, and I could see how my imperfectly balanced multiprocessing pool emptied: load went from 400% -> 200% -> 100% -> 0-ish in a 10-second interval
rhubarb
wim
wim
22:06
Heh, sometimes it's fun to give a question for the ever hungry python tag lurkers, even if you already know the answer ...
wim
wim
22:54
RESTful people - api endpoint is readonly, should a POST request return code 403 or 405 ?
user559633
@wim 405
wim
wim
thx
user559633
403 would be if it's valid to POST but the given user is not allowed to POST
user559633
no worries
wim
wim
I thought 401 would be if the given user is not allowed to POST and I'm not telling you if it's valid to POST?
user559633
22:57
401 is auth failed
wim
wim
oh, wait, 401 is authentication error, 403 is authorization error.
user559633
403 is "yeah that's a valid thing to do, but i'm not allowing you to do it"
wim
wim
I hate when people say "auth" and don't say which auth they are talking about !
user559633
authentication
user559633
any, all, whatever, concept of authentication
wim
wim
22:58
authentication = are you really who you say you are?
authorization = are you allowed to do that?
user559633
that's authenticity
user559633
authentication typically comes with authenticity and a level of non-repudiation unless credentials stolen/somehow "haxxed"
user559633
oh i see what you mean
wim
wim
anyway, I got it - for sure this should be 405, it's a DRF viewset that should be read-only
user559633
i don't think i've ever had someone say "auth" and mean it in the access control/post-authentication permission way
wim
wim
23:01
previously there were some unit tests that were asserting 403, and I've refactored auth code and now that test is failing because the code is 405
but it's the test that was wrong, it had incorrect setUp and shouldn't have been asserting the 403 code in the first place
DSM
DSM
Aw, man. I was just about to go to the gym when the skies opened and the deluge began. :-/
user559633
Do you have any weights at home?
If you have a body, then you have weights.
If you don't have a body, then you don't need weights because you can't lift them anyway.
DSM
DSM
Unfortunately not. I can always fall back on old habits, though..
wim
wim
@mgilson Not true in space.
user559633
23:15
good point
user559633
dsm are you currently in a zero gravity environment?
@wim -- Sure it's true assuming that you've got stuff to push off of.
At least in spirit.
Perhaps more robust statement would have been "If you have a body, then you can exercise it", but that wouldn't have gotten the point across quite as nicely.
DSM
DSM
Maybe if I give it some time the flood will settle to a gentle mist. I don't mind getting wet, it's the drowning that's the issue.
Yeah. Every time I've drowned, it's spoiled my day.
user559633
yeah, hard to drink until you forget about computers if you're constantly drowning it
wim
wim
23:23
that reminds me of a prank to play in a space station one day
take a sleeping guy and place him in the middle of the room where he can't reach any walls
bonus points for giving the victim some angular velocity
user559633
/me adds wim to no (space) fly list
DSM
DSM
While y'all worry about space, I'm off to do battle with Davy Jones himself. Watery rhubarb for all!
user559633
23:38
Take care, make sure to wear your swimmies

« first day (2194 days earlier)      last day (2979 days later) »