« first day (3720 days earlier)      last day (1221 days later) » 

9:12 AM
cbg, all. Just getting to the end of a four-day stay by an 18-month-old. Had to summon up all my energy reserves for that one. It's been nice but I'll be glad when his parent arrive to collect him.
 
@holdenweb oh yeah, that sounds like a handful :)
sounds like a blissful burden
 
9:24 AM
As long as they actually come collect him... :P
 
9:51 AM
Hello!! grabbing attention for this problem
 
Please don't crosspost fresh questions from the main site here. We have a 48 hour waiting policy. Take a look at the room rules
 
Alright
 
10:21 AM
Cbg folks, what would be the best way to make the length of three lists same? Like if I have pls = ['a','b','c'] and rf = ['d','e']` and svr = ['f'], then rf and svr should be as high as pls, like rf could be ['d','e','null'] and so svr would be ['f','null','null'].
 
@CoolCloud you might be looking for itertools.zip_longest. Do you really need to have those lists, or are you only iterating?
 
I tried using len() of lists and append() but the logic seems off.
@AndrasDeak Oh yes zip_longest(), just a minute, I guess thats what I wanted
@AndrasDeak Yep, that was what I needed, I tried writing manually instead(did not work). Anyway here is the answer that I needed this for.
 
10:36 AM
@CoolCloud "# Make a list of all files with pls at the end" should be "svr" and "rf" instead of "pls"
 
@BožoStojković Haha good catch. Edited. Thanks!
 
You're welcome :)
 
[(x,y,z) for x,y,z in zip_longest(pls,svr,rf)] is a no-op
just do for i in zip_longest(pls,svr,rf):
 
@Aran-Fey Oh it returns already returns a tuple. Thanks !
Typo there ~ "it already returns a tuple"
 
10:54 AM
@inspectorG4dget There are actually 3 major types of testing: PCR, antigen and antibody. PCR (molecular) test is most commonly done through a nasal or nasalpharyngeal swab, as is antigen test. They are both diagnostic tests. Antigen test is less accurate and may require additional PCR test. Antibody test is a serological, or blood test, and is used to test if you were infected with Covid, but not for testing whether you are infected now.
Also, this website seems to sum it up nicely.
 
I think PCR is the most accurate one.
 
Yes, it is, and should be used. I don't see why antigen test would ever be used.
 
To maybe manipulate? Get results faster? Bla bla
 
Yeah, idk.
 
@BožoStojković Hmmmm.
Was wondering about the no-covid-talk-pls tag here ;)
 
11:06 AM
Well, I didn't start it :P I was just trying to be helpful to our fellow cabbage.
 
Laurel.
 
The tag is probably there because of conspiracy theories and similar heated arguments.
 
@BožoStojković I wasn't here when all this started, prolly true :p
 
Ohh hoaxes.
 
11:16 AM
@CoolCloud I saw you edited your answer. You should probably not use underscore _ for variables which are used later. You should probably use i, or even better, a descriptive variable name, like filename. Also, you already import glob from glob, so glob.glob doesn't work, does it? Just use glob as a function.
 
@BožoStojković The thing is that I made the code with import glob but while pasting it, I made it from glob import glob and forgot to change it later. Again, good catch ;)
 
:) Ah, of course, it's a tuple actually.
 
@BožoStojković because you don't need a full-fledged lab and 24 hours to do it
antigen test works as a 15-minute quick test you can do on site
 
Ah, yes, good point.
 
@AndrasDeak AKA rapid test. Only if it were so accurate :(
 
11:20 AM
or something
 
 
3 hours later…
2:13 PM
@EthanO'Sullivan hello. Please don't ask for help here with fresh questions on the main site as per our rules. You also have two answers, and you only gave feedback to one. Consider helping your existing answerers help you.
 
@AndrasDeak - just read the rules, sorry
 
No worries :)
 
May I ask questions based on the two answer I was given though? Just trying to wrap my head on them
 
why not add a comment to the answers?
who is a better person than the one who answered :)
 
2:32 PM
Yup, I did not too long ago. Just brushing up on my Python skills and trying to tackle the potential solutions I was given. Running the code gives me some errors
 
3:13 PM
morning cabbages, folks
 
cbg inspector - how are Penny and Brain today?
 
how did you know I shoved pennies up to my brain?
don't quite know. I've been isolating for a while because I needed to get a COVID test yesterday
 
I wrote a program in Python, it's a big one, but after running the program for a while, the system memory consumption goes too high almost near max memory, in the process table, all-in-one-linix conumes that much memory, I'm using kubuntu 18, is there a way to find which part of the program is the culprit
 
oh I understand. I was just making a bad pun. How's you doing, @PaulMcG? It's been a while
 
3:18 PM
@kauray Read up on the gc module - it has methods for snapshotting and diffing objects that are allocated but never released. For instance, if you have an lru_cache with no limit, it will just grow and grow.
 
Okay, I used gc.collect periodically in the code though
 
In my example, objects in an lru_cache retain valid references, so gc.collect won't flush them out. I suspect that somewhere you have a list or cache that needs to be size or time limited.
 
I'm setting all lists to null periodically in the code
 
@inspectorG4dget - sorry to hear about needing to be COVID tested. We are guarding our own bubble pretty closely, but one still needs to go out in public once in a while (groceries, doctor, etc.)
I earlier suggested reading up on the gc module. There is more to it than just calling collect().
 
The code is however executing multiple ssh commands via Poopen subprocess and getting the output via ardour subprocess PIPE
Understood, thanks
 
3:45 PM
@kauray One way to approach this is to improve the locality of your code by refactoring it into functions. That way you know that any object created in a function (and not returned) has a strictly limited lifetime. So at least you aren't "leaving things hanging around" unnecessarily.
 
4:03 PM
thanks. We had a friend porch drop groceries, so that worked out pretty well. Aside from being a little annoyed at being unable to skiing for a few days, we're doing pretty well.
Backstory: g4dgetGirl is a schoolteacher (in-person, not virtual), and got a call notifying her that she was a high-risk contact
 
4:56 PM
My wife is a retired 3rd grade teacher, was doing tutoring out of the house up until last March, retained about half of her "clients" doing tutoring over Zoom. So glad she is no longer in the classroom (I was glad before COVID, but now about 100X gladder).
 
5:25 PM
My function foo(arg_1), has 3 steps that are meant to be done in order, but if arg_1 is false I only have to do step 2, is there a better way than this?
def foo(arg_1):
    if arg_1:
        step_1
    step_2 # common
    if arg_1:
        step_3
 
5:38 PM
nope
 
thanks, maybe I will rethink the design
 
 
1 hour later…
7:01 PM
@randomhopeful I would have thought you'd been around enough to know now that there's no purpose for people other than ROs of this room to have access to Ouroboros
 
I may have asked this before, but did people also request access to that room back when it was still called "python trash"?
 
That predates me, sorry. It's not a big issue, I can just decline it on the odd occasion it happens but it does ping us so it draws my immediate attention. I'm against changing the name to remove the ambiguity (if that's where you're thinking of going) but not in any kind of strong way. I just use it as a time to make a PSA
 
A search on github for "lru_cache maxsize=None" turns up 43,536 hits. And I see that RH himself added a cache decorator to Py3.9 that is synonymous with lru_cache(maxsize=None). It doesn't seem out of the question that some popular library might use one of these, not realizing that they are building in a near-guaranteed memory leak time bomb for long-running users of said library.
 
@roganjosh Nah, I was just curious
 
I see some instances of this usage in django, though it looks like lru_cache is used in many places in that package, and most have a value for maxsize other than None. So one would hope that the remaining unbounded caches have been reviewed and are intentional.
 
 
2 hours later…
9:03 PM
hello guys
 
hello
 
9:55 PM
Hey guys,

Does anyone know why Python 3.9.1 asks for Rosetta to be installed when it's supposed to be native on apple silicon?
 
10:10 PM
hmm, looks like after you install it it actually shows as an applie silicon app
 
10:34 PM
Does saying import tkinter as tk reduce space as compared to from tkinter import Tk, Button, .... when making exe with pyinstaller ?
Same logic with other libraries too?
 
That's actually the opposite of what most people assume when it comes to importing libraries
 
Whats the truth :P which ones better?
 
People often think that they can import subsets of the library, as in from tkinter import Tk, Button, and it will be more efficient. It isn't. Specifically when packaging to an exe, I'm >99% sure that will still be the case
 
Oh well, then there is no need of extra efforts :) Thanks. I'll just use import tkinter as tk.
 
So, without knowing for sure, I'm gonna go with "it makes no difference". But you can obviously test it. Objects that you import from a library don't exist in isolation within that library; they're going to be utilising internal functions/modules/methods/other
 
10:38 PM
@roganjosh Ohh I see.
 
I'm trying to find the SO canon but I can't remember the keywords. In the meantime, see this @CoolCloud
 
@roganjosh So there isnt much of a difference. Well thanks again for this.
Would it be weird for version 1.00 of an app to be beta version ?
 
@roganjosh that answer is wrong. Modules are always fully imported whether you use from or import. The difference is only in what gets put in the local namespace.
 
@holdenweb Isnt that what the answer also said?
"Importing the module doesn't waste anything; the module is always fully imported" ?
 
Must need a third cup of coffee. Ignore me.
 
10:54 PM
I wish I could have some. Its midnight here :(
 
@holdenweb Which answer? The one by Martijn?
 
@roganjosh Yeah, he's always wrong. Not.
 
Ah sorry, I just reacted to the ping before reading the extra comments. Enjoy the cup of coffee :)
Yeah, maybe I should have linked directly to the answer, but I thought it best to link the question for the setup to see the seemingly-logical process be broken down (I initially thought the same thing when I started programming)
 
When was that? Like how long ago
 
It would have been ~ April 2015
 
11:01 PM
5 years into programming, how's it been?
 
Challenging on a daily basis but I've never looked back. I wouldn't choose any other career (at least, none that I'm aware of)
 
@roganjosh Yaa I guess me too, but there is a long for me(I hope) to go still.
BTW, any thoughts on "Would it be weird for version 1.00 of an app to be beta version ?"
 
Assuming that you actually mean "long way", I don't think there's ever an end. Each day I find new stuff I don't know (and that's not an exaggeration). I find stuff I don't know faster than I can learn it
 
@roganjosh That is true, because there is no way to know everything, so we keep on finding new stuff.
 
11:21 PM
If just curious the beta version is out here. I can finally get some sleep. Do drop in suggestions, I know it seems unprofessional as I'm just learning, would mean a lot.
 

« first day (3720 days earlier)      last day (1221 days later) »