« first day (2985 days earlier)      last day (1950 days later) » 

1:08 AM
Could someone please tell me how to write line 12 of generator.py correctly? paste.pound-python.org/show/g9jrOrAhabcE97ZTdBbu
 
 
3 hours later…
3:55 AM
@piRSquared I know we have discussed the inherent challenge with canonicals, but I still want to keep writing more. This time, I am thinking of writing a post on MultiIndex operations (such as addition, deletion, slicing, and reindexing). I think I've learned from past mistakes, so I'm going to CW if I decide to write one.
 
4:14 AM
cabbage pythonistas
 
4:38 AM
@ReblochonMasque cbg!
 
@coldspeed ok 14 hats
 
4:55 AM
@AnttiHaapala I'm sweating now, maybe it's time I started collecting more...
 
I haven't written to meta yet :P
nor have I tried necromancing or anything such.
I've just changed my hats and otherwise acted normally
and urged one +57 answer to get accepted
hmm seems I've passed 80k
no hats for that.
@coldspeed did you get mugged btw?
 
the hats that you get for outscoring accepted answers, or getting votes on negatively scored answers... I don't see that happening in the tags I contribute to, but people seem to have done it anyway
@AnttiHaapala yes :D here it is: i.stack.imgur.com/7YKND.jpg i uploaded a pic to my about page.
 
just saw :D
 
pity there's no galaxy boss or universe boss hats this year... I think i might've stood a chance with my merge post.
 
guess what
I just got necromancer :P
 
4:59 AM
so, that makes 15?!
 
yes
someone upvoted my nano answer
 
the leader has 20. you are not too far away. But at this point getting the rest of the hats becomes a challenge
mostly playing vote games and answering meta posts
 
indeed
I've got some controversial meta post ideas :D
not sure if they can score -5
 
Ah yes, one of my questions recently landed me the sun Wukong hat
that's one of the rarer ones
 
Rep Hunter, I have no chances of getting it in anymore
there are no 5 answerable questions any more per day :D
gotta try that in
 
5:15 AM
Sorry to be the bearer of bad news, but you'd be hard pressed to find 5 good questions in python either :(
pandas is still doing OK for the most part
 
5:26 AM
The first thing I'd do is to switch to Python 3 right now, if it fixes your error, uninstall Python 2.7. If it doesn't, uninstall Python 2.7 anyway... — Antti Haapala 9 secs ago
 
6:04 AM
Holy negative python indexes are valid... :/
 
 
1 hour later…
7:24 AM
@ReblochonMasque surprised? :P
 
7:35 AM
cbg
22 hours ago, by Arne
@ReblochonMasque I think after today, I'm done with ascii pictures for this year
 
LOL @AnttiHaapala - not the first time I get caught try-excepting invalid indices that turn out to be valid! :/
Never say never @Arne ! :D
 
7:56 AM
@ReblochonMasque I probably jinxed it =/
 
8:26 AM
wow 4 accepts today @coldspeed
and hit repcap, I wonder if there is a hat for that too
 
nice!
@AnttiHaapala can confirm there isn't :-(
just one more to go for the rephunter badge
 
8:39 AM
@ReblochonMasque LOL i just ran into the exact same 'bug' =D
 
@AndrasDeak emmm...pretty sure...have you checked this pastebin.com/Qa9Uxr30 link ? there's more code inside
 
LOL - For some twisted reasons, that makes me feel warm @Arne O_o
I am not alone!
 
9:12 AM
cbg
 
9:32 AM
@Andie31 I checked the link and saw a lot of code, hence my question. You have to localize the problem. See also stackoverflow.com/help/mcve
 
Day17 Help! My Code Spoiler
My test pans out, my actual data looks pretty but no go.
 
@piRSquared look at the middle of the bottom rows. You have negative y indices somewhere
 
negative y's.... I didn't think of that! arg, thx. looking now
 
Probably the stream
 
I fixed that issue. I shifted x's by the min in order to render better. I shouldn't have done that for y's. It only affected the image. Still looking )-:
I'll look at the stream
/facepalm To prevent counting forever, ignore tiles with a y coordinate smaller than the smallest y coordinate in your scan data or larger than the largest one.
Yay, only one day left undone.
 
 
1 hour later…
11:16 AM
@AnttiHaapala when you brought up necromancing earlier, I realised I had no posts that could get me the hat... so here's my first attempt :D
 
 
2 hours later…
12:57 PM
ugh, could you please not?
 
@AndrasDeak I was responding to this
 
So what? I hate fishing for upvotes even on regular days, and hat season makes everything much worse
 
it's a discussion on hats. No one is begging for votes here.
 
yeaaaah
 
I should be allowed to link to my own answers without constantly being accused of begging for votes, thanks
 
1:01 PM
Says who?
 
says the room rules?
 
I'll need to check on that later
 
first one, it says "Be Nice"
you can trash it if you want, I'm not interested in getting into an argument over it :|
 
you already did
 
when you solve a puzzle so late your points are the same as another player's points but with less stars xD
 
 
2 hours later…
2:49 PM
Hi, how do you append to a json object? i.e. I need a list and in that list I will have a bunch of {} objects. so far I end up with [{}][{}]... And that breaks a json file
 
load the list. append to the list. dump the list as json.
 
think I'll just save into .txt files. Thanks
 
that's an odd response to the answer, tbh
 
3:14 PM
Hey, I have a flask project using sqlalchemy with max concurrency = 400 using sqlalchemy sessionmaker. I want to keep a global variable for app state and I don't want to do what I usually do for it (read from redis etc).
Is there an idiomatic way to do this with sqlalchemy? I currently do this with a global variable which doesn't work (obviously) since I want to be able to deploy multiple instances
 
3:45 PM
coffeeless cabbage
 
wim
4:09 PM
@piRSquared that one got me too
and @Arne
since the tap was at 0, and the test case had an otherwise useless block on row 1, it would seem he put it in for no other reason than to trap people who speed-read the problem statement! :(
 
Dec 7 at 5:37, by Antti Haapala
advent of edge cases.
 
Yeah, that was annoying. However, I liked that one. I have to wiggle coding up "E. vs G. II: Turbo Edition" while working.
 
I enjoyed today's
 
because I did 17 after 18, I've forgotten what 18 was (-: reading it again
yeah I liked it too
 
4:19 PM
However the ... view spoiler
 
yup
 
One of my favorite professors offered up extra credit every week for finding the closed form solution to our weekly modeling assignment. Problem was that some of them didn't have closed form solutions and he didn't tell us which ones did or did not. He was happy to let us spin our wheels. I loved it.
@wim
 You are being rate-limited.
Sleeping 3.993379592895508 seconds...
Done.
with aocd. did I do anything wrong?
 
too many requests so the server issues a pushback or something
Input queries should be cached so I suspect you were submitting results too often?
perhaps it's just the usual wrong answer cooldown (starts from 1 minute and goes up from there)
 
Hmmm, I thought it was first request in several hours.
 
well if it was then that is a bug :P
I don't use his library so I don't know when and how it prints those sorts of things
 
4:35 PM
I also cycled through actual browser page refreshes... maybe. I've got data either way. If I figure anything out for certain that wasn't me being a doofus, I'll say so
 
wim
When I originally made the app (2016), Eric (the AoC author/maintainer) asked me to rate limit the requests. This was to prevent people calling get_data in a loop shortly before midnight.
 
oh, I thought you implemented caching, sorry
 
wim
There is, too. Your data all ends up in homedir, aocd will never download the same input twice (unless you change token or clear out the homedir).
Use tree ~/.config/aocd/ to see all the stored files.
 
But then it shouldn't even make those requests after midnight, right?
because it downloads the first time, and then it just reads the cache
 
wim
right but the data isn't available until midnight
 
4:41 PM
as I understood piR had this issue just now, in the middle of day 18
 
downloading day 15 data.
 
wim
if you download 2 separate days in quick succession, you gonna get rate limited yes.
 
that was probably it
 
oooh, I see, thanks
 
data like that should be stored in .cache though, shouldn't it
 
wim
4:44 PM
good to know it's working - I never actually saw the rate limit because I run each puzzle in a separate process ;)
 
I downloaded day17 on accident because I copied my notebook. Edited 17 to 15 and ran it again.
 
I suggest that we trash the word "notebook" because it's starting to mean too many things
 
"... because I copied my .ipynb."
 
I figured :P
 
Less me explaining, more me proposing new venacular.
 
4:48 PM
ah!
 
@wim .. now i get it, finally. I actually still have a buggy version uploaded, then. I understood that discription completely differently. How mean.
That problem would have been easier to debug for me if tasks 1 and 2 had been reversed..
 
for what it's worth I found that part of the description unambiguous
 
wim
Yeah I spent ages looking at the way the dang water flowed and trying to find some wrong looking part.
 
I was unhappy with spoiler
 
wim
It was unambiguous, sure, but unexpected and unreasonable. Since the justification for the restriction was "To prevent counting forever" you would not expect to have to exclude a handful of tiles from the top.
For me, it was an off-by-two error
 
5:02 PM
Yes that ^
@AndrasDeak not sure what you mean. either I didn't have that edge case or I accidentally handled it?
 
Silver linings, i found a bug where i added water sources on top of each other an would end up with thousands of identical flows at the bottom. That will have to console me about the wasted time
 
@piRSquared probably the latter
 
wim
@AndrasDeak can you give an example? don't understand.
 
if there's a remark in the specs to handle this case I missed it, although I explicitly looked for it
Originally I just ignored what happens there. Instead I had to pad.
 
Ahh, I see. view spoiler
"To prevent counting forever, ignore tiles with a y coordinate smaller than the smallest y coordinate in your scan data or larger than the largest one. Any x coordinate is valid."
 
5:12 PM
cbg
maybe I need to avoid room 6 until I either catch up on AoC or Christmas day arrives...
 
You can treat the spoiler links like Christmas presents to unwrap.
and just like Christmas presents, some are better than others (-:
 
spoiler links are a two-edged sword...they hide the information but they jump out from the rest of chat in the orange link font.
just begging "click me! click me!"
 
@piRSquared yeah, that doesn't cover it
because if they are valid then we go back to previous spoiler
 
So you were never able to wait for Christmas day and always begged your parents to open just one (... then two) before Christmas?
 
there should be an explicit constraint that spoiler
 
5:18 PM
I agree, that would be clear
 
@Code-Apprentice we're just talking about edge cases here but I don't want to risk spoiling any "fun" for others :P
 
@piRSquared we had a tradition to open one gift on Christmas eve.
 
@piRSquared no, that would be well-defined
I lost at least half an hour (probably more) because of this
 
@AndrasDeak no problem. I understand the excitement and I'd join the conversation if I'd tried today's problem yet.
 
Yes (-: I sometimes use the words synonymously.
 
5:20 PM
@Code-Apprentice for what it's worth I only come to room 6 when I've already solved the given day's challenge ;)
 
besides...I need to get some work done, so probably shouldn't be chatting anyway
 
 
1 hour later…
6:43 PM
@coldspeed you're trying to get ahead?
 
Bah. Yeah, I failed to find the trick for day 11... and rather than actually forge ahead I just stuck it on the back burner for a while
Which is funny because I could have just brute forced it in that time - which is the approach that I'm currently taking
 
6:58 PM
noooice
 
7:24 PM
cbg
 
wim
7:46 PM
@AndrasDeak OK I understand the issue now - since you only have a 2D slice for the data you have to make an assumption about what the clay looks like just outside of your 2D slice
don't really see how that could lose half an hour (or more) though? there's only one reasonable assumption possible to use (empty squares)
 
8:13 PM
I misunderstood the problem and basically treated the edge like a portal that puts water "somewhere" (without allowing it to settle)
I lost the half hour because I was looking for bugs where there were none :)
well, there were, but not the kind I was looking for
 
wim
8:27 PM
weird
how were you storing the map, that caused that to happen?
 
As an array over valid (clay-filled) indices. I just ignored stuff when the array ended.
 
wim
mine was just in a dict, which is returning empty space by default e.g. dict.get(coordinate, "."). like a sparse array I guess.
The problem didn't seem like a good use-case for dense arrays. (Today's did!)
 
I always start with brute force :)
I rewrote my original to be faster (less loops), and there the array really is just a container for the tiles
 
wim
well, it's still brute force.
just different storage backend
 
I consider it mental brute force. Throwing numpy at something defined on a grid is my knee-jerk reaction, and leads to the least cogntive effort for me.
 
wim
8:31 PM
I had a pretty cool numpy trick for today's one
Forgot to upload my code, will do now ...
here's the trick
 
It feels so weird seeing all these 1-year "LTS" releases.
 
wim
there's probably a more numpythonic thing possible by using a 3-dim array but I always get a bit confused in those higher dimensions
hello @user2357112 are you playing AoC?
 
@wim yeah, I figured I could use that but I never got the hang of that operation
I briefly wondered about using 2d rolling windows but I ended up just looping to get it over with
 
@wim: No.
 
wim
should try it - much more fun than answering Q&A on stack ... :D
 
8:47 PM
cbg
 
Hi. I'd like to know, when you fiddle with data in jupyter and get the desired result/algorithm, do you still use python to assemble a pipeline, or do you rewrite the stuff in a more enterprise like language?
 
wim
man, looks like day 15 left a few people in the dust. it may have killed @AnttiHaapala .
 
Do we keep the hats after Christmas or are they temporary?
 
I think they end sometime in January. There are new year's eve hats and whatnot
 
they generally don't disappear right after christmas
 
8:51 PM
sad react if they go away at some point
 
it says so in the winterbash page winterbash2018.stackexchange.com
 
@wim I'm working on it now. I got slammed this weekend and while trying to catch up, day 15 looked like the reasonable choice to leave last.
 
> but be quick – the hats get put back in their boxes on January 2nd!
 
ô/ #WhoHatesHats #NeverAgain
 
wim
If only the collateral damage from people trying to get hats also disappeared on Jan 2nd ...
 
8:58 PM
Honestly AoC is a welcome distraction as I haven't paid much attention to the main site
 
Trying to get hates makes more damage than trying to ge rep?
 
OK, pushed the strided version. This was easier than I thought.
 
@AndrasDeak For a moment there I really though you meant Age of Conqueror, the rts game
 
almost, but no
 
@wim no, Koskenkorva killed me on Friday and my work and life after that.
 
9:08 PM
ah, no, @wim I also used numpy for finding regions of still water
 
confused! In my notebook {*range(23)} shows
{0,
 1,
 2,
 3,
 4,
 5,
 6,
 7,
 8,
 9,
 10,
 11,
 12,
 13,
 14,
 15,
 16,
 17,
 18,
 19,
 20,
 21,
 22}
 
while print({*range(23)}.__repr__()) shows {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22}
what method is IPython calling on set to show that vertical representation?
 
dunno, but repr(...) already behaves differently from the automatic print
 
huh!? even print({*range(23)}) prints horizontal.
 
9:13 PM
same for lists and tuples, actually
 
what does sys.display_hook or whatever it's called do?
 
pretty print? this works from pprint import pprint; pprint({*range(23)})
@JonClements that works too
 
ty. all is well with the world again
 
it is, is it? :p
@holdenweb paying it forward...
 
9:18 PM
I typed in 7 witty responses and deleted them all. Just wanted to let you know how smart I am. Not because I had witty responses but because I deleted them.
 
wim
@AndrasDeak better!
 
@piRSquared shame, I guess I'll just have to imagine such things in my dreams or something? :p
 
wim
pro-tip: don't use a seen set, and a list of hashes. Just use a dict!
 
but I need the order of hashes
 
wim
that's the value of the dict, duh
 
9:22 PM
@wim why are you looking over my shoulder?
 
Hmm, right. Meh :P
(but thanks for the tip)
 
wim
@piRSquared que?
does the IPython pprinter still sort dict keys? now that dicts have order, that "feature" has probably become a bug and should be removed.
 
In [75]: {'b': 1, 'a': 2}
Out[75]: {'b': 1, 'a': 2}
sort how?
 
wim
it used to sort them by key when possible. looks like they removed it, good.
 
I didn't even know that it used to sort
not that I'd ever rely on something like that
 
wim
9:25 PM
try it in 2.7 it will sort for display
 
ew no
 
wim
heh
 
If I have a method that mutates the object, is it a bad idea to return the instance as well?
class A(object):
    def __init__(self):
        self.B = set()
    def add(self, other):
        self.B.add(other)
        return self
 
that usually doesn't happen (but setdefault...)
 
depends if you want to chain or not
also depends much more on what you state/want that object should do
that example using mutables is also quite odd
 
wim
10:01 PM
Yes, it's a bad idea.
There is not much precedent for chaining mutations in Python, so you're violating principle of least surprise.
 
TIL "principle of least surprise"
 
wim
(this is why we have sorted and list.sort)
 

« first day (2985 days earlier)      last day (1950 days later) »