« first day (3064 days earlier)      last day (2109 days later) » 
00:00 - 19:0019:00 - 00:00

19:00
so that would put sound.views.config.config into the sound.views namespace as sound.views.config, yes?
so sound.views.config is no longer a module; it's a name imported from within sound/views/config.py (which might be a module, but probably isn't)
Martijn's deleted answer has a bit more hints perhaps
what!? there are stack exchange secrets i can't see :(
they're deleted for a reason :) it's mostly redundant with the existing answer
yeah. i follow the style guide pretty closely—but i believe the styling for function names is the same as the styling for module names
(so importing a function would run into this problem, but not necessarily importing a class)
19:03
So I understand the issue, it's what I concluded myself, I just didn't make the connection. The problem is that the name sound.views.config refers to something other than the module sound.views.config. Confusing!
yeah haha. so far this is the only problem i've run into w/ having each thing in its own file
You're not seeing the problem because you have many submodules that get pulled into a common namespace by __init__.py. You're seeing the problem because you're importing foo.foo as foo where the first foo is a module and the second foo is something else.
the only time i put multiple functions in the same file is when one or more of those functions will only be used by other things in that same file
oooh
yeah
if you named your objects inside your modules differently (foo.bar) you'd still have access to foo to patch it
importing foo.bar might even pushfoo itself into the namespace automatically, I'm not sure but it's easy to check
oh, yeah. it's a problem i totally run into voluntarily. i just don't want to name my objects differently :D
so far the cases where i need to patch that specific thing are pretty few and far between
19:11
When I said "Having lots and lots of modules is a pain because then you have to think up lots and lots of module names", one implication was "... And this is painful because the names must not conflict with the names of other existing objects". QED.
If you have two things named foo, and one is overshadowing the other, then maybe you should instead have only one thing named foo
if a function has its own file, i just name the file the same as the function. (like, if i'm defining a function 'foo' in its own file, it seems weird to me to name the file something other than 'foo')
'foo.py'*
I think "use this weird sys.modules lookup" is a fine match for "I insist on doing it this way"
it's not that horrible, just unnecessary if you could do it differently. If the design stays you're stuck with that inconvenience.
What does patching do? Can't you apply that to the function instead?
I can think of one instance in the builtin modules where the module has an object that's the same name as the module. It's datetime.datetime and it's a neverending headache
sure, i'm not disagreeing. it's a problem i run into so infrequently that i don't mind not changing the whole structure just to avoid said [infrequent] problem. :p
19:19
(patching basically overrwrites a function when you're testing. so if i'm testing a function that looks like:

def foo():
if a:
run_function_1()
print('done')
when i'm testing foo(), i can patch out run_function_1() and replace it with pass (or something) (say, in the case that it's a huge involved function that already has its own testing)
so...you're basically mocking run_function_1
by the way here's a guide to formatting multiline code in chat sopython.com/wiki/…
hmm, I see, and you want to affect a global name where the function is defined
oh awesome. tyty
hmm, yeah, with my non-existent testing experience I can say that your problem exists ;)
haha
you should be a mathematician ;D
I'm a physicist... :P
which means I can give you a solution that will ballpark work... :D
19:26
hah
I interpret your viewpoint as "given the choice between 'not having to refer to sys.modules' and 'organizing my code in a way I deem logical', I choose the latter". That is a valid ordering of priorities.
@Kevin Indeed! There are plenty of SO questions caused by datetime confusion. Other minor contenders are pprint.pprint, time.time, & random.random, but they aren't so bad because they're functions, not classes.
Hot take: random.random should be confusing to access, because 99.9% of the time you should be using something else
Python tries to give you some latitude to organize stuff how you want to. I suspect this is partly in response to how Java forces you to organize stuff the Java way.
I see a lot of new users unnecessarily doing more arithmetic than required. You don't need x = seq[random.randint(0, len(seq))! x = random.choice(seq) works just fine!
I don't think I've seen x = seq[int(random.random() * len(seq)] yet, but it's only a matter of time
(don't @ me about fencepost errors in the above code samples, they're in there for the verisimilitude >_>)
19:44
@Kevin Fair point.
You don't often see people creating instances of random.Random, but it's great if you need independent random streams. Another of my faves is random.getrandbits.
20:00
Another reason to instantiate random.Random is that by using an explicit instance (rather than the default one that the module's functions use) is that it makes it easy to swap over to using random.SystemRandom when you want seriously random numbers. So during testing you can get repeatable random numbers, but for actual work you get the best randoms your system can supply.
Only the finest randoms for me. Grass fed, free range, GMO free
@AndrasDeak I see you work with spherical cows in vacuum.
20:18
Humans can decompress in a near vacuum to twice their volume (the "twice" part I'm struggling to verify but I did read it somewhere) and potentially still survive. Spherical cows in a vacuum could potentially be spot-on for dealing with space farm disasters.
Mathematicians won't be laughing then
I mean, you have less than the 11-13 seconds to get things under control than Chernobyl had, but they just need fast disaster recovery methods.
You'll only remain conscious for 10-15 seconds, but if you're rescued within 90-180, you should be able to survive. It'd suck, pardon the pun. Full-body hicky, including your eyes. Capillaries? Who needs 'em, right?
Reminds me of a scifi story I read that took place in the span of one second. It chronicled an AI becoming aware of an asteroid impact that would eradicate all life on Earth, and the execution of its disaster recovery plan.
15 seconds is a luxury in comparison
Well, also certain "rules" to remember. If you're about to lose pressure, don't hold your breath. Just don't. Gah, I'm getting flashbacks to classes and the description. Related to "raspberry jammification" (the opposite problem; losing pressure in a hard-helmet dive, e.g. by hose getting cut — yes, most of a human body can fit in a helmet, at least, most everything except your bones).
15 seconds would have been a luxury for Chernobyl to be fair. We had to study it as part of my engineering course. Two antagonistic safety mechanisms both pushing to the extreme and a misleading sensor (the cooling water was vapourising and keeping the pressure gauge normal despite there being almost no cooling water). By the time the alarm tripped... no chance. Lots to be learned all round, even outside of chemical engineering.
qntm.org/transit. Ok, I exaggerate. Only the first six paragraphs are within the first second.
20:28
@roganjosh They learned that safety features need to actually be safe. The scuttling procedure caused a massive burst of radiation and massive increase in core temperature.
@amcgregor Yeah, I bet it'd be very hard to exhale as deeply as you can, but that's what you've gotta do.
@Kevin Thanks! Bookmarked.
@amcgregor I don't think we'll ever get there properly. The Trolley Problem comes up now a lot with autonomous cars. There are some situations unavoidable and now we have to design machines to decide who dies
:calmly follows procedure: :all hell breaks loose: :can't find a procedure to handle a failing procedure:
@roganjosh There's a difference between a pre-planned procedure to return something dangerous to stable status, and an emergency split-second choice between two bad outcomes, though.
20:34
@amcgregor did you ever hear the recording of the guy that landed the plane in the Hudson river? He got a load of flak about how calm he sounded as the plane was coming down and he decided to land in the river. That was utter yam. How he kept his nerve is beyond me, even if you talk about all the Air Force training he had. They bumped up closing some vents on the crash checklist after that because the plane could float longer...
... but he didn't get that far down the checklist, despite knowing it was going to be a problem
Airline disasters are one of those things I have extreme confidence in, though. When something goes wrong, they find out why and ensure it can't happen again. E.g. the autopilot of a certain Airbus craft would assume a human operator knew what they were doing, and had a good reason, so if it detected a control being manually operated, it'd back off automation on that control.
Seems reasonable. Until a pilot let his nephew into the pit, thinking autopilot was engaged so there'd be no harm he could possibly do. They crashed into the side of a mountain, all hands lost, after manipulation of the stick.
Now that craft has a loud warning you must manually disengage (far away from the control you might be manipulating) when any aspect of automation becomes disabled.
I guess the point that I'm making is that it's always iterative. Chernobyl just came earlier in the timeline. The operators were complacent, I guess the designers less complacent but with less precedent to judge by
There have been autopilots that misinterpret the pilot and put the plane in such a turn that they can't physically overcome the G force to grab the controls. I guess that's one way to make them "disengage" :P
I appreciate calm in my experts, though, and I expect training be provided to allow calm. Landing in Montréal one winter, compete white-out blizzard conditions, we aborted the first landing (turned out there was a maintenance truck in the middle of the runway… that our pilot only saw within 100m of the ground…) and on the second landing, the cabin erupted in applause.
I turned to my neighbouring passenger, "You do realize the pilot wouldn't be allowed to land at this airport if he weren't trained on how to land in it safely, right?"
"ensure it can't happen again" is an impressive achievement. I can't even write a Fizzbuzz implementation that guarantees that each bug will happen only once.
@amcgregor sadly it seems that Joe Public would often like them to sound a hysterical wreck in order for them to understand the situation
20:43
They want clear indication of fallibility so as to more easily assign singular blame. Humans do love to see heads roll.
Meanwhile, you have to bribe Joe Public with money in order to get chaotic scenes to test plane safety because people have become so used to drills that they form orderly queues to get off the plane unless there's some reward and a leaderboard
Sometimes I worry that if I ever get falsely accused of a crime, then the all-neurotypical jury will find it deeply suspicious that I don't exhibit the emotional responses that a normal innocent person would have. #JustSpectrumThings
Just get in the habit of pulling out your phone to film the whole thing, regardless of whether you're interested in the footage
Damn, Kevin, I resemble that remark. (Doesn't help I have an inappropriate and very dark sense of humour, either. My quips are almost always off-putting to normies. ;)
You both based in America? Is Black Mirror a thing over there?
It's a series by Charlie Brooker. I never know what from the UK ever makes it to US screens
20:47
I didn't watch Black Mirror because the episode synopses I read all sounded like "what if technology... was bad"
Indeed, Black Mirror is some pretty good stuff. OPEN YOUR EYES, OPEN YOUR EYES, … XD
Heh, from ~1 year ago: Doctor: "Your brain pressure was highly variable, so we had to install two different sensors to get accurate results." Me: "Ah, up and down like a whore's drawers, then, eh?" Doctor, to my sister: "Uh… is she normally like this?" Sister: (looks up from book) "Yup, that's Alice all right."
@Kevin White Bear is always an episode that pops to mind that really makes you sit and think.
Like I know the production quality is good and it's all very prestigious yadda yadda but it's got a strain of pessimism that I find unconstructive
I appreciate that, for science fiction, it isn't the science that is the antagonist (e.g. rogue AIs, etc.), it's natural human behaviour, in many episodes.
Science and technology is simply the mechanism, or facilitator of the evil of other humans.
Doing a quick mental scan, all of it is human nature but I could be wrong.
None of the AI goes rogue that I can recall, it's always human intervention
20:51
Or social pressures, or…
Se so.
I'm enough of a pessimist or nihilist myself that I also strongly appreciate that the attempts at positive action are astoundingly twisted towards evil by that social pressure.
In many ways, and many ways that get caught by the media, but life is not all like that
This is the impression I get: people watch Black Mirror and think "mind uploading can lead to some bad outcomes. Maybe we should halt research on it". But nobody watches Friday the 13th and thinks "machetes must be banned"
And, in many ways, I see Black Mirror as a rebuttal
@roganjosh Precicely. It explicitly points out that it's not the technology, it's how we use it. That we can't be trusted to use these things responsibly.
@Kevin then you have got a wonky view on Black Mirror. It's not like that at all.
But it may very well have been poorly reviewed in terms of its agenda
Black Mirror comes from screens. i.e. the reflection we get from looking at a blank screen. It's about the human psyche, not what the technology itself does (the black mirror only exists when the screen is off)
21:00
If you're saying "people that watch Black Mirror don't get the impression that technology shouldn't exist, possibly because we can't be trusted to use it responsibly", I direct you to the post directly above yours ;-) If you're saying "ok, maybe some people think that, but they didn't interpret the subtext properly and that's not what the writers intended the takeway to be", I'm willing to believe that.
Fun directorial similarity: 2001: A Space Odyssey. (Spoiler: the monolith is your movie screen, and the old-man-in-bed scene is actually two-dimensional. He wakes up when he realizes it and touches the monolith in those two dimensions, despite the illusion of depth.)
Have we upset you, Andras?
Kubrick did
I'm… sorry to hear that. He was a renowned ass, of course. (Oh, the tales of giving out maps to the hedge maze on the set of the Shining, only to scramble it half-way through the day. Shouts out of the maze of "Kuuuuubriiiiick!" were not uncommon.)
21:06
<wipes brow> Can't apologise for him
well thanks for nothing
ummm, a totally unendorsed apology from Kubric; "I'm slightly sorry but not.". Does that make things better?
no, but I appreciate the effort
I wasn't really given much material to work with re: apologies
I'll never get back the time I spent watching The Shining (two hours) and Space Odyssey (30 minutes)
21:17
Well, we also have Physicists to thank for Mr Nobody and I'll never get my time back from watching that
not familiar with that one
One of only 2 films I've watched where I had no yamming clue what was going on at all, but I can't cope with vague understanding while I'm watching a film and I think there were something like 16 storylines
A film about how every binary choice splits reality
So each decision leads to a new pathway, and they cram it all into a film and you're supposed to follow characters by the colour they wear etc
Have you seen Primer?
I strongly suggest watching it :) It will eventually enter your list as a third one, but not in an intrusive way.
21:22
I actually really like (relatively) complicated films, I just need to be able to keep a grasp of what exactly is going on, and Mr Nobody was an IMDB recommendation based on other films.
Here's why I watched Primer (bottom right)
I... will subject myself.
@AndrasDeak I've intentionally exposed myself to Manos: The Hands of Fate (1966) four times. Arguably the worst move ever made. (7% Tomatometer, 1.9/10 w/ 33K votes on IMDB) One of the rare movies where the MST3K (RiffTrax) version is the polar opposite: 9.2/10.
I highly recommend exposure at least once. So you can understand the true meaning of "excessive driving scene, so excessive, they played it forwards, than backwards, hoping you wouldn't notice".
I'm not one for old films, at all, but to suggest that a film in the 1960's, where they were actually trying, is worse than something like Disaster Movie is bold
Disaster Movie knows what it was trying to do. Manos… not nearly as much. The poor actor they had playing Pan (yes…) they strapped digitigrade leg attachments to; he had such difficulty standing, they gave him a staff he's literally clutching for dear life in every scene.
21:32
8 weeks of solitary confinement while I stayed behind in a student area over Summer, the only resident on the street of 80 houses, drove me to watch that when I went for a DVD. I'd rather have chatted to the tramps rummaging through our bins.
@amcgregor that sounds more like a Troma film. Seen poultrygeist? :P
Alas, no, but added to the list! :D
It is... special. Troma films were so low-budget that they replay footage of a single car explosion in multiple films, regardless of the car model
@roganjosh there's a movie with the coat hangers and the exploding birds... Birdemic? That and Rubber are the two very-bad-movies a gourmet friend of mine often mentions in this subject.
Then there's Skinned Deep, which I have no words for. I used to really love diabolically bad horror films just to let my brain melt after work
@AndrasDeak It doesn't ring a bell sorry. But it really wouldn't have been out-of-place on our watch list.
Mammoth comes back to me now. Spoiler alert: the mammoth gets frozen by puncturing a tank of liquid nitrogen. It ends with "The End?". I really should follow that up. This 30 ft mammoth had a good run though, suddenly appearing from no where and goring people. Apparently they were surprisingly spritely on their feet and their camouflage was military-grade
21:48
@roganjosh Even with a budget, directors still re-use. Like, Michael Bay has basically no excuse. (It almost makes sense from a "cost per minute of completed film" perspective, but just no.)
So many great terrible's mentioned; my list of movies to watch has alarmingly grown.
I think Troma films are on a slightly different level of re-use :P But now that I think about it, Mammoth (which I don't think is Troma, but on the same level) was way ahead of its time on Global Warming issues. I mean, do we really know whether 30 ft mammoths will re-animate? There was another film (I forget the name) with a 500 ft shark that defrosted and could take out jumbo jets. Bet they don't have that in their safety procedures.
Mega Shark vs Giant Octopus
Does what it says on the tin, really.
I'm not worried so much about complex life re-animating out of the permafrost or sub-surface antarctic lakes, I'm worried about the extremophiles no still-living creature has an immune response for.
For very serious.
If you're going to make a movie about it, you better do a good job of it
They did, and it was remarkably good. The Andromeda Strain.
Low-budget "horror" movies have a place in my heart because they know they're bad. Then there was one Godzilla movie remake I watched where they tried to make it seem serious and it ended up more ridiculous to me
21:56
(Not about global warming per-se, just an extreme unknown infectious disease of a kind never seen before.)
Nuclear weapons being transported by train across the US because apparently these beasts were attracted by radiation... Godzilla swims right past a US Nimitz-class aircraft carrier. It was stupid because it came across as trying to get some details correct.
@amcgregor I think it's unlikely that such a thing would actually happen (certainly possible). It's less likely to be an issue than our own flippant use of antibiotics
whichever way we're going to exterminate ourselves we'll definitely have had it coming
@roganjosh Some interesting progress, there, actually. We've identified how bacterial cells signal population density to each-other (as a natural suppressant of division), and can now forge those messages to force infections to become manageable by the immune system. That, plus we've utilized machine learning to build patient-customized antibiotic regimes that can reverse resistance in already-resistant bacteria, and/or prevent it from developing.
@amcgregor no financial incentive to develop
Hard to sell a cure that isn't. Enjoy your stockpiles of useless amoxycillin. So there's that financial incentive.
22:08
Research grants are great for this kinda thing, but industry won't scale-up unless it's economically viable. It's ball-park $1bn to get a drug to market, and the bill has to be footed by the company
There are already practical, approved drugs out utilizing these more recent techniques.
See also: interferon.
That's not in mass-production
It's also not a drug
It's a category of mechanism used by a number of drugs. Same for the bacterial signalling protein, which is essentially the same mechanism as interferon.
(They're just bizarre little linear chains, where the length determines the meaning of the 'message'. It's really neat this low-level.)
That doesn't matter. I'm not trying to shoot you down; the reality is that it is not a drug and it will take over a billion dollars to take the principle to market
If amoxycillin is effective in 50% of cases, it can still be proscribed in 100% of cases
There is no loss of sales to the pharma that makes the drug. The tipping point is different to just pure efficacy.
It is a series of drugs. (Sure, they also have trade names.) medicinenet.com/interferon/… — they have been developed, they have been approved, they have been deployed to great effect.
When your current solution ceases being effective, you can't continue to sell your ineffective solution and must develop an effective one. I use "must" and whatnot, and sure it's optional, but that's the path to organizational failure and bankruptcy, not success.
22:18
Your solution only has to be more effective than the one on the market
Most orgs have a fiduciary responsibility towards their stakeholders to not seppuku like that. ;)
Things are not so clear-cut in the pharma industry
@roganjosh I'm glad we (seem to… indirectly) agree that there is pressure towards the development of effective replacements for progressively less effective current solutions, even if only "slightly more effective". (Though the mechanisms we've been working out are superior in a number of ways. Targeting being the big win. Most antibiotics are shotgun machine guns, not scalpels.)
seppuku would be following a dead lead to market and sinking an awful lot of money
Or arbitrarily raising the price of a medication without need or prompting. :coughpharmabrocough:
;^P
rhubarb
22:22
@amcgregor this may be the one topic I actually have an upper-hand after I have to keep going back to research over your suggestions in coding :)
Will an lre_cache value be garbage collected it's called on a class inside a function that returns a value? More specifically, I have an api webhook. I take a small amount of data from that webhook and process it in a class and there's an expensive peewee function I need to through the processor class' methods.
I spent many years in malaria research and know a lot about what big and small pharma is doing about that problem, and got an understanding of how this industry works. It is, sadly, not quite as straight-forward as it should seem.
@litel I'm not clear on why this is to do with peewee. Wouldn't the web route cache the result?
I bound it to a @property call but I realized that it was calling the peewee function each time I access the value.
What is the web framework?
Also, I assume lre_cache is lru_cache?
@roganjosh Flask + Peewee microservice to collect messaging (whatsapp etc) from service or send data to texting service. we pass the text and user id to our db and perform expensive statistical operations and such. I'm trying to refactor, everything is in init for the processor class.
@roganjosh Yes.
22:31
in JavaScript, 5 mins ago, by JBis
anyone know if this is a standardized format of data? If so what? http://vatsim-data.hardern.net/vatsim-data.txt
@litel so would this not fall in flask caching? Your issue is that you want to cache a result on a per-user basis?
@litel You could use a session to store the object against the user, but not a standard Flask session. My research suggests that you can use any session other than the default and the data would be inaccessible; I use a regular file storage for flask-session but you could use, for example, Redis. I believe that is safe storage for data, but you'll want to check that if there is any sensitive data
@roganjosh That link says it's not for production. I want save expensive SQL operation we perform when we intercept data from webhook. We have one request daily from the user so I don't need to cache beyond the class which is called from the Flask view.
Safe in terms of not being accessible to external attackers. My app runs on an intranet
@litel Yep, so I followed it up with comments about sessions
It's not an intranet app. It's actually really more of an API I should say.
Ok, but if the endpoint is exposed online, I can't say for certainty that the session is safe (and we're not talking about the default Flask session here). But I think that's what you ultimately want, not an lru_cache or a Flask cache
22:43
We check signatures before anything is actually processed and that seems robust enough for us.

this is the structure:
view
- processdata(request)
--init
---make expensive db operation
--- python function to compute thing with data from db operation
---another python function for more processing
---python function for more processing
---we send a message to external api based on result of these functions
Put another way, I'm suggesting use https://pythonhosted.org/Flask-Session/ with some storage mechanism, and just giving a caveat that I can't guarantee that the data is 100% safe but my research makes me believe it isn't exploitable.
ofc, Redis comes with its own caveats of how it might be exploited, and you could leave your app open in other ways to exploitation, but my understanding is that a well-designed app will not allow hackers to access data stored in another user's session if it is stored with flask-session.
There's currently no Flask code in the processor class. I'd kind of prefer it I can keep it Flask free for reasons of portability and such. Flask Session feels more like something where there is a tangible user on the other end. Our other users are other APIs. It's not user-facing ever. We use Redis as an interservice message broker in tandem with some other stuff, and I don't really want to mess with that logic seperation.
Maybe there is a similar plugin for API. I understand your problem fully now, and I don't know how to proceed sorry.
@roganjosh Thanks for trying to help. I'll just experiment with lru_cache and see how that works.
Actually, I don't. So you have a non-facing API that you want to cache the result for? What if 1 member hammers your actual API with requests, but you also want to optimise for the once-per-day user?
22:55
No we have several hundred actual inbound webhook requests and several hundred outbound API ones. For each of the inbound requests we have to do xx processing and we pass that along for an API. There is one inbound/outbound request for each user. If it were one user, I doubt we'd even use a microservice and we would just roll this into something else.
But with a cache you wouldn't have to pass the inbound request to your processor, so would it not be easier to have the API have some cache?
@JBis probably proprietary? You can try asking the maintainer github.com/tdawe/vatsim/blob/master/spec/vatsim-data.txt
@roganjosh The requests are different (not unique just different) for each user and different each day.
I think we're getting wires crossed. In my head, the lru_cache will be independent of the inbound requester but having the API identify the inbound user would allow a personalised session
@roganjosh It's a webhook, we can't really do that specifically alas. We identify the user in the processor.
23:00
I also think this might be violating RESTful at the same time
@litel Interesting problem. I definitely can't speak with any authority at this point. I'll be interested uif any others weigh in :)
Hey guys, I have a (hopefully) silly question: Does anyone here know if I can specify/marshal *multiple* data formats for the same API route? If so, how? I've looked at the Flask-Restplus docs, but they focus on 'simplicity', not thoroughness, so they haven't been helpful on this.

The background for that question is that I'm working on a REST service using Python3 and Flask-Restplus (FRP for short). One neat thing FRP does for you is transform database models into serializable JSON objects via marshalling with another 'model' object that describes it. For example, @namespace.marshal_list_w
23:56
hey guys, lets say I want to add a new column of data to like 20% of my panda dataframe pd and leave the rest blank. I have a dict that has the values to append with keys that correspond to the index of the pertinent dataframe row. What's the method I am suppose to use to add these particular entries to the dataframe.
If I need to then I can assign None to all the other rows but I was curious about just assigning a few values (loop over my dict and add as opposed to loop over the frame and add)
pandas
yea, this is a pandas dataframe
You said panda :P
since it was only one dataframe, but okie
singular -> dataframe
plural -> dataframes
00:00 - 19:0019:00 - 00:00

« first day (3064 days earlier)      last day (2109 days later) »