« first day (4322 days earlier)      last day (609 days later) » 

3:01 AM
I just noticed on my system: sys.version is '3.8.10 (default, Jun 22 2022, 20:18:18) \n[GCC 9.4.0]'. I thought 3.8.10 came out last year? I've had it installed since I switched to Linux in January. How did I end up with a more recent build date?
 
Z47
3:34 AM
Hi is there anyone here?
 
 
2 hours later…
5:08 AM
We have a dupe target for "how do I change the value of a variable from inside a function?" type questions, right?
https://stackoverflow.com/questions/73368919/change-a-variable-given-in-a-function
well, I found one that shows how to accomplish the same goal with a return, but there's probably a better one. Not gonna link to the ones that suggest putting the value in a list...ugg, why?
 
I don't think the question is clear. It seems like we're assuming that OP wants to "pass by reference", and thus have the change to value be visible from outside.
(although it's a little hard to imagine what else is the intended purpose, it's such a short code example that it could just be, like, eliding the rest of the function.
but I think the question could equally well be something completely different: "how do I repeatedly do the value=random.randrange((-30/10),(30/10)) assignment until min <= value <= max is satisfied, and then proceed with the rest of the function?".
(which reminds me, one of the artificial canonicals on my plate is (paraphrased, idk how to title it yet) "why did treating function calls like gotos bite me in the butt?")
 
6:10 AM
I am struggling with this error when trying to query my sqlite database using flask sqlalchemy.exc.InvalidRequestError: Row with identity key (<class 'app.models.User'>, (1,), None) can't be loaded into an object; the polymorphic discriminator column 'user.type' is NULL. I am using SQL joins to combine my tables as seen here dpaste.com/C8AKN86SX. Why so?
I am trying to query the db to retrieve all the data in the db using query = db.session.quer(User).all() hence the error. Though when I do query = db.session.query(User) successfully gives me <flask_sqlalchemy.BaseQuery object at 0x7fcf35cdf2b0>
 
 
2 hours later…
7:43 AM
@GitauHarrison Because you didn't create a User?
student = Student(
            username=form.username.data,
            email=form.email.data,
            age=form.age.data,
        )
I don't think there's any way for it to know what user to associate that with. I'm not familiar with inheritance in this situation but I don't see how it could create a User record on demand. It could get away with an auto-incrementing key for the User but you also define a type on that object. I'm relatively sure you'd need to create that User instance and pass it to the Student
 
@AndrasDeak--СлаваУкраїні I suspect so: meta.stackoverflow.com/a/419864
 
Although, then again, I guess it's polymorphic on the type so maybe it should auto-generate the user. I don't know what this reduces to in the database but I guess there aren't really multiple tables supporting the different user objects. I find thinking about SQL in this way a little odd
... But they can't share a table because from the example the Manager has an attribute manager_name, which both doesn't make any sense (you'd want just a name attribute on the Manager object, I would have thought?) but that must be a separate column to the name on the base Employee table
 
8:04 AM
Hmm, looks like I'm wrong "A particular subclass that has attributes unique to that class will persist them within columns in the table that are otherwise NULL if the row refers to a different kind of object." which implies everything does go into the same table. This is way beyond my Tuesday morning brain :/
 
8:55 AM
@GitauHarrison I've spent quite a bit more time looking at this and still can't quite see what you've done wrong. Are you sure that all records that got into the database went through the code you sent? Once you apply the ORM layer, it won't discriminate about legacy entries - it's going to apply its assumptions over everything
 
@PM2Ring took me two reads to find it, but yeah, thanks
I guess that removes the necessity to acknowledge the message :P
 
@GitauHarrison one thing to note is that "successfully gives me <flask_sqlalchemy.BaseQuery object at 0x7fcf35cdf2b0>" is a red herring. Queries can be built up incrementally, all it's saying is that you have a gun object and you could have been filling it with marshmallow for all anyone knows. You just haven't tried to fire it yet, which comes with .all()
 
9:12 AM
Q: How long does it take for a herring to turn into a gun?
A: One sentence
 
Maybe they could have been packing that gun with red herrings, to make it that little bit more meta
I think you'd need a canon at that point, though, and I don't think I want to be quite so grandiose with SQLA
And I suspect that projectile red herrings could still do some damage...
 
 
1 hour later…
10:17 AM
cabbage
 
10:30 AM
@AndrasDeak--СлаваУкраїні I did see, I was replying to CA though
 
I appreciate you taking the feedback on board Karl btw. I don't think anyone will have an issue with specific replies like the one in question, I think Andras was just double-checking that you'd seen the discussion
 
What roganjosh said.
 
cool. I did see it and will be taking points into consideration. Mainly, preparing what I have to say ahead of time
 
I'll swing in with a +1 on what roganjosh said too. I thought your git repo for WIP was a pretty good idea. PM2's idea of a room that could be linked would be a good one too.
 
@KarlKnechtel We don't want to discourage you from the work you've taken on. We just don't want it to dominate the room. However, we also don't want you to burn yourself out. Frankly, I'm amazed & impressed that you haven't burnt out already. :)
 
10:44 AM
I'm now off for the rest of the week so I might get bored. I wonder if I might be able to think up some triage feature for sopython (though, even if I determine this is a good thing to have - which is still an unknown because I could just have brain-farted that idea) it'd just be a PR as I don't control the central site
Even just a little extra thought into the idea is making me think it couldn't really work as a thing. Still, I've not entirely killed the thought yet
 
11:05 AM
@JRichardSnape Meet Ellen, the funkiest 10 year old on YouTube. She's jamming here with her dad on guitar and a few other friends. youtu.be/EFNGy28SoSc Noah on sax is also a great singer & keyboard player.
 
@PM2Ring I understood it. I really do need to figure out how to pace myself too (also just in general)
@JRichardSnape you mean, linking a room to the repo somehow? Is there any kind of explicit support for this? or are we considering, say, some kind of custom bot
 
@PM2Ring Ah yes, I've seen her before. I love how happy she looks. I think she was doing "Superstition" on the video I saw. Fantastic!
@KarlKnechtel Not sure there is any support - I was thinking a dedicated room with a link to the repo in the description possible. I guess you could probably make a bot that notified changes to the repo to that room with the contents of the commit messages, but I hadn't got to that level of sophistication in my half formed thought.
Then, every so often if you had a consolidated thought on which you wanted an opinion, drop a link to the room here.
 
@KarlKnechtel Well, you can just create a room here on SO.
@JRichardSnape You can tell she really loves making music. Here's her version of Penny Lane youtu.be/CgT4uNqo-GE and The Ocean youtu.be/LpaMCYLweWU
And here we have a bunch of bluegrass musicians playing trip-hop. The Punch Brother, with Sarah Jarosz: Teardrop. Ok, she doesn't quite have the delicacy of Elizabeth Fraser in her prime, but she makes up for it with sheer power.
 
 
2 hours later…
1:06 PM
@KarlKnechtel thanks for confirming
I know that was a reply, I just wanted to make sure we're otherwise on the same page
@roganjosh that
 
 
1 hour later…
2:32 PM
>>> (lambda x:x(x))(lambda x:x(x))
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "<stdin>", line 1, in <lambda>
  File "<stdin>", line 1, in <lambda>
  File "<stdin>", line 1, in <lambda>
  [Previous line repeated 996 more times]
RecursionError: maximum recursion depth exceeded
Mildly interesting curiosity: causing a RecursionError in a single expression
 
3:15 PM
I think you might have a problem in line 1
 
See that part where I call the thing with the other thing... That's a common Gotcha. Professionals never call things.
 
Don't call us, we don't call you either!
 
There are an unlimited number of RecursionError-causing expressions, but this one is nice because of its self-similarity. If you try to evaluate it on a piece of paper, after a bit of work you'll end up with (lambda x:x(x))(lambda x:x(x)). i.e. the exact same thing you started with.
Compare to, say, (lambda s: lambda x: s(s)(x+1))(lambda s: lambda x: s(s)(x+1))(0). This also crashes with a RecursionError, but the value of x changes with each addition to the call stack
 
3:46 PM
(lambda s: lambda x: s(s)(x+1))(lambda s: lambda x: s(s)(x+1))(0)
#rename terms in second half. This is allowed because I say so.
(lambda s: lambda x: s(s)(x+1))(lambda t: lambda y: t(t)(y+1))(0)
#call the "lambda s:" part with the "lambda t:" part
(lambda x: (lambda t: lambda y: t(t)(y+1))(lambda t: lambda y: t(t)(y+1))(x+1))(0)
#call the "lambda x:" part with 0
(lambda t: lambda y: t(t)(y+1))(lambda t: lambda y: t(t)(y+1))(0+1)
#rename terms
(lambda s: lambda x: s(s)(x+1))(lambda s: lambda x: s(s)(x+1))(0+1)
Back in the same place, except one higher. This tower will pierce the heavens.
Meanwhile, in the heavens:
Angel: "There's a mortal trying to reach us, again. Shall we confuse their tongues like last time?"
Supreme Entity: "No, I think he's plenty confused as-is."
 
 
1 hour later…
5:15 PM
Hello, good afternoon. Hope you're all ok.
 
Hanging in there
 
Quick question, Im working with an excel file through pandas and I have to delete the first 5 rows but I get a type error on that part.

I'm using df = df.drop([0,1,2,3,4,5]) to delete the rows and the error I'm getting is TypeError: object of type 'int' has no len()
Can't find a way around that error
 
Do you have an MRE for that? I cannot repro it with a simple dataframe.
 
If the next thing Eestrada posts is an MRE or MCVE or MWE or reprex, I will devote 100% of my energy to solving the problem
 
6:22 PM
I think I need to workshop the wording of that offer. Querents might be worried that there is a secret clause of "otherwise, I will catapult them into the Gorge of Eternal Peril"
Don't worry, Eestrada. There is no penalty if the next thing you post is not an MRE or MCVE or MWE or reprex. Nobody is going into the Gorge of Eternal Peril today.
 
6:45 PM
@roganjosh Yes, the code shared is exactly what I have on my app. I am able to register a student, admin et cetera. I can sign each to their accounts successfully. The challenge still remains in querying the database, as you put it, filling it with marshmallows :-) until I fire the gun.
Honestly, I am not even sure what to ask beyond that. If I wasn't using joined table inheritance, then a simple query such as User.query.all() would get me all I want, but with joins, it is apparently different.
I have been recommended to check my database design, maybe that could be an issue, for now or in future. I have even signed up for databasestar.com just for this
 
6:57 PM
Honestly, I would also question the database design in this case... but that doesn't mean you've done something wrong in and of itself. You basically followed the docs there. What was the specific feedback you got?
If you want a multi-tier login system for Flask then I can give you that, using a single Users table (IIRC - it's a different laptop and a long time since I looked at the code)
Maybe a better question is - what is the ultimate functionality you're trying to get @GitauHarrison?
 
7:54 PM
cabbage
 
8:40 PM
Python is so much thon (fun)
I'm sorry
 

« first day (4322 days earlier)      last day (609 days later) »