« first day (3831 days earlier)      last day (1342 days later) » 

00:37
I submitted this PR for requests, what do you all think? github.com/psf/requests/pull/5792 A gratuitous change? Unnecessary complexity? Or a useful short-circuit?
 
6 hours later…
06:33
@PaulMcG I don't do web dev but it seems reasonable to me
 
2 hours later…
08:53
Hi all... I am having some trouble importing some functions that I have created and saved in another file located in the same directory as my main script... But in the main script when I call the function using from <python file name> import <function>,, i keep getting the ModuleNotFoundError.. I have also tried using the import function in the same cell as where I call the function and save it to a variable, but I still get the same error
check whether sys.path contains the directory of your main/another file.
Oh, i have never heard of that function.. should I be using that whenever I import functions from another file?
it shows you where python will check in order to resolve imports. one of the pathes in there is where all the modules from the python standard library is. so, for example, import sys works, because sys.path has a link to a directory where a module called sys.py lies (slightly simplifying here, but that's mostly it).
No, you should literally check whether the directory is in the list.
This will tell us whether your assumptions are correct.
one other path that is in sys.path is your current working directory, so if you call your script /home/cmk/code/a.py from /home/cmk/code/, and there there is also a file /home/cmk/code/b.py, then the line import b will work in a.py. If you call a.py from /home/cmk/ instead, you get a ModuleNotFound error.
09:05
I suspect google colab
in my experience, this is the main cause for this kind of error.
@AndrasDeak oh, my eyes skipped over the word cell. is having your interpreter run on your own machine too lame for kids these days?
It could also be a mere jupyter notebook, of course.
hopefully not spyder :P
@AndrasDeak Oh this is using Jupyter
It shouldn't matter. In google colab paths might be a bit more funky.
But considering your terminology there's probably some user error here which we can eventually fix
Probably the usual "running scripts from different directory" thing
when i ran print(sys.path).. one of the default addresses returned was the directory for where both the files are.. so that should mean that it is looking in the correct directory. So why am I not able to import that file.. Do I need to import a special library to import modules?
09:11
@cmk101010 of course not. What you need is to gives an MCVE
example files, example directory tree, example working directory, example command running your script, example error message with traceback (but the error message should correspond to your example)
can I do that in this chat? or have to post the question on the forum
@cmk101010 the main site is not a forum. But if you ask there we'll ask you to wait 2 days before asking here too. You can keep asking here instead. But it might be better to post your example in a github gist or a pastebin or similar.
@cmk101010 for future reference here our our rules
thanks. I will post it on the main site
09:35
btw is there a nice new word for what SO is? Is SO is not a forum but a QA a thing?
09:58
@Hakaishin SO has always been Q&A - it was designed to not actually be a forum
10:13
while I rarely use the pickle module, is there actually even a semi-agreed form to name the pickled file? I've just always gone for "some_file_name.pickle"...
10:24
@JonClements I usually use .pkl as the extension
But since sharing them is a Bad Thing To Do, it doesn't matter much
10:41
@JonClements I know, I guess QA just didn't make it to the general public as a word
@MisterMiyagi I've seen Celery system setups where the allow types have added "pickle"... I cringed
11:07
hey can anyone help me with one programming question
ach test case comprises several (x,y) coordinates. X and Y of a coordinate are numbers between 0.0 and S. Each coordinate is
I see a lot of garlic naan and very little programming in that question.
mm..yum
@NalinNishant Now, assuming you don't simply want us to solve your problem for you (right?), what's your actual question?
11:25
@NalinNishant This room is not to be used for dumping your assignments. We are happy to help with specific programming questions, but not just doing problems for you.
I need to focus on something else. Please can one of the regulars ping me if that happens again?
Every time a coding challenge website passes in the number of test cases through stdin, I'm reminded that we're still in the stone age of IT
It's a good way to spot those, though.
11:43
I've got a good feeling
The line 2**3**2 seems oddly confusing when related to maths. I mean my understanding was this was same as 2 cubed and then squared, but turns out this actually means 2 raised to the power of 3 squared.
@CoolCloud in mathematical terms that's ambiguous
like how one could read 1/2/3 in multiple ways
@AndrasDeak But the answer is same in each interpretation right
11:57
If you mean there's a well-defined order that the interpreter uses to parse expressions: yes
Hmmmm yes. But I think python could have gone with '2 cubed and then squared' method because that seemed intuitive to me.
So I guess ** is not commutative either.
Of course it isn't commutative. But what you mean is that it's not associative either.
That's certainly a surprise, I thought operators with the same precedence were always executed left-to-right
I'd never write things like 2**3**2 and assume it works either way
But I can't find any other arithmetic operator that does right-to-left, nor can I find this specified in the docs. docs.python.org/3/reference/expressions.html#the-power-operator would be a good place for this.
> Thus, in an unparenthesized sequence of power and unary operators, the operators are evaluated from right to left (this does not constrain the evaluation order for the operands): -1**2 results in -1.
no, I'm just blind
12:15
So I guess I jus have to use (2**3)**2
@AndrasDeak Wait how is -1**2 evaluated? Right to left? So 2 raised to -1 or something else?
morning cabbages, folks
@CoolCloud do you know how to open python and/or read the linked docs?
@CoolCloud yes, even if the order of evaluation were different. Use parentheses to make ambiguous code clear.
@inspectorG4dget cbg
@CoolCloud don't confuse yourself, (x**y) is still (x to the power of y), it's just when you chain it, the chains are resolved right to left. (x**y**z) would be resolved as (x**(y**z))
@ParitoshSingh Oh I see, something simple as this would have helped earlier :D
13:18
argh, more silencing of exceptions.
except AttributeError:
    pass
except URLError:
    pass
and I'm like, this doesn't even make sense, this should error somewhere
plus on more lines than necessary
like we use logging throughout, why would you ever do this... Just wastes other peoples time... except if that is your goal... I'm doing it again :P
could refactor it
except Exception:
    pass
must, yes
xD
and then perhaps make it more concise. except: pass!
13:20
@ParitoshSingh ai driven refactoring
tis the future, they say
13:55
> However, when using operator notation [for exponentiation] with a caret (^) or arrow (↑), there is no common standard.[19] For example, Microsoft Excel and computation programming language MATLAB evaluate a^b^c as (a^b)^c, but Google Search and Wolfram Alpha as a^(b^c). Thus 4^3^2 is evaluated to 4,096 in the first case and to 262,144 in the second case.
Interesting, I didn't know there wasn't a standard. I assumed you just go left to right.
In other words, the MATLAB approach adheres to my fuzzy elementary school memory of PEMDAS
I always thought PEMDAS would evaluate RTL...
Well, consider the fact that a-b-c == (a-b)-c
I guess professional mathematicians haven't convened to establish a standard for serial exponentiation, because they all use fancy superscripts, which have no ambiguity
Every once in a while I see a Facebook post (or similar) that asks the reader to solve a problem like 10 - 4 / 2, saying that 95% of people get it wrong. Replies are usually a mix of "8", "3", "the expression is ambiguous without parentheses", "no, it's clear if you follow PEMDAS", "but the post didn't specify that", "you fool, it's implied", etc etc
It's a perfect microcosm of my sociological theory that most disagreements occur because the participants are working with different unspoken premises/axioms/definitions
14:10
my relevant theory is "Dunning--Kruger meets bikeshedding"
people opine because that's the level they understand, but they don't even understand that
en.wikipedia.org/wiki/… has a good point, that defining a^b^c = (a^b)^c is not very useful, because that would simplify to a^(b*c)
Is that really a good point?
with the other convention a**b**c simpliifes to a**(b**c)
Hmmm... I wonder how fortran handles this
$ cat tmp.f
      program main
      write(6, *) 5**3**2, (5**3)**2, 5**(3**2)
      end program main
Short answer: I consider it a subjectively good point, for complicated reasons
Outputs
1953125 15625 1953125
Which is surprising because in this regard MATLAB breaks fortran behaviour
[quickly googles "matlab bug bounty program"]
14:15
Well they probably never said that they want to be like fortran, nobody boasts that.
I want to be fast like fortran :-)
I had occasion to use Knuth's Up Arrow notation the other day... While playing Magic: the gathering, I noticed I could spend one unit of {resource_A} to double my amount of {resource_B}. I could also spend one {resource_C} to gain an amount of {resource_A} equal to my current {resource_B}. End result: 2↑↑C units of resource_B.
Peak performance. And so close to the previous peak!
In M:TG it's quite easy to construct an infinite loop that allows you to gain arbitrary amounts of resources, but this one is noteworthy for not being infinite, but simply really obnoxiously large. You don't see that very often.
Related reading: A deck which, given astronomically good luck, deals damage greater than Graham's Number: alex.shankland.org/index.php/2018/06/13/…
He gets up to 2↑↑↑4 a third of the way through the article, so my 2↑↑C is peanuts to him. On the other hand, I can actually get there during ordinary gameplay.
14:52
morning cabbage
15:07
@AndrasDeak Because if you're going to yam over future maintainers, you better do it efficiently (-:
@Kevin Moo ooo ooo oooves like fortran
IDK why Maroon 5 jumped into my head as I read this earlier conversation in chat history....
Sometimes it be like that
15:22
@Code-Apprentice I read that like a cow moo.
@piRSquared add Adam Lavine's falsetto and that's about right
did you just start some beef with Adam Levine?
I see what you did there
actually, IDK why I'm dogging on Adam Levine. He's got a great voice.
I like Maroon 5 (for like 10 minutes at a time, tops) but I can't stand that song. When it came out, my wife listened to it way too often.
yah, I get that. Hearing the same song over and over in too short a time span can get really obnoxious.
15:53
Cbg-noon
Question: I'm trying to do the following unit test. I want to check if my list, which contains many sublists. All the sublists comes with three elements. Which gives something like that
['boo','boo','boo.com'],['baa','baa','baa.com'],...['bzz','bzz','bzz.com']
the aim is to check if all the sublists comes with three elements
I'm thinking something like assert all(isinstance(item, list) and len(item) == 3 for item in my_list))
Perhaps use an abstract base class in place of list, if desired
@Kevin what's that recent (but not used now because everyone's playing rogues/temur adventures/sultai ultimatum etc...) combo where you had a creature that everytime you gained life the opponent lost that much life and that angel which doubled your life each time your opponent lost life or something crazy... it wasn't exactly a win con, but it was fun to watch when those came together and life totals got mad
@Kevin oh that one is cool. very cool
15:59
it was a vampire/angel thingy... so black/white with a splash of red mostly
@JonClements Yeah, I heard about that one. Reminds me very much of the classic kitchen table combo, Sanguine Bond + Exsquisite Blood. As soon as you gain life or any opponent loses life, all of your opponents drop to zero.
I've got a friend that plays it in his W/B Commander deck. He doesn't win with it often because we immediately point our removal at either enchantment when it enters the battlefield, but when he does win, it's a memorable experience
@Kevin one last thing btw: list is the same thing as my_list, am I correct?
Nope, list is the type, my_list is the list you're testing
@Kevin cheers.
isinstance will crash if you try to give a list instance as its second argument
16:04
Well... technically, list is what you hope is the type.... someone might have done list = int before hand :p
That's the last straw, I'm making list a keyword in KPython
We already have SyntaxError: cannot assign to None, let's go ham and do it for all the builtins too
@Kevin let me read that
raf
raf
16:20
Hi I am trying to generate the `requirements.txt` file for this python file here: https://github.com/acarafat/newton_calculator/blob/main/newton_calc_app_v0.1.py
For that, I am using `pipreqs`. But a traceback appears saying:
UnicodeDecodeError: 'charmap' codec can't decode byte 0x8d in position 442: character maps to <undefined>
What can I do fix this issue?
Well, the easy solution is to open a text editor, type in "streamlit", and save the file as "requirements.txt"
raf
raf
But I wanted to generate it through pipreqs. I tested it with different py files. It works okay. But here in this file, I have used bilingual languages.. is that the reason of this traceback?
Yeah, a quick glance at the pipreqs source code reveals that they don't use utf8 per default
So pass --encoding utf8 or whatever
Python 3 expects scripts to be utf8-encoded, doesn't it?
raf
raf
I think so, I am not sure
@Aran-Fey yes, it works.
thank you.
pipreqs devs are still stuck in python2 land I guess
16:29
still not sure about this unicode stuff... we should just have kept with ebcdic :p
raf
raf
I just upgraded streamlit version from 0.79.0 to 0.80.0
But line 32 from https://github.com/acarafat/newton_calculator/blob/main/newton_calc_app_v0.1.py is not giving me the desired output. Previously it was working okay.
The line is:
st.markdown("<h1 style='text-align: center; color: #ff7903; font-family: Solaimanlipi'>গতি-সমীকরণ ক্যালকুলেটর </h1>", unsafe_allow_html=True)
17:05
you are using a version of Python 3, @raf?
@raf on a side note... just a quick glance over the code... some of those if blocks smell a bit iffy... seem a bit too "conditionally".... also, if you want to make sure something is either True or False use if some_object is False, rather than if some_object == False...
raf
raf
@JonClements Thank you so much. I am a beginner-level coder. I will try to improve it.
@JonClements yes. python 3.8.3
@raf for instance, you only really need one ask function here since they all do the same
(we were all beginners at some point - don't worry about it!)
raf
raf
17:20
@JonClements yes, it can be made more compact from. But I am confused how to set that function. Can I ask for help in the code review SE site about it?
they have quite strict standards... they don't accept non-working code... but if you get the code working, have a clear point about things they will - I just wouldn't recommend posting there right now with what you have
raf
raf
17:38
Okay, I will try to improve my coding by myself first. But I am not sure what you mean by "non-working code". My coding needs improvement but it's providing my desired output now. So, I can say it's working!
https://share.streamlit.io/acarafat/newton_calculator/main/newton_calc_app_v0.1.py/
@JonClements ohh yeah. I didn't even realize it! :) Thank you.
no, actually I thought about that too.. but I couldn't implement it.
@raf: What is the desired output? What is the observed difference between the expected nad observed behavior?
raf
raf
17:53
@inspectorG4dget by desired output, I meant to say, I am getting the expected behavior now while using streamlit 0.79.0.
as I understand it, "it was working with 0.79.0" and "it is not working with 0.80.0". What error do you see? is there a traceback?
raf
raf
@inspectorG4dget yes, here's the problem I am facing now: github.com/streamlit/streamlit/issues/3115
@inspectorG4dget hey doc - how you doing?
@raf you would do def ask(msg):, use msg as the first argument of number_input as something like number_input(f'{msg} :', ...) , and then call the function like u = ask('আদিবেগ (u)') etc.
@raf sorry, but that sound like a regression to me. My experience with streamlit is coming up short, I'm afraid
@JonClements heya puppy! It's been a while. I'm doing alright, thanks. Trying to stay sane indoors. How's you? Trying to learn sentry.io right now
raf
raf
17:59
@AndrasDeak oh wow. thank you so much.
@inspectorG4dget oh same old... I still got my walkies... "sane"... what's that? :p
(here's hoping I didn't copy something dirty in Bengali :P)
raf
raf
@AndrasDeak haha, no.. it's "initial velocity (u)". lol
@inspectorG4dget what're you using sentry for?
I feel ya! Sunday walks along the river with some friends are the best I can hope for anymore
18:02
@raf neat
@JonClements data aggregation platform. We have loggers in place for graceful failure cases, but we don't have anything to catch infra level killers. Sentry might be able to aggregate and triage both
Any django users on?
Got any sentry experience I can try to riff off of?
@inspectorG4dget I have a horrible feeling that there's some going to be some that as the UK is trying to open up certain stuff - it's going to be mad... and we're just just going get ourselves back down into lockdown again :(
raf
raf
should I ask it on streamlit forum too? https://discuss.streamlit.io/
or that github issue is enough?
18:05
My current project has sentry set up, but I've only used it to view crash reports. I haven't done any configuration with it.
@JonClements *cries in Hungarian*
@raf I'd say the GH issue should suffice, but I don't see how it could hurt to make a forum post as well (just be sure to link the GH issue as well)
raf
raf
@inspectorG4dget agreed. will do it too.
@JonClements Oh that Boris! "I'll be at a pub this weekend, myself!". What's a really esoteric word I can call him that sounds polite and benign to most people?
yamface
18:07
@Code-Apprentice did you manage to get it to listen in on your logger.* calls?
@AndrasDeak I love this
might actually be slightly offensive in the literal sense though (you can consider that a pro or a con)
perhaps I could mitigate that with "I love yams"
raf
raf
@AndrasDeak :)
@inspectorG4dget I'm not sure what you are referring to.
@Code-Apprentice my application logs a bunch of stuff using python's logging module. I'm trying to find a way to get sentry to hook into (for example) my myLogger.info(..) calls
18:15
@inspectorG4dget oh...I thought you were referring to a previous conversation. And no, I haven't messed with setting up sentry at all, let alone trying to get it to see logging output.
@Code-Apprentice lol! understood. Sorry - I'm woefully out of my depth with Django. I'd be more of a burden than of any measureable usefullness
... I'd be useful usefool
So django question. I have a Event model with a created timestamp, an active flag, and a name. There can be multiple instances with the same name. How can I query only the most recent instances of each distinct name? I could write some python logic to filter the QuerySet/list in a loop, but I'm wondering if I can do it with just Django's query API.
@inspectorG4dget even a fool can be a rubber duck
IIRC django query api has some max function. Is this at all in the ballpark? stackoverflow.com/a/66578845/198633
hmm...that might do what I need
I might need a groupby() or something like that as well...
and I need the max created in each group
18:27
@inspectorG4dget Thanks for at least giving me some words to google ;-)
@Code-Apprentice Glad I could help. I really wasn't expecting to be able to </quack>
the jury is still out...gonna get some lunch then come back to this.
19:25
hmm...not quite getting it
 
1 hour later…
20:31
cbg, all, bugrit.
20:48
@holdenweb cabbage
well...looks like I broke my local build ;-(
I probably need to do a round of package upgrades before I can make any progress here...or maybe just upgrade a subset of packages
at the end of the day, I'm trying to figure out why my app looks different when I run it inside a docker image vs when I run it locally
Interesting news from my O'Reilly editor: it looks like they are interested in a fourth edition of Python in a Nutshell.
8
21:04
@holdenweb \o/
... a chance to finally excise v2 from the work, but then there's 3.6 through 3.10 to add. Quite a bit of work, and neither Alex nor Anna have much availability.
@Code-Apprentice Not using virtualenvs yet, then?
@holdenweb yes, I use a virtualenv. I just changed to poetry for python package management. My current package problems are with the frontend and npm.
21:23
Hey all
I have a python problem frustratingly hard to fix
I've got a pendulum
But when I move it down, the ball doesn't move with the spring:
Why is this?
Is this still that weird programming environment?
@DarkRunner there's a bug. Probably in your code.
@AndrasDeak Well OK
I've been at this for 3 hours and now feel burnt out
I don't even understand what you expect to happen. Should the whole thing shift vertially, keeping the spring horizontal?
21:26
Yup
Like a regular spring
No, if you pull down the end of a spring the other half won't magically translate with it.
Genius
You will see what you see in the bottom screenshot, and the arising spring force will start pulling the sphere downward and inward
Oh, so the force is the problem?
Or should I move the "atom" down?
I haven't looked at your code yet. If you implemented physics correctly then it should not shift as a whole thing. That's the difference between a spring and a rod.
@DarkRunner depends on what you want to happen. Physics or something magical.
21:29
What can I say? I've been at this for so long and it would be great if someone could sincerely help
There's also bad news: a spring with no tension doesn't exert a linear force for small perpendicular displacements
@DarkRunner I'm sincerely trying to figure out what you're trying to do. I'd love it if anybody else could tell me, but what I need is inside your head. So we're stuck with each other.
Well thanks
I'm trying to change the atom's pos and vel
So that the spring stays horizontal?
... and it got worse
@AndrasDeak Yes that's the point
I have other concerns while we're at it. You say this is a pendulum... but then the end of the spring should be stationary
@DarkRunner how does the axis property define the orientation of the helix?
21:32
@AndrasDeak it stretches and squeezes the spring as needed
I meant something more specific. Something exact.
# THIS IS THE MIDDLE DOOR
middleDoor = ...
user image
4
Is it a vector that defines a relative position with respect to the pos?
yes
@Aran-Fey funny
@Aran-Fey heh
@DarkRunner in that case if you don't want the axis to change orientation, don't change Spring.axis.
21:35
Got it
So I just changed the wall's position
But I want to have it on record that nothing about this looks like a pendulum to me.
@AndrasDeak Look, I'm just trying to approximate it; This is for a project
Is the ball supposed to fall in gravity?
@Code-Apprentice yes, g=4.9
21:37
@Code-Apprentice that's why the wall is moving, duh
the wall is moving?
or whatever that green bsae is
The green rectangle is Wall? And you want Atom to move along with it? If so, I don't even see anything that would cause Wall to move
OK, let me explain
21:39
1. Yes, Wall is the green rectangle
2. I moved the wall down
3. The "atom"/ball should move down (I tried adjusting literally every parameter)
are you moving the initial position of the green plate? Or are you moving it dynamically while the program runs and the rest of the system is supposed to respond according to physics.
The initial position
@Code-Apprentice there's no physics
The wall isn't in the for loop
@AndrasDeak I find that mildly rude
1 min ago, by Andras Deak
uh oh
21:40
not funny
I'm so confused
It's infuriating when you're trying to debug code that changes without warning...
OK, sorry
I'll stop changing it
Changing Atom's y position to -0.5 doesn't fix it?
I'm so confused by this. The initial problem was "But when I move it down, the ball doesn't move with the spring". So is it even attached to the spring?
As far as I can tell, the string's position/length/angle/etc is calculated based on the position of the Atom
So... no. 99.9% sure this is just a matter of setting the Atom's initial y coordinate correctly
Or there's something wrong with this formula: Atom.vel = Atom.vel + (-k * Atom.pos / m) * dt
21:54
yup
Nope
I changed atom's y and it doesn't help
Makes no sense that the atom's absolute position has an effect on its velocity
@Aran-Fey if the other end of the spring is in the origin it does
exactly!
but it's probably elsewhere
and there's this funky selective gravity that only affects some of the things some of the time
21:56
This is so annoying
tell me about it
Look how nicely it moves horizontally
@DarkRunner I don't see it move at all
Is it very slow?
No ... might be because I'm changing the code as we speak
perhaps that .png has very low framerate
22:06
So essentially, the blue sphere is moving based on some criteria we don't know, and there's something wrong with the formula for it.
 
1 hour later…
23:14
is someone trying to hack stackoverflow right now ?
it kept redirecting me to "confirm account" page and " create new account " page.
Something might be trying to hack your SO access, but the site seems fine to me
it fine since I got here too, anyway I'm glad it's over
so I've moved on from connecting the 3 tables using
`db.session.query(box,bag,item).select_from(box).join(bag).join(item).filter(box.id== 0).all()`

i wonder if it would be ok if the object I'm trying to pull has no bags nor items
or would it raise any error if box had no bags
23:30
Well, that certainly looks a lot more like what I was expecting. It's been a few months since I use SQLA and it's getting very late here so I don't trust myself to give advice just now about whether you need a different kind of join. But I am exceedingly happy that you went away and researched that
oh thanks!, that means a lot ^^, I won't have been able to do it without you to be honest, because I usually come here when I'm lost lol, but you gave me the push I needed to keep going.

surprisingly, it wasn't too hard to find. I even found a video on youtube about the subject ^^
but have a good night and take care, I'll find out eventually once i ruin my database , which happens all the time lol

« first day (3831 days earlier)      last day (1342 days later) »