« first day (2977 days earlier)      last day (1954 days later) » 
00:00 - 22:0022:00 - 00:00

12:11 AM
I tried that, and it uh... well, didn't work very fast.

Changed to just making my own linked list and even on my crappy old hardware it only too 60s
compared to the 14h to fail that my first solution took lol
Used like 1GB RAM, but I've got 2 on this system, so... I guess that's OK? lol
 
 
1 hour later…
1:31 AM
haha @WayneWerner - while the brute force was running, I had time to code my own linked list too!
 
 
2 hours later…
wim
3:17 AM
@WayneWerner ouch. if your linked list nodes are each carrying around a __dict__ it could be heavy (try using __slots__ here)
 
I have custom class inside a dictionary, I run deep copy on the list but the attributes of the class is not set, is this normal?
 
@wim Oh, that's a good point, didn't think about that
 
if anyone could help me it would be great
 
@WantingtobeanAndroidDevelor do you have mcve?
 
Im sorry but what is a mcve
 
cbg
 
do I have to use pickle for this type of stuff?
does copy not go infinitely deep and store everything attributes of class that is inside a dictionary?
 
don't use pickle to copy stuff, no
 
I really don't see why this is happening
I have class called point that store 3d position data
these point class are assigned to dictionary with set attributes
when I deep copy dictionary, dictionary contain point class with 0 attributes
never mind false alarm Im sorry
I did Minimal, Complete, and Verifiable Example and found out it was my fault Im sorry
is Minimal, Complete, and Verifiable Example supposed to be some sort of debugging method? or is it supposed to be more for communication
 
wim
3:42 AM
did anyone get a closed form solution for yesterday's puzzle? @MarcusAndrews ? seems like a modified Josephus problem
 
@AnttiHaapala I call it "inspiration", not "copying" :P
 
@WantingtobeanAndroidDevelor yes
:)
 
4:05 AM
Ive been googling this up but I can't quite get a hang of it
if I had a class that is inheriting from 2 parent class
and the 2 parent class each have different init method that take different attributes
how can I use super().__init__()
 
wim
you can't, really.
 
wow
then what would be the solution?
 
wim
don't use super
call the parents explicitly, with the arguments they want
 
you mean like association?
oh sorry, how do you call them explicitly?
@win
 
wim
class FlyingCar(Plane, Car):
     def __init__(self, ...):
        Plane.__init__(self, ...)
        Car.__init__(self, ...)
 
4:09 AM
I see, I didn't know you could do that thanks a lot
python really is beautiful
 
wim
some parts are beautiful but she has her fair share of warts.
 
in what kind of area?
I used to think that python forces you into writing in a specific way
but now I think there are almost too many ways to write things
 
wim
4:24 AM
Oh, there are too many ways. The language could/should probably benefit from being more opinionated about certain things.
 
im sorry I'm a noob to python, but what is happening within these brackets?
X = iris.data[:100,:]
I've seen the slice operator, but I don't understand the comma with two operators
 
4:52 AM
@oraz it depends on where you imported that data from. I'm assuming it is a 2 dimensional array. That means that the [:100, :] refers to the first 100 rows and all columns.
 
@WayneWerner wow
... at your 2G
@WantingtobeanAndroidDevelor the constructor / method chaining is really braindead.
you really don't want to use multiple inheritance most of the time...
... or even single inheritance.
it doesn't matter if you're born of a duck... for as long as you can quack and walk like one.
 
I guess since the data is an array or samples, which are themselves pixel arrays
so it's splitting the first one hundred and explicitly saying use the whole array?...
 
@piRSquared So, what's next on the list of things to clean up in our tag? :D
 
one minute before aoc... no questions. Only my wife can derail my aoc (-:
 
oof, well good luck
Dec 3 at 15:19, by Kevin M Granger
I love Advent of Realizing I Can't Code
 
5:21 AM
@WayneWerner but inheritance reduce code redundancy
 
5:36 AM
bwah my numpy-fu is really baaaad
 
In pycharm, tutle module, tutle graphics just comes for a second and then closes the window
But tin IDLE, it works properly
none of these answer work for pycharm
22
Q: Python Turtle graphics - how do I control when the window closes?

Tomas AschanI have a small python script which draws some turtle graphics. When my script has finished running, the turtle screen automatically closes, so to be able to see the graphics for a while I have to use time.sleep(5) at the end of the script to delay the closing. Is there any way I can make this mo...

 
6:10 AM
aoc day10 spoiler:
[view spoiler](https://sopython.com/spoiler/aHR0cHM6Ly9weTMuY29kZXNrdWxwdG9yLm9yZy8jdXNlcjMwMl95QWRqOGtyQUlzXzEucHk%3D)
 
wim
6:20 AM
cute puzzle
 
 
1 hour later…
wim
7:29 AM
what's the more numpythonic way to set a sparse bunch of points in a 2D array? i.e. how to do this (possible aoc day 10 spoiler) without the for loop?
 
@wim you can spare some of that with img = np.full((h,w), '.')
and h,w == ps.ptp() + 1
though you'll have to shift by min somewhere anyway
 
@wim I think you just want:
a, b = ps
img[b, a] = '#'
 
oh yeah, that too
img[tuple(ps)] = '#'
assuming your ps has shape (2,N)
 
@AndrasDeak indexing has to be flipped though
 
depends on wim's shapes
 
7:43 AM
 
ty, enuf for me tonight. rbrb
 
rbrb
 
wim
8:00 AM
@user3483203 ah, yep, that was it. I had tried the img[tuple(ps)] = "#" and got IndexError
 
@wim does your aocd library work on windows, can't seem to get it to recognize my token
 
8:16 AM
@wim I've only looked into it a little bit -- I have a solution for the simpler version of only adding the current marble to the score (as opposed to tacking on the marble 7 positions back)
The full version is a lot more complicated and I can only think of some kind of O(p log m) approach where we sum up a lot of values for each player in logarithmic time and just take the max
Logarithmic in that it's sort of like an augmented Josephus problem
 
wim
@user3483203 dunno but can't think of any reason why it wouldn't work.
 
Are there anyone used Pytest to test your code?
 
8:39 AM
@wim then you could've flipped ps
flipud, I think
This no repro needs 4 votes still
15 hours ago, by Andras Deak
no MCVE https://stackoverflow.com/questions/53694962/having-the-tuple-has-no-attribute-k
 
9:05 AM
My new phone offered to clean up my sd card and increase my available 7.25 GB space by 52.21 kB [sic]
 
 
1 hour later…
10:09 AM
@AndrasDeak Does your phone also self organize things to neat lines?
 
10:41 AM
yeah, and keeps mumbling about airplanes
 
user6718998
11:21 AM
Hi guys. Anybody knows why values won't get added to my array: pastebin.com/Bpsah1VJ ?
 
range(2, 0) is empty
 
11:49 AM
hi, on this page ( docs.python-guide.org/writing/gotchas/#late-binding-closures ), the gocha related to late binding can be solved by replacing list by tuple in create_multipliers function, how?
 
where? how? I don't see anything like that on that page
 
```
def create_multipliers():
return [lambda x : i * x for i in range(5)]
for multiplier in create_multipliers():
print(multiplier(2))
```
this code
 
I don't see the claim that use of tuples would solve it
 
if you try, you can see :-)
I found tuple trick on different page
and it works
 
You mean like return (lambda x : i * x for i in range(5))? That's a generator, not a tuple
and it doesn't work (well, not really)
 
12:02 PM
@EdwardTorvalds ... so not on the page that you linked?
 
no
def multipliers():
return (lambda x: x*i for i in range(4))


for mul in multipliers():
print(mul(2))
try this
 
That's not a tuple
 
ok, thanks
looked like
 
12:35 PM
Totally tupular
 
12:50 PM
Is this question eligible for a typo?
 
n8_
1:14 PM
Good morning!
maybe it's a bad morning...
 
Mondays get an automatic -5 to their morning score
 
more like mourning, am I right
 
Pretty much every Monday for the last three years, I've tried to do morning/mourning wordplay, but I could never workshop it beyond a tier 1 pun
 
n8_
"Looks like someone has a case of the Mondays"
df.columns...can someone direct me to documentation/examples for this in pandas?
 
n8_
awesome, thanks!
 
I've got a list, widgets, which I need to mutate by iteratively removing elements until it's empty. Then I need to restore it to its original state. This can be straightforwardly done by creating a copy of widgets before mutating, and then reassigning afterwards. Question: what should I name the other variable?
widgets = get_widgets_expensively()
x = widgets[:]
mutate(widgets)
widgets = x
do_second_thing(widgets)
x is not very descriptive. original_widgets?
 
works for me
 
widgets2_electric_boogaloo
 
or mutate(widgets[:])
or even widgets.copy() for max semantic points
 
1:39 PM
The mutation is done inline in my actual code, but maybe I should put it in a function... That's probably best.
 
@Arne I finally finished day seven problem one, thanks again. I think I actually have a decent algorithm for the second part of that day as well. Basically create a time keeping variable, assign finish times to worker queues and pop whatever is complete at each iteration. Does that sound reasonable?
 
sounds reasonable
I'll take a look on my commute home
the german train service is on strike (again), so I'll have plenty of time
=D .. =| .. =(
Today's puzzle didn't fit with me at all, so messy
 
numpy numpy numpy ;)
 
Oh well, what's that saying about "Good, fast, and cheap-- pick two..."
At least you are still on track to save Christmas :) Does anyone else have problem with the potential time paradox in the story? It begins by saying that someone has gone back in time to change history and destroy Santa in 500 year increments but that their changes do not propagate to present time until Christmas.
We have a device on our wrist that allows changes to propagate instantly. But what happens when the changes on the isolated “time-thread” finally do propagate? Everything will be undone...
 
1:55 PM
The only time travel models I consider internally consistent are "you can interact with the past, but you were always predestined to do so, and there never was a timeline where you didn't" and "you can interact with the past, and this creates a new timeline independent of the one you came from".
"You can interact with the past, and this may cause you to vanish from existence if you do something especially dumb" makes for a good popcorn flick but you wouldn't want to live in a universe like that
Reminds me of the bit from Matt Smith era Doctor Who, where the antagonist leaps into the Doctor's "personal timeline" and "turns his every victory into a defeat". And this manifests in the present as The Doctor experiencing terrible pain. Which doesn't make a lot of sense. Losing an important battle in 1963 shouldn't just cause him a migraine in 2016. It should cause him to have been dead since 1963.
"putting emotional impact before coherence" is the show's calling card but this was a high water mark in that regard
 
I find it hard to suspend disbelief in this subject. Past actions affecting this world real-time is ridiculous
"I hope he succeeds 15 years ago, the bomb goes off in one minute"
 
2:16 PM
One of my favorite time travel movie bits is in Despicable Me (I clearly have little ones at home) when Professor Flux brings himself back from the future many times so he can have versions of himself as minions. Then an accident happens and present self is killed by future self; they all vanish instantly.
 
Relatedly, I'm 100% sick of people saying "actually if you time traveled to a year ago, you'd appear in interstellar space because the solar system is constantly moving around the center of the galaxy"
 
Time travel is short for spacetime travel
 
Oh like you'd miss the mark and land on nothing, what's wrong with that thought?
 
As I understand it, in the real world there's no such thing as "the same point in space, but at different times". Relativity does not work that way.
 
@W.Dodge the same way antigravity works ;)
 
2:19 PM
If you are suspending your disbelief in order to accommodate the idea of "traveling through time but not space" as if they're two different things, then it takes no additional disbelief to use the Earth as your frame of reference in terms of what constitutes "the same point in space"
Using the center of the galaxy as your fixed point of reference is exactly as silly as using Earth.
Let's not even talk about the bunch that says "but actually all galaxies are moving away from one another so you'd actually appear in intergalactic space". Now you're not using any fixed point of reference? What exactly is our own galaxy moving away from?
Credit to writers that use FTL travel or wormholes as their time travel macguffin, because both of those move through both space and time in a (mostly) sensible manner
 
@W.Dodge I think our work just exists on a different branch, and the final star is gotten for writing git push -f into the command window. The changes propagate all at once then, and not before
 
@Kevin actually, if you imagine dense points on a balloon and inflate it, you're much more likely to hit a non-point after
 
cbg
 
Day 4 of AoC doesn't make sense to me, at least the example (not sure where the 24 is coming from)
cbg \o
 
2:31 PM
If you go through a wormhole, you won't come out in interstellar space unless someone was rude enough to move it there. We're playing Calvinball when it comes to the properties of exotic matter, but most writers assume it's affected by gravity and nuclear forces etc, in which case it's going to stay on Earth unless you put it in a rocket
 
@MooingRawr he was asleep twice on that minute
As opposed to once or less on other minutes
 
... I feel like an idoit... lol
I was reading it all morning... Couldn't figure it out. I also blame that this is my last day before vacation, so I might already be in Vacation Mode.
 
Hmmm first thought in mind is brute force, second though in my mind is wondering if there's a pure math solution
 
@MooingRawr also, something that bothered me on that question. They use the word frequency which they intended as the sum. So one guard on duty for 5 days but only slept 20 minutes a night will show up as sleepier than a guard on duty for 2 nights who slept 40 minutes a night... point is, use sum and not mean.
 
2:36 PM
@AndrasDeak What I'm hearing here is "If there is a coherent model of time travel that doesn't use FTL rules or wormhole rules or an arbitrary fixed point of reference, then that model will most often put you in intergalactic space when you go into the future". I think I can agree with that. I'm just not sure such a model exists.
 
@Arne Saved by github, I can rest at ease
 
I really hope I don't have to order the list first then operate on it, stupid N^2 solution :(
 
@MooingRawr I think a good approach for AOC is: try the brute force approach first, and then try to get fancy.
If you try fanciness from the outset, you're in danger of 1) not actually understanding the problem, 2) searching for an efficient solution that doesn't exist. In either case you're expending a lot of energy without getting a star for your efforts
 
Isn't that the solution to all problems, find the guarantee solution first then optimize it? Gaming, Building houses, planning weddings, etc... But I guess you are right
 
I'd agree, stars are the most important aspect
 
2:40 PM
Yes, stars are what keeps our Kevin running
 
I hunger
 
@Kevin I tried fanciness for day 8
yesterday, by Arne
turns out the gain from caching sub-results was less than the setup to put all the nodes into node objects
It was horrible, never gonna do that again
 
@Kevin yeah, that's possible. But I mostly meant vis-a-vis expansion of the universe
 
@Arne Interesting. I was wondering whether caching would be useful. Thanks for saving me the effort :-)
 
saving others from that pain is all the thanks i need =)
 
2:45 PM
My non-caching approach already uses objects, but I can't just slap on functools.lru_cache because nodes are dicts and thus unhashable
 
In [7]: %timeit day08.day08(inp)
   ...: %timeit day08_nocache.day08(inp)
   ...:
   ...:
11.8 ms ± 122 µs per loop (mean ± std. dev. of 7 runs, 100 loops each)
12.1 ms ± 54 µs per loop (mean ± std. dev. of 7 runs, 100 loops each)
 
heyy, caching improved it in your case =)
 
The AOC admin could easily have constructed an input file in the style of billion laughs but I guess it's too early in the month for that
 
@Arne because I already had node objects ;)
 
>>> make_input = lambda n: "1 10 "*n + "0 1 1" + " 1 1 1 1 1 1 1 1 1 1"*n
>>> make_input(9)
'1 10 1 10 1 10 1 10 1 10 1 10 1 10 1 10 1 10 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1'
Here's an input file that will iterate a billion times if you don't cache, and 9 times if you do cache
 
2:54 PM
ah, I see
 
(maybe try it on make_input(5) or so if you want to time the results before the sun explodes)
Quick nerd snipe: this string constructs a tree of depth 9 with each node having 10 pieces of metadata, for a total of 10^9 iterations. Find the smallest input string that has a billion iterations or more.
 
3:12 PM
Testing the first twenty possibilities, looks like "depth 3, with 19 metadata per node" is smallest: 1 19 1 19 1 19 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
Beating out "depth 2 with 30 metadata" by a single character
 
hey, Félix, heard you think we're too lenient ;)
 
Ugh day 9 is rife with off by one errors. If I never use list.insert again, it will be too soon
 
^ agree 101%
 
@AndrasDeak hah!
More like, compared to the er... quickness at which folks close stuff in other rooms, people here are a bit more "posed", if that means what I think it means
it shows equally in how newcomers are spoken to and remote debugged (that's right, the newcomers are debugged)
I'm curious, did Jon snitch me?
 
3:30 PM
@FélixGagnon-Grenier poised?
 
yes! thanks :)
 
Well that is a compliment then (-:
 
it is, indeed.
 
@FélixGagnon-Grenier Martijn :P
 
3:34 PM
very early alpha release day cabbage :)
 
cbg
 
cbg
 
3:45 PM
More specifically, my day 9.1 code works on "9 players, 25 rounds" but fails on "10 players, 1618 rounds"
I'm interpreting "last marble is worth 1618 points" to mean "the game ends once the marble labeled 1618 is placed" and not something like "the game ends once the marble 1618 is picked up"
 
that's what it means but I didn't check every test case
 
I got it working. Surprisingly not an off-by-one error. I forgot to actually remove the marble from the circle when I score it
Not a problem when only one player scores only once, which explains why the first test case passed anyway
 
wim
the wording of day 9 is horrible. it's like a "de-obfuscation of the problem statement" challenge, and the actual underlying problem is pretty much trivial.
 
I could use a circular linked list and get it down to O(N^2), but a million squared is still pretty high
 
where did you get O(N^2)?
 
wim
3:57 PM
if you use dumb list.insert is n^2 so not sure how you have n ^3
 
math_lady_meme.png
I think you're both right
 
@wim list.insert does not appreciate your condescension.
Condascension: when you ascend to using Conda.
 
:D
I haven't reached that level of enlightment yet
 
wim
in hindsight that puzzle was probably supposed to be a lesson in just how bad o(n^2) can become with bigger input. you see people posting suboptimal o(n^2) answers on SO just so they can one-liner something pretty frequently. Eric's way of slapping those people who reached for the wrong data structure?
 
4:16 PM
linked list is what I reached for because I didn't want to deal with 1-off modulo errors.
 
My shiny O(N) approach finished in ~50 seconds. Good enough :>
 
I also imagined preloading a big array the size of the number of marbles and tracking which have been inserted removed with a zero or one. Then we can traverse forward 1 or back seven with a while loop. That should be close to linear. Also, I could implement that in numba and it should be quick. But then that sounds like too much trouble. I'm guessing it should work though
Oh, no! it wouldn't work. The inserts /facepalm I'd have to shift all my values.
 
4:39 PM
So for today's part 2, I had already solved that to solve part 1. :-/ Feeling a little cheated there!
 
^ hah! me too. But I didn't feel cheated.
 
I forget whether I permitted myself to use my homebrew geometry.Point module last year, but I'm totally using it this year
 
Point taken
 
2017 was the year of complex-numbers-as-coords, 2018 is the year of giving up and using a proper Vector class
10.1 complete... I can find 10.2 by adding a single line of code, but I'll have to sit through the 60+ second runtime again ;_;
Perhaps this is Eric's way of slapping those people who are satisfied with programs that take more than a minute to execute, when they could get sub-one-second if they tried
 
I just stuck with numpy for today. So much easier to apply a delta to ~340 x, y coordinates that way :-D
 
4:50 PM
@MartijnPieters same here. First I was going to compute the whole field for each iteration, but then python told me that I do not in fact want to allocate a 105k x 105k array
good thing I set a memory limit after my memory fiasco on one of the early days...
 
I barely looked at it. I haven't used numpy to solve any aoc problems yet and this one sounds like a good reason to start.
My biggest stumbling block for day 10: how do you detect that the grid displays a word?
do I need some machine vision thing?
 
My approach: view spoiler
 
there are good simple heuristics
 
Oops, I thought I could get sub-one-second with a minima-finding algorithm, but that would require my heuristic function to be differentiable, which it isn't.
 
I'm not yet to the point where I want to look at finished code solutions. But I'm more than willing to research and discuss ideas at a higher level.
/cautiously clicks on Kevin's spoiler to see if it is code...
 
4:56 PM
You can tell roughly how much text a spoiler will contain, since its size is proportional to the length of the url. So you can be reasonably sure that my link does not contain a full solution
I can't fit a solution in ~40 characters unless it's day 1
My link contains zero code, for the record
Maybe I can use two heuristics. An approximate but differentiable one to get into the general neighborhood of the solution, and then an exact but undifferentiable one to use while searching linearly through that neighborhood.
 
I'm not sure what you mean by differentiability in case of a discrete function
oh, you mean something better than stepping over each step, OK
 
You can make it continuous with an additional pinch of elbow grease
 
@Code-Apprentice view spoiler
Upside of that heuristic is that you can break out early in pretty much all steps except for the actual solution
 
wim
5:13 PM
Eric should have left a few particles flying around out there in the "asciiverse" to defeat people that used a bounding box
I had used a crude standard deviation based thing, in case there were some random particles might be flying around that were not part of the message
 
That would've killed my approach. But I chanced it
 
wim
Just hope there are no "i" or "j" :D
 
You can even imagine a letters that are offset. Maybe stair case patterned going downward. In which case not stray points needed, the solution simply wouldn't be the at the minimum bounding box
 
@Kevin unless it was a custom link to dpaste or gist...but then I could just look at the URL to see that.
 
5:19 PM
...I am reading discussion about recent days' problems in AoC and thinking...I'm behind, but I'm behind in a place where the math for reasonable runtime solutions is something I can easily come up with on my own :/
 
@wim I take it that "Eric" is the creator of aoc?
 
wim
correct
 
@Code-Apprentice view spoiler
@wim i was bracing to implement a tolerance metric, but luckily they're all uppercase =]
 
wim
Unrelated: TIL that stdlib logging has this logging.config.listen feature. Pretty cool.
This thing apparently existed since forever and I never noticed (to change runtime logging config would just restart services like an idiot)
 
5:36 PM
sub-one-second solution success B-)
 
@Kevin now i'm curious!
.. i might be blind, but did you not share your gh link?
I could of course click on last year's and just navigate to this year's version
 
I haven't got around to making a proper repository. For the time being, Here is my day 10 code.
 
@Code-Apprentice: I looked at the puzzle data and my method of solving the puzzle quickly became clear to me when I thought about groups of points enough.
 
wim
day 10 part 2 was a gimme, right? how could you even have solved part 1 without being able to trivially have part 2 aswell - am I missing something obvious?
 
My theory is that it exists exclusively to punish users who implemented a slow solution, if they happened to not print the day the first time around. e.g. me.
 
5:52 PM
This is a distance heuristic that also works. Slower than bounding box but might be more robust. view spoiler
 
@Kevin I always imagined the smaller the tier number, the better the tier
at least, that's how it's always been in NFS games
 
Official Pun Hierarchy
Tier 0: The words sound similar.
Tier 1: sentence is largely coherent when using either word.
Tier 2: meaning of sentence changes when using either word, but both relate to a consistent theme.
Tier 3: sentences reveal a profound Truth about the nature of reality.
Change out the tier numbers for C, B, A, and S if you like
The S+ tier theoretically exists, but anyone reading it would transcend into pure energy, so there aren't any recorded witnesses.
[insert here: obligatory link to the Killer Joke sketch]
 
my life has been a lie.
 
"A Freudian Slip is when you say one thing but you mean your mother."
 
that is funny
 
6:00 PM
Solid Tier 2 right there
With a dash of 3 if you believe that Freud wasn't full of hot air
 
First one that came to mind when reading @Kevin's post
 
One dash of A and two dashes of S 'A' + 'S' * 2
 
I prefer the template that also has the angry dog that is the unwilling recipient of the pun. The angry dog accurately portrays my own feelings.
 
wim
6:16 PM
so cute <3
 
cute freehand circle indeed
 
wim
oh that weird, the private leaderboard which was created this year can be viewed on previous years too (just change the year in url)
kevin you won 2015 beating out martijn adventofcode.com/2015/leaderboard/private/view/119932
 
That's more of a ranking of "willingness to stay up until server's midnight" than anything else
 
wim
also looks like you forgot to submit day 6 part 2 this year
 
I haven't done it yet, because I fell into the trap of thinking about fancy solutions before trying a brute force faceroll to see if it's fast enough
 
wim
6:25 PM
ah. fooling around with complex numbers again?
 
I'm looking at resurrecting an old (as in really old) project on .NET, written using boo. Is there a .NET Python option nowadays?
 
My idea involves dividing the plane into distinct regions by drawing horizontal and vertical lines through each point. I think I can get O(num_points^2) performance that way.
If you are about to say "oh, that's the intended solution after you discover that brute forcing is too slow. You should have been able to whip that up in fifteen minutes", maybe so. I have simply been far too busy these last four days looking at memes.
 
Looking further, I think I'm pretty much stuck with boo.
Still an improvement over C#
 
wim
whoah, the logging cookbook has a text to speech handler
> When run, this script should say “Hello” and then “Goodbye” in a female voice.
it works!
 
Instructions unclear, fed my 8 GB log file through a text to speech program
 
6:40 PM
cabbagio
 
Doesn't work on Windows, natch
Plucked from the deepweb for your enjoyment:
> The greatest pun I’ve ever seen in the wild was when I was TA-ing an electrostatics lab for first years. Part of the experiment was to attempt to charge up various rods and see if they would attract small pieces of paper . One student wrote up their observations as to what happens when you try to “charge up” and use a metal rod: “the paper remains stationery”.
 
6:59 PM
@Kevin was that really a pun or a typo?
 
The truth is lost in the haze of time
(My impression of first years of anything is that they're barely sentient, so typo seems more likely. But a man can dream.)
 
As a former freshman in college, I imagine it was a simple typo and a happy coincidence as a pun.
especially since no spell checker will flag that
 
I initially imagined that they were writing it up on paper. Ideally, on the same paper they used during the experiment, to reduce waste.
 
Mr Squiggle is Stationery is a True statement.
 
Ceci n'est pas une papeterie
 
7:22 PM
I may or may not have to write a 4! element switch case for my 6.2 implementation
 
7:36 PM
better than n!
 
Update: I got annoyed and did a flood fill instead.
My solution assumes that the region described in 6.2 is always contiguous, but I haven't completely convinced myself that it is
> Because of a bug in the day 6 puzzle that made it unsolvable for some users until about two hours after unlock, day 6 is worth no points.
Nice to see that once again my actions have no negative consequences B-)
 
user6718998
8:09 PM
Hello. I just realised my for won't work, because i and j are values and not indexes. So how can I convert this so that I would get previous and next items? pastebin.com/7RZW19WB
 
i and j aren't indexes, but n is. So the previous items would be at n-1 and n+1, right?
Or perhaps n and n+2 since you're slicing the first element off. I guess it depends on what you're trying to index
 
hmm, somebody with pandas experience here?
 
user6718998
so it would be like uj_list.index(n) ?
 
uj_list[n]
 
You almost never want to pass an index to the index method.
 
8:14 PM
uj_list.index(n) is as bad as uj_list[i]
 
user6718998
ah yeah
 
@timgeb what do you need?
 
I've never actually had to use list.index yet
 
user6718998
but how can I take care of this logic: if index of uj=0, then using uj-1 shouldnt be possible
 
@piRSquared just somebody to tell me if I found a bug or don't understand transform. :) pastebin.com/2LABdKbm
 
8:22 PM
that looks bad
 
Can you reproduce it?
 
that's basically DataFrame.transform vs Series.transform, right?
 
firing up notebook
 
@timgeb that's why you should add a runnable MCVE :P
 
@AndrasDeak that's why I'm lazy and go to chat :P
 
8:24 PM
Yes, I can reproduce and what's more is df.groupby('id')['A'].transform(lambda x: x.ffill())
 
df = pd.DataFrame({'id':[1,1,2,2], 'A':[2,float('nan'),3,float('nan')]})
 
works as intended
I'd report it
 
same here, pandas 0.23.4
 
Thanks, I thought I did not get something about transform since I just learned about the method a few days ago.
 
I'd expect column-wise operations to act the same on series and dataframes (not being familiar with transform myself)
 
8:26 PM
Well if they worked differently I'd expect there to be something about this in the docs, but I didn't see anything.
 
transform is intended to broad cast result onto the same index of the object calling groupby
 
I am currently in a slapfight on the main site.
me: your code isn't working properly because you're doing `if a in b and c`
OP: no, you're wrong. I know my code is working because it doesn't crash when I run it.
 
lol. So good
 
You can't argue with that.
 
He must be new to the Python.
I love it when new posters refer to THE Python.
@Kevin that reasoning sounds good enough for meetings with higher ups
 
8:31 PM
Plot twist: c is a bool
 
I'm oversimplifying a bit. His actual code is more like if all(x in seq for x in b and c) which at least doesn't have bizarre operator chaining behavior. It's just regular old short-circuiting.
There's a possibility that his code will work by coincidence anyway, and it was never necessary to check the contents of b at all. That's the impression I got, so I let the matter drop
 
8:54 PM
Hola. How do you achieve something like the following. I am subscribed to a websocket feed in Python and I need to use the aggregated information from that feed in a different module. Can I constantly write to a global variable and then access it from another module, or would that mess up read/write process?
 
assigning and accessing a Python variable is thread-safe, so that shouldn't be a problem
 
@Kevin brilliant! Thanks
 
That said. If you've got one websocket thread assigning to the global, and one monitor thread constantly looking at the global to see if it changes, that's probably not the best design. You can't be sure that the monitor thread will see all changes.
If the monitor checks the value at time 0, and the websocket assigns to the value once at time 1 and again at time 2, and then the monitor wakes up again and checks the value at time 3, then it will have no opportunity to see the value the global had at time 1
You might use a queue to make sure that all values get consumed.
 
I actually don't need all the values to be consumed. The issue at hand is a feed of changes to the order book. So a state of the order book is kept every time a message is sent in the feed. Now I have a class in a separate module that needs to check the order book once every 5 seconds say. So I think having a class that keeps the ob state and passing an instance of that class to my other checkes class that does the checking should be sufficient.
 
9:13 PM
hun. Generally speaking, on a scale of 1 to Trump telling France what to do, how bad is it to let python GC close cursor and database connection, if that even exists?
#wildScales
 
wim
9:42 PM
thats lame, use a context manager.
 
^that
context managers FTW
 
^^ +1000
 
^^^ bandwagons are cool
 
00:00 - 22:0022:00 - 00:00

« first day (2977 days earlier)      last day (1954 days later) »