« first day (2901 days earlier)      last day (2271 days later) » 

22:01
I don't think they have guns, only a banhammer in addition to the mjölnir
Banhammer sounds lame tgough, in comparison
I'm sure mods living in states with guns can wield guns :P
Woo, seems I can no longer edit comments from my mobile on chrome
I earned a talkative badge... I am talkative but didn't know I deserved a badge for that. Inspirational SO!
@roganjosh doesn't sound quite as cool... but you don't want to be the user that it's wielded at :)
22:08
I'm so sorry, take 10 sausage rolls. It's all I have. Please, spare my fictional children.
@AaronHall Nope, but of course you can explicitly cache it as a default arg, eg def func(x, list=list):.
@PM2Ring assuming that the global namespace at the time of the function def list is actually the builtin list
that sounds like a safe assumption to make
Not with some of the code we see on SO. :D
It could be an optimization to do from builtins import *...
22:12
list = [1, 2, 3]

def f(iterable, list=list):
    return list(iterable)

f([4, 5, 6])
list object is not callable... :P
May 24 at 10:09, by PM 2Ring
BTW, Knuth actually said: "We should forget about small efficiencies, say about 97% of the time: premature optimization is the root of all evil. Yet we should not pass up our opportunities in that critical 3%."
@PM2Ring modern day is "get your MVP going and finesse the details later because it's cheaper to add more computer power than human work"...?
The problem I have with that statement from Knuth is that he has immense knowledge. Way more than 3% of the problems that merit reading through on the Python tag have catastrophic complexity
and it's not quite the mainframe thingy anymore (although it's becoming more so strangely)
so I'll have to admit to having known I've got the algorithm wrong, don't have time to re-write it due to deadlines, and it's so much cheaper to just get a server in the cloud for a few hours to return results than it is for me to fix it right at this immediate moment....
22:23
@JonClements wrong as in wrong result or just inefficient?
@JonClements Well, sure. OTOH, it's nice to have a rough idea of the relative efficiencies of various techniques so that you instictively choose good tools for a particular task, rather than "Shlemiel the painter" algorithms. Certainly don't waste time micro-optimizing every time you start to build something.
-1
Q: Comparing values of two keys in a dictionary and saving the highest value

New GuySo I'm taking my dictionary key:value pairs from a list and I want to create a dictionary out of it. They keys are years but each year occurs 12 times, I want the highest value of each year to be stored in my dictionary. This is hottest_day{} which represents the hottest day of that year. I've ad...

@vash_the_stampede what about it?
little tussle in the comments, didn't great content to solve it
as far as input and expected out
bruno can be very direct but his answers are usually correct, and he's answered it
22:28
didnt evne notice his repsonse
I'm not sure there's anything for us to get involved in on that
stackoverflow.com/questions/52507426/… hahah rogan had we not had this conversation earlier
I would make a joke to you here <3
Literally linked and image to his textbook hahahah
Oh wow, I hadn't actually opened the link
Python timings can be counter-intuitive to people coming from fully-compiled languages. An O(n^2) algorithm using builtin C functions can beat an O(nlogn) algorithm using Python loops, even when n is in the hundreds.
@vash_the_stampede I'd rather not have extensive "look, low-quality content" sessions here. If something is actionable, cv-pls requests may be in order.
22:31
@AaronHall @PM2Ring it's correct - just takes a little longer sometimes than required... sometimes it's easy to see if computations are just not required and fix 'em, sometimes it's just easier to throw another few cpu cores at it kind of thing...
@vash_the_stampede The best one I ever saw was on SE.Math. The OP posted a phone photo of an exam page, complete with his name at the top of the page.
I'm going to get down voted soon I want to answer this question wish me luck :-D
@NasrinShirali I'm curious to see :)
TIL python still interprets absolute imports as relative imports under certain circumstances. From PEP 302: "For example, if a package named spam does import eggs, it will first look for a module named spam.eggs."
22:35
@JonClements I can't see the contents, only the link name :( Were the 10 sausage rolls only enough to spare my fictional kids or could they buy me some extra powers on SO?
stackoverflow.com/questions/52502019/python-functions-program , how about something like this , its clearly a assignment, the OP did the bare minimum but as far as whats left to resolve it there is much that is just dropping the load on someone to write
should that be flag to close etc
@roganjosh ^
my eyes!
but honestly the absolute value of his earned votes is higher than my best answer
"he help me write dis 4 alcohol". Not gonna lie guys, if that's the bar I have to reach to post an actual question, I'm in the pub all night. dis is my dream.
@roganjosh I read this doc to find the answer
didn't know pandas
so I might be wrong really
22:39
how is the week partitioned we have Kardashian Fridays, informed by Jon but are there Karaoke Kode Tuesdays?
you have to code along to your favorite program
@Aran-Fey that's got to be trolling
@vash_the_stampede nope - wasn't me that said that!
If that's a troll, it's a pretty bad one - I had a good laugh :D
@NasrinShirali if you don't know pandas, you're on shaky ground with that one. It appears to recursively go through the replacement dict if a value is found as another key
22:41
@Aran-Fey wtf?
@NasrinShirali you could use this in your code too and replace how he is doing rev
l_rev = lst[::-1]
Heh, me too :) But that was accompanied by a fair amount of cringe, which set off my That Person Is Trolling Detector™
@Code-Apprentice ¯\_(ツ)_/¯
df2 = df.B.map(dct).fillna(df.B)
df3 = df.B.replace(dct)
@vash_the_stampede no, there is no need to do that. And it's not integral to the issue being demonstrated.
22:44
the replace he's comparing his df1 with is above replace whereas what he's doing is
df.B.map(dct).fillna(df.B)
@NasrinShirali look at the answer by piRSquared. It's cascading down key/value pairs
off to bed folks... see you'll in the morn.
dct = dict(zip(lst, lst_rev)) you can get rid of having to define lst_rev and just go dct = dict(zip(lst, lst[::-1])
@JonClements rbrb, don't Banhammer me in the night :P
22:45
@roganjosh eliminates a definiton thats not good ?
@roganjosh don't give me a reason to and we'll be fine :p
@vash_the_stampede reversed is a built-in
@vash_the_stampede Yup but didn't want to change his code there and also reverse is a buit in
yup
@roganjosh I know im saying it shortens the code you dont have to spend the time defining l_rev as lst(reverse(lst)) but not that thats important to the question at hand
you can only use reversed on a sequence...
22:48
You can only use [::-1] on a sequence too?
so if memory's a concern, you have to have it in RAM
there's some trickery you can do in some cases but...
I had a typo in my answer @roganjosh I guess I'll let it be for opinions if that's correct it'll be fun :-D
Obviously everyone is welcome to answer, but I would caution against it on that problem if you are not familiar with Pandas.
Humm.. How can I get feedback then? Twitter! here I come!!! @roganjosh :-p I also love dev.to it's cozy
@JonClements Or an object that defines __reversed__, eg range. It baffles me why someone would pass a range to reversed rather than adjusting the range args, but I've seen it a couple of times in the last few days.
23:04
@NasrinShirali the issue, as I see it, is that it shouldn't depend on the ordering of the dict, and fixing this one example does not fix the underlying behaviour
Stuff like that can easily go under the radar
@PM2Ring sorry the "Itbaffles" triggered my OCD so I edited it... umm but yeah... there's so many techniques you can use depending on the use-case of regarding something backwards when your iterator can only go forward....
@vash_the_stampede reversed(lst) efficiently iterates backwards over the list. lst[::-1] makes a reversed copy of the list, which consumes time to make the copy, as well as consuming RAM. But it's ok for small lists, since the iterator returned by reversed occupies some RAM, and takes a short time to set up.
I just generally find though, that if you're really that worried about those concerns, you just bulk upload to an RDMS and let that do the heavy work.
@JonClements Thanks. It can be hard to see all my typos on the phone, and I didn't want to double ping you over a missing space.
@PM2 np
23:12
@PM2Ring curiosity; can you still edit your comments from your phone?
@roganjosh I need sugar in my tea to think about it and I cannot reach the sugar packet, it’s on the top shelve and I’m 153cm and apparently no one cares about my need :-))) . But thanks for helping me get it
Yup I did it right now
If I try, the edit menu appears for a fraction of a second and collapses
I’m on an iPhone
I got my phone 2 days ago so I think there's an issue in Chrome
I’m on chrome too.
23:14
But since they are ****ing about with the UI on a daily basis, I'm not sure I cba raising a Meta post
When I’m on my laptop and check it on my phone it freezes for like a fee seconds.
0
Q: Python3: How to compare data of two dictionaries which is nested and dynamic in nature?

akshay kumarI am trying to find a way to compare two dictionaries without any library but the data is nested and keys are not ordered too.The data is dynamic in nature meaning the the keys in dictionary will change and nesting also. I am not able to parse the dictionary if the nesting is not fixed. Eg data-...

so whose gonna get that ouput
What output?
look the desired key names
who can do that
wanna see it done
so the key has two dictionaries and the one with differences is returned into a key name key[idx].valuekeyname: [items of difference]
The expected output is confusing, borderline nonsense
23:19
I sometimes do not understand the questions. Is it just me?
I bet @PM2Ring can do it
A flat dictionary that has list indexing in the key names
@vash_the_stampede I bet you could do it if you wanted to
Chat is not here for goading people into answering nonsense questions
Thats why I still have it open , I will :)
@vash_the_stampede Yey.
"Goad" added to my dict!
@NasrinShirali don't ever use the expected output from that question
23:27
Ah ok, I got the question now. Why @roganjosh
because "friends[0].name" is a mess as a key. You're collapsing data on the structure of the output into a string
Yes exactly
@NasrinShirali exercise: I want the name key of the first index of friends. Go :P
@roganjosh Yes, I can, although it's not fun because the interface is rather cramped. I normally use the Samsung browser, which I suspect is a fork of Chrome.
Ok one thing is bothering me a lot and it's the color of text when I want to edit. It's while and this box is baby pink... I really think it's not convenient
23:31
Raise it on Meta, they are more than receptive to user ideas to improve things </sarcasm off>
I'm way too self-conscious to be expressing myself anywhere on SO :-D it's amazing that I am doing it here now
Don't send me places, I'll end up crying
Meta downvotes don't affect reputation
I don't care about the reputation really. Getting a down-vote is scary. Told you I was down-vote phobic!
@vash_the_stampede Forget it! The input data is too flakey. " the keys in dictionary will change and nesting also". Since the key structure may not be consistent between the 2 input objects it's really hard to know what to compare. OTOH, if the OP means that the 2 objects will always have matching structure, but that the structure can change from one run to the next, then it's fairly straight-forward. The only tricky thing is dealing with the order of the stuff in lists.
@vash_the_stampede I might try solving this question with Pandas, maybe
23:44
@NasrinShirali I really wouldn't bother
At least I'll learn Pandas in the process.
Unlikely, you're chasing a dragon
Get on the pandas tag and find some questions with at least an upvote
Umm.. Ok. I'll do that then :-)
Honestly, this is not worth further consideration as far as I am concerned
And you can find those by stackoverflow.com/search?q=%5Bpandas%5D+score%3A1 and then click "newest"
23:49
Thanks @JonClements
how do I make it limited to exactly one
[pandas] score:1 is:question
I'll go to Meta and put this there as well. Get beaten up. Come back here :-P
@NasrinShirali no reason to put through Meta
I wasn't suggesting "exactly one", I said "at least"
anywho, bed. rbrb
I know, I wanted to know how it's done... just nosy
rbrb

« first day (2901 days earlier)      last day (2271 days later) »