« first day (3584 days earlier)      last day (1347 days later) » 

1:00 AM
@roganjosh you can make game-bots with it (its not the most effective means but I've seen it)
In specific we made a version which just demolished Chrome's "No Internet Connection" T-rex run game as a fun "hour of code" project once
I've also used it for certain automation task (which I would not call "scraping") where functions did not exist in an API (or there was no API). For instance, I used to build scripts which auto-logged into aviation sites and download all the latest manuals I was going to be using for the week (within some other automation which feed a maintenance database we used for various planes & helocopters) - was very Gov based so no API
Saved a lot of time (used to have to "click->download->wait->click->download->wait" whereas this I just threaded a few processes and worked on other stuff until it was done). There were also separate manuals based on engine and other part types and all had to be downloaded too (so second round of automation).
 
 
1 hour later…
2:13 AM
@roganjosh Of course: GUI/UX test automation. People have been using it for that for a decade.
 
2:42 AM
@roganjosh Don't know, please add a canon if not exist.
 
3:27 AM
@roganjosh Front end testing?
 
 
2 hours later…
5:12 AM
Please see sopython.com/chatroom for rules on posting questions.
 
 
5 hours later…
10:20 AM
I guess I'm just having some bad luck on the Selenium question lottery. I'll keep it for now since some of those applications could be interesting
 
 
1 hour later…
12:01 PM
SO seems a bit flaky this morning.
 
Ah, it's not just me then. I've also had an unstyled white screen of "this service is unavailable"
 
I just closed speedtest to see if my internet was having issues
 
12:56 PM
Looks like we're back to double-posting with whatever the site issue is
 
Some things are working no problem, others hang...
 
If you look on the main feed, there's a number of questions getting repeated. Should we be flagging them? (It's obviously not the OP's fault)
I don't know how SO does a clean-up from these issues and whether it can re-sync itself and get rid of them or whether flagging is actually useful. I wouldn't be surprised if the OPs aren't aware that they post twice
 
Do they have different post numbers in their URLs?
 
Yup. See e.g. this and this. In that case, it looks like they realised and deleted one of them
The alternative is that they're being flagged as dupes which doesn't make too much sense :P
 
Done
 
1:39 PM
Java == problems
Despite my inflammatory remarks, I'm reminded that I need to pick Kotlin back up. I haven't done quite so well on my "ooooo, lockdown. New tech learning" wishlist :/
 
@roganjosh they can be merged, and it's suggested to avoid downvoting
 
I certainly haven't downvoted them because I'm aware it's not their fault. I'm just curious whether my "huh, this is borked" should be translated to a flag so that a mod can do the merge or something
 
2:10 PM
@roganjosh flagging as dupes absolutely makes sense. It’s the quickest way for the community to handle these. Especially for gold badge holders. Posts by the same author Can be flagged and closed as dupes without the requirement for any answers on the dupe target.
 
OKi doki. I assumed that a system hiccup should be addressed differently rather than just duping a carbon copy, but I'll do that in future
 
I canny see deleted posts (yet) :(
 
Sorry, missed that it was deleted in the meantime.
> Search prevents double posting and since that's down, it slows down posting leading users to think it failed to post and resubmitting the question... thus causing double posting. This should fix itself once we get search back up. – Catija
 
@roganjosh Why did I think you were > 10k?
 
2:13 PM
No worries. I get the sentiment anyway
I dunno. My super awesomeness?
I'm slowly inching my way towards it, but it's... taking a little longer than anticipated :)
 
Search should be back up now and the duplicate questions should stop happening. Let me know if y'all see anything else that is off.
 
Thanks for dropping by on a Saturday :) Enjoy the rest of your weekend!
 
2:32 PM
@Catija \o/
 
🎉
@roganjosh thanks! You too!
 
 
4 hours later…
6:48 PM
> New in version 3.9: backported to 3.7 and 3.8
Not sure what to think of that...
 
 
2 hours later…
9:10 PM
guys I have been struggling to debug a problem on my script for a few hours, but I can't grasp what's going wrong. It's a very big function so it's hard to provide a MCVE but here goes some pseudocode. I hope some kind sould can help me!
d[name] = {}
d[name].update(t[tName])
# 1
register(d, [name, 'a', 'yes'])
# 2
def register(jj: dict, lista: list):
	for name in lista[:-2]:
		jj = jj.setdefault(name, {})
	jj[lista[-2]] = lista[-1]
	return
if I print dictionary t on moment #1, it's ok. if I print it at moment #2, it has been changed somehow by register() function
what in earth is leading to this? I only want to edit dictionary d with the register function callback!
 
What is t? I'm pretty sure that isn't an MCVE
 
t is a dictionary
it's pseudocode
 
I can see that t is a dict, but it doesn't help me help you
 
t[tName] is a nested dict inside t, containing several nested dicts of it own
what I need to know is: what could possibly lead to t changing when I'm changing d?
 
The best I can stab at is that mutable objects in the global scope can be altered inside functions
 
9:23 PM
both d and t have been defined outside the function where pseudocode lives
as empty dicts
 
a = {'b': 1}

def something():
    a['b'] = 2

something()
print(a)
 
yeah I understand that, and I was expecting that
 
Ok, so please narrow it down to the bit that's surprising you
 
if I print t both on moment #1 and moment #2, it looks different, even though there's only one line between them, where I'm editing dictionary d, not dictionary t
they seem to be somehow linked
but I didn't use
d[name] = t[tName]
exactly to avoid them being linked
opting for .update instead
 
That doesn't take a copy
It's the same object; see nedbatchelder.com/text/names.html
 
9:28 PM
I'm pretty sure that code can't produce any unexpected behavior. It would require 1 more level of nesting; something like register(d, [name, 'foo', 'a', 'yes']). In that case, d[name]['foo'] and t[tName]['foo'] would be one and the same dict
 
Just to affirm, do import copy then d[name] = copy.deepcopy(t[tName]). You probably don't need a deepcopy here but I just wanna cover some bases to see if that gives the expected behaviour
 
in the actual code there are more levels of nesting indeed @Aran-Fey on the register() call
why would they be one and the same dict, though?
 
Well, does my suggestion work, first?
 
It's no use going forward if that doesn't work, because it suggests the problem is elsewhere and I'm not sure I follow the code anyway
 
9:35 PM
@PedroSpinola Well, because dict1.update(dict2) registers the values of dict2 in dict1 without creating copies of them. Doing d[name].update(t[tName]) is pretty much equivalent to doing name = tName - you end up with two names for the same object.
 
sry it takes a while to test, but it did work indeed @roganjosh !!!
ohh I see @aran-fey ! this page led be to believe it was not the case:
https://www.w3schools.com/python/ref_dictionary_update.asp
 
Ugh, I see w3schools and my heart sinks :P
Please take some time to read the article I linked from Ned
 
what should I use when I need to add a copy of a dictionary to another dictionary? maybe:
 
copy.deepcopy :P
 
k = copy.deepcopy(d)
finalDict.update(k)
 
9:38 PM
yeah
 
piR is not here to provide an unpacking monstrosity :P
 
alright, awesome! I appreciate, guys, really! :D
I'll read that page right now
 
Oof, deepcopy with unpacking? You'll need to throw recursion in there, as well
 
@Aran-Fey true, I was just thinking of a shallow one
 
I originally said that you probably don't need deepcopy; I just wanted to test an approach and have no ambiguous issues. It seems, if you have nested structures, that a shallow copy won't work so you may well be stuck with deepcopy
 
9:41 PM
Petition to add a deep-unpacking operator ***
 
@PedroSpinola which page?
 
Jul 27 at 22:30, by Pedro Spinola
this page: https://nedbatchelder.com/text/names.html ???
about time you read it then ;)
 
damn I expected you not to remember it
lmao
I didn't
lol
 
You're fairly new to python so I made sure you were informed of the potential pitfalls early on
 
9:43 PM
It was 2357112 that told me that deepcopy runs in Python and I have no idea why (not why they said it, but why it isn't in C)
 
yeah @roganjosh I get it, thanks! why you say "stuck" , though?
 
@PedroSpinola because it's costly to make copies. I tend to do stuff in loops that I want to run as fast as possible
 
10:13 PM
I see rogan!
@AndrasDeak indeed I should have read that before! I thought I was getting intuitive grasp for this matter, and was indeed, but it's all clearer now :)
this page should be on all python tutorials tbh, this stuff is not intuitive imo!
btw, in the end of the article the author mentions that '“list += seq” not the same as “list = list + seq”'. It is because on first case it would be changing a value, and on second case it would be making a new attribution for name list, correct?
This stuff is not yet 100% clear to be, and I'm still afraid to commit mistakes, but it's much better now. Thanks again :D
 
+= modifies the list in-place, whereas + creates a new list
 
awesome! what I don't get is why there ain't no easier way to make COPY of stuff in python. that code.deepcopy stuff should be a default python method, no?
 
Why?
 
I'm quite a beginner of course so I might be making wrong assumptions (both in programming and math), but from my experience I believe in math when you say a = b, you are making a COPY, not an assignment. Therefore if in the next line you say a=1, it won't be expected to say b value changed.
 
Well, math is a declarative language. There's no such thing as a copy, really
 
10:26 PM
yeah, your right
but either way, why ain't there something like
a ==== b
or something like that, when I need to make a copy, not an assignment?
don't know proper syntax, but shouldn't matter. just should be easy.
well, only my novice impressions anyway lol
 
It is easy. You just have to understand copies
It's already implemented and you're just making up your own syntax
 
maybe I'm confuse then. how should I make 'a' a copy of 'b' ?
 
copy(a) is a start. Or a[:]. Depends what it is
 
I could make b a new list, and loop through A items and append them to b, maybe?
ohhh I see a[:] is interesting!
 
I don't think we'll be anywhere debating thing but one thing you really should know. Do you know the difference between a shallow copy and a deep copy?
 
10:33 PM
no debate, you won already :P
I do now, I think
 
Not a debate, a question
 
deepcopy would be for nested stuff
right?
 
Yup, probably good enough to get through the interview :)
 
a = [1,2,3,4,5]
b = [1,2,3,[1,2],[5,6,[9,10]], 11]
to copy b I'd need a deepcopy, and to copy a a shallow one
 
@PedroSpinola no kidding
@roganjosh copy doesn't exist though. a.copy() does.
 
10:43 PM
I think he means copy.copy(a) @AndrasDeak
@AndrasDeak :P
 
Nah, I was just wrong
I did mean that, in principle, but I messed up on syntax
 
when you know you have a list there's no need for copy.copy. lst[:] and lst.copy() and list(lst) all copy.
 
so a = list(b) is making a copy of b?
 
Ok, well that isn't true because that list could contain dicts
 
@PedroSpinola That's what I just said.
 
10:46 PM
just to be sure :P
so copy() is a method in python but there's also copy.copy ? wtf
 
@roganjosh if the list contains dicts than all three will give you shallow copies
 
You can't pull me on my statement and then make a statement about a flat list with no caveats :/
 
@PedroSpinola some builtins don't have a .copy attribute so when you can have both a list and a tuple and want to ensure you have a copy, you can call copy.copy
(edited to make sense)
 
I see!
 
Not that you often have to do that...
 
10:54 PM
Yeah I know. I'm only using deepcopy for my dict because I really need to have a 'frozen' version of it for reference while making changes to the copied version.
 
Why are you mutating it?
Also, I got a bit defensive. I've picked my toys back into the pram and Andras was correct, apologies
 
no need
to apologize I mean :P
 
:P
More fool you. I now have all the toys
@PedroSpinola in any case. It's your choice what values the dict had. Is this a library you intend to release?
 
11:58 PM
I don't know how to properly explain @roganjosh, it's complex. I'm building a program to make some scientific decisions so I have to make a lot of calculations aswell as qualitative differentiations on the flow of the program. I use nested dictionaries to write info from SQL, afterwards to consult this info, and later to insert or change info on it.
Probably there's a better way to do my dataflow, but I'm not aware.
God no, I'm far away from releasing a public library! As I told ya, this I'm building is a prototype for my startup.
 

« first day (3584 days earlier)      last day (1347 days later) »