« first day (2572 days earlier)      last day (2601 days later) » 
00:00 - 18:0018:00 - 00:00

18:00
Reminder: as unpaid volunteers, you are entitled to stop worrying about a question the second that it ceases to be fun for you. This is something I often have to tell myself so I can let go even when someone is being Wrong On The Internet.
12
Not to discount the grungy satisfaction of watching a train wreck unfold...
I'm not worrying. I enjoy helping people to improve their answers. But quite often, after I point out the flaws in an answer, the author simply deletes it rather than fixing it. And that can even happen when I've hinted at how to fix it.
I know that feeling.
Forge onwards as you see fit, but remember where the ejector lever is
Hmm, that's the third Stranger Things related image I've seen on imgur today. Maybe I better lay off until I can catch the final three episodes.
@PM2Ring a teacher can only offer to improve a student, they can't force them to change. :\
I don't think this should've been closed as unclear. stackoverflow.com/q/47022144/4014959 It's pretty clear what the OP wants the code to do. OTOH, the code shows that they really don't know what they're doing, perhaps they cargo-culted that code. Or they were given that code in the assignment itself and they're supposed to fix it. But if that's the case, it's got a broken type signature.
Maybe it's the kind of Unclear where the winking justification is "I know you can't just be asking 'how do I make this code satisfy the requirements?" because that would be hopelessly broad, but I don't know what else you could be asking either, so I'll put down Unclear"
AKA doesn't show minimum effort 2: electric boogaloo
18:15
Quick question: Is there a way to make scipy.optimize.fixed_point return the last iteration when the maximum number of iterations is reached?
@Kevin I was thinking "Lacks minimal understanding"
@user76284 Perhaps you could decorate your function so that it records everything it returns in a global variable that you can check later?
def record_answers(func, seq):
    def f_(*args, **kargs):
        result = func(*args, **kargs)
        seq.append(result)
        return result
    return f_

from scipy import optimize
def func(x, c1, c2):
   return np.sqrt(c1/(x+c2))
c1 = np.array([10,12.])
c2 = np.array([3, 5.])
results = []
optimize.fixed_point(record_answers(func, results), [1.2, 1.3], args=(c1,c2))
print(results[-1])
Something like that idk
18:31
What does it return?
I think I'll just write my own fixed_point :/
What does it return when it didn't converge?
It raises a RuntimeError
I'm just gonna use

def fixed_point(func, x0, maxiter=500):
for n in range(maxiter):
x = func(x0)
if numpy.allclose(x, x0):
return x0
x0 = x
else:
return x0
@user76284 ah.
Kevin I'll get back to my message when I'm on my laptop
@user76284: That's quite different from how scipy.optimize.fixed_point searches for fixed points.
18:37
I know, it uses an accelerated method.
I wish it had a way to handle the error gracefully
Hmm, the RuntimeError contains a message that states the last iteration's value
But it's in string form, so I'd have to parse the array out of it? e.g.

RuntimeError: Failed to converge after 500 iterations, value is [[ 0.08 0. -0.02 -0.66]
Pumpkin!
def record_answers(func, seq):
    def f_(*args, **kargs):
        result = func(*args, **kargs)
        seq.append(result)
        return result
    return f_

def fixed_point_or_closest(func, *args, **kargs):
    results = []
    try:
        return optimize.fixed_point(record_answers(func, results), *args, **kargs)
    except RuntimeError:
        return results[-1]

from scipy import optimize
def func(x, c1, c2):
   return np.sqrt(c1/(x+c2))
c1 = np.array([10,12.])
c2 = np.array([3, 5.])
result = fixed_point_or_closest(func, [1.2, 1.3], args=(c1,c2))
"Works on my machine" certified
Never mind that I'm pretty sure the example function I copy-pasted from the scipy documentation probably doesn't trigger a RuntimeError, so the actual code path we're interested in testing doesn't actually get traversed
@Kevin so, spinning objects are likely to fly off in a random direction that's within their rotational plane, in case they fall apart. And depending on the materials in the spinner they probably don't have too much inertia, but a ball bearing zipping around is probably not what makes NASA the happiest
During the 0:33 segment he mostly pushes the spinner towards and away from the camera so I thought maybe that was the axis that has the least resistance for changing direction
that's the axis that doesn't bump into your finger leading to unpredictable rebound
if the spinner were to fall apart, the pieces would still fly mostly along the rotational plane
18:53
So if the axle was long enough that you could push on it from any direction, it would move laterally without complaint? I am willing to accept this.
Ehm, I'd have to think about it
Yeah, I don't think it would mind a lot. What resistence there is, is with respect to rotating the spin
I think I was making an incorrect analogy with the phenomenon where a spinning top resists falling down. But this is more like moving a top along the top of a table, which I imagine is not difficult
so you can push it in any direction to give it translational momentum, what would be problematic is spinning it around
@Kevin exactly
A better analogy would be to try to change the axis of rotation of a long-axled spinner
to be specific, the rotation of the angular momentum vector is related to torque
if you push it around, the angular momentum vector stays put
if those astronauts took the spinning spinner and carefully flipped it upside-down, they would start spinning themselves
18:57
@GhostlyMartijn I had to buy a bag of Turkish peppers myself :F
upside-down as in "swap the axis of rotation upside-down"
of course with your usual spinner the change in angular momentum for the astronaut is negligible
I was wondering if the sweet flips they were doing was somehow harnessing the power of the spinner, but you're making it sound like the magnitudes don't match up that easily
@AnttiHaapala There you go, now we are even again.
DSM
DSM
I just picked up my bus pass, and as it does every month, it has a sticker on it saying "Valid only when sticker removed". I removed it. On Chestertonian grounds I'm inclined to give it the benefit of the doubt, but I have to admit I don't know why it's there in the first place.
What did you do with the sticker then? Did you put it on the ground? You fool, you've invalidated us all
19:06
@DSM so that they don't sell it without the sticker
DSM
DSM
I suspect these are deep waters I'm wading in. Perhaps they're best left undisturbed.
in any case, all of finland has been using only RFID smart cards for 10+ years
@DSM wow, so those even have the printed month omglol
Read that as "all of finland has been using only 10 RFID cards for years". First bicycles and now this
:D
so, I need to pay 3 € for a new card, topups online, incl. monthly tickets that start from first validation
@AnttiHaapala Pretty much the same in parts of Australia - you can buy single-use paper tickets, but they're more expensive and much less convenient.
19:23
@Kevin not even close
roughly sum(mass*rotational speed) is constant
What if they sapped the rotational energy of 500 spinners one after the other
they probably did :P
A big pile of spent spinners just off camera the whole video
(can you have piles in space? No matter)
some of them don't rotate in the right direction, though
DSM
DSM
Good news, everybody! My switch to gunicorn deployment seems to have worked. The stuff which I thought would be hard would be easy, but I spent most of my time trying to figure out why logging was misbehaving, which I hadn't thought would be a problem at all.
Nice work. The world has one less problem in it now.
Somebody post an inspiring quote about the inevitable triumph of light over darkness, please.
Hmm googling "light over dark" just gives me a lot of advice about painting the walls of my home. Useful, but not topical.
DSM
DSM
(polyphonic choir) ♫ et lux in tenebris lucet ♬ et tenebrae eam non conprehenderunt ♫
There we go.
I only understand lux and tenebra in that verse
Likewise, although I might make an educated guess on "conprehenderunt"
19:40
yeah, comprende
Assuming they're not false cognates, I wonder how the N mutated into an M
we have that kind of assimilation in Hungarian, where some consonants get somewhat mutated for ease of pronunciation
some of those are only verbal, some are reflected in writing
en.wiktionary.org/wiki/conprehendo#Latin To answer my question, both forms existed in Latin.
I'd guess either con- was the original, or it was reverse engineered to contain con-
DSM
DSM
It seems to depend on whether or not the following consonant was -b-, -p-, -l-, -m-, or -r-.
19:47
Reminds me of an amusing picture of a medieval-ish looking font where 90% of the letters look like "n"
Which I am unable to find at the moment
Take this as consolation
(or should that be comsolation?)
I've been learning Russian through Duolingo.
They haven't taught me that lesson yet :'(
Hopefully it's like regular cursive where you only really need to sign your own name, and even then it can be illegible
Took me a while to figure out the last word, that third letter is barely legible
DSM
DSM
Wait, what? That's not just a joke? That's actually what cursive Russian looks like?
Or can look like. I'm sure they found the most exaggerated case.
20:04
I'd say this looks like the canonical Russian cursive, but very few people can write like that
or read it
I was taught that in Russian class
Can you read what it says ?
well I could deduce them letter by letter given enough time, because I forgot most of the little Russian I knew so I have few hints left :D
If I'm 100% certain I've caught some malware, is there any point on trying to install a new antivirus and using that to get rid of it, or should I just reinstall windows? :/
20:14
second row seems to be "lishishsya, slyshish"
@WayneWerner I feel like they picked the least readable words for that picture. In general Russian cursive is readable
assuming the former makes any sense
huh, those slanted lines are neat
See "How to move on" if you don't want to answer — Steve 24 secs ago
Lol ^
20:16
@Rawing if you are paranoid, nuke it to orbit, if not just use malwarebytes to see if it can remove it
@AndrasDeak it does
@cᴏʟᴅsᴘᴇᴇᴅ wow, that "how to write a good pandas question" you linked shouldn't even be on SO main
@vaultah thanks
I wonder what kind of response I would get with my copypasta
It's okay, the person who answered the question is a pandas core dev, so he gets a pass
nobody gets a pass :P
I'm just saying that 95% of that question belongs to meta.SO
@MooingRawr alright, I'll anxiously twiddle my thumbs until this system scan runs through
there are a lot of questions that you could consider unfit by today's standards, from back in the "glory days" with a lot of upvotes
the worst of those should be under a historical lock
Fair point, I flagged it and requested for a lock
shrug :P
this question doesn't really need additional info in time so locking it should be straightforward
20:28
afternoon cabbage
@vaultah Is handwriting still taught in your country?
@davidism, I got a question for you; have you ever used this method to declare types of models?
@Code-Apprentice yeah
@vaultah In the US, handwriting is becoming a lost art form. I don't have any kids that age, but I hear that cursive is no longer taught in elementary schools.
20:37
@corvid You mean changing the base model? Yes.
@Code-Apprentice In my area, it is not.
Yeah, I wanted to apply updated_at and created_at fields to all tables unless otherwise specified -- is this the right approach, or simply a mixin?
I'd do that with a mixin, like the page says in the next section.
20:43
@davidism :)
21:02
Oooh shiny. I can now see review queues.
History (Python 1.2 Tutorial): ir.cwi.nl/pub/5009/05009D.pdf
5
*archeology
"The keys of dictionaries are no longer restricted to strings"
wim
wim
21:31
does functools.lru_cache do the right thing when used on methods / properties ?
I used to use cached-property but could drop the 3rd-party dep if the stdlib implementation does the right thing ..
What is the "right thing"?
wim
wim
caches with arguments inclusive of "self"
and invalidates the cache correctly
@wim Be very careful about that.
@wim I tried to use it on methods, but 'self' is usually mutable, and using it with mutable arguments is a recipe for trouble
If you make sure you don't store any state in 'self' you can do it, but most objects do have state.
I don't know about properties.
wim
wim
22:04
hmmm
okay I think I will avoid it. even if they use the memory location of the instance in the memo, even that's not safe because memory locations can get reused.
instead I'll write a descriptor that replaces the property with an instance attribute on first call
22:23
Am I missing something? From lru_cache's perspective self is a parameter like any other, so as long as your class doesn't have a weird __hash__ function, I don't see what could go wrong
@gerrit properties are just syntactic sugar over a method. - So same caveats.
I have used lru_cache with success, simply by making objects "non mutable" (as far as the public interface concerned, lru_cache in itself could be considered mutating the object)
@Rawing lru_cache checks for simple "equality", I think by indeed checking the hash.
but consider a simple method:
@lru_cache()
def myGetter(self):
    self._i += 1
    return self._i
ah, yes, if the object has state then caching is obviously not a great idea
I'd be wary of using lru_cache with methods because the cache can keep otherwise-unreachable objects alive forever.
Although that does apply to all uses of lru_cache.
@Rawing unless the state is immutable :P
@user2357112 Why would it? If an object has no references by active code anymore it can be cleared by the garbage collector. I don't see why the lru_cache would keep the object alive - no more than a local variable would keep the object alive
@paul23: Because the cache has a strong reference to the object, and the cache is strongly reachable.
22:38
@user2357112 the cache is only reachable from within the object
Or well from the enclosing scope where the cache is used.
@paul23: ...what? The cache is reachable from the method that uses the cache.
the cache lives in the class, so as long as the class exists, the cache and everything inside it exists as well
In the end it's just similar to (not checked for syntax errors):
def myFun(*args):
    t = tuple(*args)
    if (t in myFun.myFunCacheDict):
        return myFun.myFunChacheDict(t)
    answer = docalculations(*args)
    myFun.myFunCacheDict[t] = answer
myFun.myFunCacheDict = {}
if myFun goes out of scope, so does the dictionary
And I think it hashes the args and just stores that. Can't find the details about that though
...and when exactly would this thing go out of scope, unless you defined the function inside another function or something?
class myClass():
    @lru_cache
    def myFun(self): pass

def outFun():
    c = myClass()
    c.myFun() # store

outerFun()
# c can be released as the only live references are circular references (and thus the LRU cache also)
22:52
The cache is not attached to the instance. The cache is attached to the wrapper created by the lru_cache decorator. The references preserving the objects are not circular.
I fail to see why the reference is not circular: the wrapper is only referred to inside the class, and the wrapper refers back to the class.
The class is reachable from the Example global variable, or myClass for the class in your snippet.
You can throw in a bunch of gc.collect() calls everywhere if you want.
23:13
Hmm your code would still startle me then: why would it "clear 1 (first) cache before exit"
Default cache size is 128. Once my example calls the method on a 129th object, the cache evicts the first one based on the LRU policy, and that object finally dies.
Is there any documentation regarding the internal representation of a Pandas DataFrame, or the performance of operations that would depend heavily on the representation? I can't find anything.
DSM
DSM
23:30
I don't know how much has been written up. Most of the performance specs are determined by the fact the data is blocked by columns of the same dtype (look at BlockManager, df._data).
00:00 - 18:0018:00 - 00:00

« first day (2572 days earlier)      last day (2601 days later) »