« first day (4942 days earlier)   

12:10 AM
@user10478 Ok, can you post the link? or a snippet of your code? I'm curious
Update: the shortest syntax for log2 is: sympy.log(x, 2).evalf()
 
12:40 AM
HI, how to read all items in listbox as a text file and display evry file contents into different sheets in excel using python tkinter
 
I would start by thinking about the logical steps involved in solving that problem, and deciding the specific requirements for each.
 
Someone help me abut this, im new to python tkinter, need to automate few things so looking for your kind help on the same
 
If you are new then you cannot expect to be able to do everything that you can think of doing. As a programmer it is necessary to learn fundamental problem solving skills first.
Please also read the room rules; we do not want links for recently asked questions.
 
Yes i have coded half of my program, and looking for a small help. you can chk that out from my post
 
It is not possible to "help you" on Stack Overflow because it is not a discussion forum. To get an answer you are required to ask a question that meets the site's standards, as described in How to Ask and on the site tour. I also advise you to read: Advice for non-native English speakers
 
1:16 AM
There is no MRE in this question: stackoverflow.com/questions/66629641/…. Can someone close it, please?
 
1:53 AM
@smci Yeah, this page (carpentries-incubator.github.io/python-text-analysis/…) actually has the same info and more. Here's the code I've actually run (hastebin.com/share/ocawodiyod.python). Notice that because female - woman is about the same as male - man, the first expression outputs only 2.8631563, while the second expression doesn't roughly cancel in this way and outputs 10.555002. Then most_similar() returns nearby words.
 
 
3 hours later…
5:22 AM
@Marco this is such a common issue with machine learning questions on the site. Often it's not possible to make an MRE for such complicated cases because it'd end up being hundreds of lines long. However it does seem that they detailed the API usage enough that someone might be able to check it against their own implementations to see whether it reports different values
I feel like there's a canonical on meta about why data science questions just don't work on SO somewhere but I've not had my morning cup of tea yet so I'll hunt it down shortly :)
 
5:40 AM
Huh, now I have started drinking my tea I see that it's really old and only has a "same here!" answer. Indeed it should be closed
 
6:24 AM
@Marco That's a new rep-25 user. First tell them what an MCVE is and that they need to add it (more "welcoming"), instead of just closing it without warning. I added a comment saying that.
@roganjosh Well anything where a full MCVE would need 20-1000 lines can be painful to generate MCVE for. Esp. in this case they're only asking about why the logging syntax seems to mismatch, not the model, parameters, accuracy etc. itself.
@roganjosh The power of tea ☕️. Douglas Adams would have approved.
 
 
6 hours later…
12:26 PM
any good intro to arrays in python?
i don't get this syntax:
listt = [1,2,3,4]
listt[2] = [8]
listt[2:2] = [7,7]
 
start by not calling them arrays but lists
 
i get that the second is inserting elements only, not the array itself, but doesn't seem intuitive ?
says array methods' in the docs
what do you mean @ThiefMaster?
 
but [...] creates a list. not an array from that particular module
 
are list and arrays different things in python ?
they seem the same in the docs
 
they are different things. the module from your link is something you'll almost never use
and you'll have an easier time understanding your code snipped from above if you look at the list after every step:
>>> listt = [1,2,3,4]
>>> listt
[1, 2, 3, 4]
>>> listt[2] = [8]
>>> listt
[1, 2, [8], 4]
>>> listt[2:2]
[]
>>> listt[2:2] = [7,7]
>>> listt
[1, 2, 7, 7, [8], 4]
foo[2] = ... assigns to a single element, so you end up with a nested list
 
12:32 PM
that's what i expected at each step thoguh
 
foo[2:2] is a slice containing the 3rd element, so now you replace a slice with another list -> you replace the (single-element) list that contains the 3rd element, with a new list containing [7, 7]
 
my point is just that i don't get why a[2:2]=[1,2] inserts the elements 1,2
 
see my last message ;)
 
yes but you are adding a bit which isn't very clear
i think the problem is that a[2:2] means something else when on the left or the right of the equal sign
 
Depends on how you look at it. You can certainly argue that it means two different things, but then a also means two different things depending on which side of the equal sign it's on
 
12:45 PM
i see
can you expand? I'm new to python
 
a on the left side of the equal sign means "store the value here". On the right side it means "get this value"
Same thing for lists. On the left side a[2:2] means "store the values between 2 and 2" and on the right side it means "give me the values between 2 and 2"
 
indeed, that's why we didn't agree with the other commentator
however that doesn't explain why the array is unpacked @Aran-Fey
 
What's unpacked where?
 
destructured
 
I don't know which line of code you're talking about
 
12:48 PM
a[2:2] = [2,3]
a[2] = [2,3]
one vs the other
a[2] = [2,3] result it's expected to me, but not the output of the other
 
2 refers to an index, while 2:2 refers to a slice/range/whatchamacallit
a[2] = [2,3] means "store the value [2,3] at index 2 in a"
 
so ? i doubt that explains the result
you'd expect [2,3] being stored in a slice of a
not in the whole a
 
a[2:2] = [2,3] means "store the values 2 and 3 between indices 2 and 2 in a"
 
so it's not slicing anything
 
@MahNeh What does that mean? How is that "the whole a"?
 
12:52 PM
no item from the original a is missing
also, when there is a slice here is for which items to remove, not which items to keep
 
What did you expect to happen?
 
so in the right of the equal sign `a[2:4]` means to get item at position 2 and 3

on the left of the equal sign `a[2:4]`, means to remove elements 2 and 3 and put whats on the RHS of the equal sign at position 2.
is this a correct interpretation ?
(i'm testing it as well)
 
Yes
 
now i can say what I don't get
which is that i'd expect the full array in the RHS at position 2
 
Alternatively, 2:4 refers to the slice between indices 2 and 4. On the right side of the equal sign it means "give the values there", and on the left side it means "overwrite the values there"
 
12:56 PM
not the elements of it
 
So there would be no difference between a[2] and a[2:2]?
 
no, exactly
only if the index is different, say a[2:3]
imho that's more intuitive, but i guess that's just not how it is
 
Nope. If you use a colon, you refer to a slice of the list. 2:2 means an empty slice
 
yeah, that's not the problem anyways, but why the overwrite goes differently
 
It's better this way. You know for a fact that the operation some_list[x:y] will return a list, and not just a single item, no matter what the values of x and y are
I don't understand what difference you're seeing
 
1:01 PM
I think a[x:y] = [2,3] should place a list in position x, that's it
not the elements only
 
That's silly because the y is pointless then
 
it's not silly and certainly not pointless
you are removing elements from a
 
Oh, that's what you mean. Ok, I see
That would be reasonable, I guess. I don't see an argument against that kind of design
 
thanks for the discussion
are you learning python as well? @Aran-Fey
 
Yep. Still learning even after 10+ years! :P
 
1:09 PM
i see. i come from typescript, find it both simple and messy
i like it, but...takes effort
 
Simple and messy sounds good to me. You can't really ask for more than that, I'm afraid
 
TS is so much better though..
have you tried ?
types in python seems good though
 
Yeah. They both have their strengths and weaknesses
I almost started balding prematurely when I tried to achieve the equivalent of -> Self in TS once
And then I started balding prematurely anyways because of PyRight
 
I thought increased stress induces gray hair first? /s
 
Nah, you can get hair loss from stress way before it has time to turn grey
 
1:14 PM
I'm already too far gone :(
Left foot's already in the grave
 
do you mean -> this ?
 
I don't think that's valid either in python or in TS?
 
@roganjosh welp, already went from 3 up to 30 gray hair...I don't know if missing some hair is already sign of balding but I guess that's all for now
 
you can just use the name of the class
 
That's disturbingly similar to me. I've done well so far but this is the real crunch time to decide on whether or not I start dyeing it
 
1:18 PM
just change job
it turns back to colour
my last interview i asked the interviewer how much he sleeps
he refused to reply
 
@roganjosh Thought about that too, but didn't do it yet. I don't know why, just can't put my finger on it (yet)
 
There's only a snapshot window within which to make the decision! You leave it too late, it becomes obvious to everyone that you've started doing it and if you don't do it soon enough, you'll become the silver fox that was always waiting to burst forth from you :P
 
@MahNeh I would recommend you to check out: workplace.stackexchange.com Also, FYI, personal inquiries during an interview to whoever is interviewing you is obviously not a good idea (in general cases)
@roganjosh Haha, didn't think about it from that angle. Yeah, maybe it's a good time I start thinking about it hmm
 
@MahNeh people have different tolerances to stress and make wildly different decisions on what they are willing to do. During lockdown, I was doing 18 hour days, 6 days a week, purely so I didn't lose my mind. I was stressed as hell, but it'd be even worse to not do it when my mind would be left to itself.
 
i think people get trained to want to work too much
studies show all the bad things one can expect from working more than 40hrs a week
especially in the US
obviously part of it is due to neoliberalism
we could all live longer, have more meaningful lives, better mood, but uncle sam says no, not yet..
 

« first day (4942 days earlier)