« first day (1437 days earlier)      last day (3505 days later) » 

12:29 AM
is anyone around who could PLEASE help?
I can't figure out why a substring of a string is always returning '' instead of an actual value
 
@Daи paste code
 
1 message moved to Trash
 
removed_stems = [', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '']
 
@corvid it wasn't that amusing, and I don't like people staring at me
 
12:33 AM
"davidism has invited you to join Trash" T_T
 
the idea is that comparison_dict has things like ['walking': 'walk']
and removed_stems should contain 'ing' for that word
 
@Daи and why do you think this has anything to do with unicode?
 
@davidism it did have u's in front of them until I figured out how to enclose variable names in str()
but that didn't fix this issue
 
I don't know anything about nltk, perhaps it has guidelines regarding encoding for user input, output, as well as unicode?
Why do you think unicode is the problem?
 
@davidism yes but the problem is with line 33 in that paste, not nltk-related at all
 
12:34 AM
It is typically good practice to work in unicode, converting to for input and from for output.
 
take a string: 'striping' and then take 'striping'[5:] and it should be 'ing'
I am instead getting ''
 
Paste a sample input to the function and expected output.
 
If I remove all the str(), it now returns only u''
@davidism the brown corpus returns a list of words
 
maybe something a little smaller?
 
i iterate thru each word, stem it (remove suffixes)
 
12:37 AM
Just so I understand what's going on without installing nltk
 
@davidism 10-4, sample pastebin coming
is there a place online for python testing?
@davidism here: pastebin.com/wDH9DsPF
it should return removed_stems = ['y', 'mer', 'ed', 'ing']
 
you're slicing the wrong thing at the end
it has nothing to do with unicode
@Daи should be key[len(value):]
 
12:53 AM
@davidism huh?
that doesn't work
 
works for me
 
no such variable value
I'm using v
 
come on, change the variable names, don't just blindly paste what I give you
 
@davidism I mean, do I even need v = comparison_dict[key] then?
why wouldn't it treat v like a string?
trying to understand
 
hold on
hold on, brownies are ready :)
 
12:57 AM
doh! I got it!
sorry, that was really dumb of me
 
comparison = {'The': 'The', 'lazy': 'laz', 'programmer': 'program', 'typed': 'typ', 'an': 'an', 'example': 'example', 'for': 'for', 'testing': 'test'}
for key, value in comparison.iteritems():
    if key != value:
        print key[len(value):]
 
I'm good for that
 
 
1 hour later…
2:21 AM
Anyone up?
 
nope
 
:/ damn.
Can you help me with C/Objc ?
 
Nope - don't know anything about it
 
Do you plan on learning it anytime . . . maybe?
 
It's certainly not a technology I plan to be specialising in anytime soon... so unlikely
 
2:29 AM
Oh. . . I could wait. But nvm then.
:D
 
Is 4:33 usually close to bed-time for Jon Clements?
 
It's 3:33 and yes... one is going to get a couple of hours sleep in a moment :)
 
Hi All
 
GO BACK TO SLEEP @CoKoder
 
2:40 AM
@Owatch, i need to fix something, after that i can go back to sleep
 
Okay.
 
@Owatch, why python is saving my json with unicode and single quotes?
 
why do you think it's "unicode and single quotes"? Also, json doesn't care if it's single or double quotes.
 
I don't know, I'm probably not the best person to ask.
 
2:54 AM
@davidism, I have json data like
{
"id": "123", "data": [{"Name": "co", "height": 100},{"Name": "co2", "height": 200}]
}
I first save this into the database
after that i try to get this data to send
but when i try to fetch it, it becomes like this
 
you're passing in ascii data, but most database drivers will use unicode where possible, there is no problem
and double quotes are a style choice you make, but the python interpreter will prefer single quotes
 
{
"content" : { u'id': u'123', u'data': [{u'Name': u'co', u'height': 100},{u'Name': u'co2', u'height': 200}]}
}
 
@CoKoder That's weird. Are you properly sending this data>
 
@Owatch there's nothing weird about that
 
Apart from the fact that it's wrapped in a single-item dict (which is a bit odd), that's exaxtly what you'd expect: it's the Python data structure represented by the JSON document given.
 
3:00 AM
actually json.dumps should fix this, but it does not apply inside the jsonarray
 
Where did "content" come from?
 
@CoKoder link a paste of the code
 
java web service
 
You must be confused, this is the Python cabbage.
 
>>> input_json = '"Hello"'
>>> json.loads(input_json)
u'Hello'
The JSON needs double quotes, but what you get out of it is just a string. When the Python REPL prints that, it uses ' and puts a u before it to tell you it's unicode.
It still converts back to correct JSON:
>>> output = json.loads(input_json)
>>> json.dumps(output)
'"Hello"'
 
3:11 AM
Basically, don't confuse the Python representation with the JSON representation.
 
@davidism ahh... finally remembered what it was I was going to ask in re: flask
 
good timing, 30 minutes before it's time for sleep
 
@davidism haha... any recommended practices to securing most of flask routes, but exempting a couple...
 
@davidism, i have linked a paste of code
 
3:19 AM
@CoKoder I can't run that. Also, I can't reproduce you problem. dumps() produces valid json for me. Also, did you read what zero, veedrac, and I wrote?
@JonClements yeah, it's weird that flask-login and other security packages have no documented way to say "login required by default"
 
@davidism phew - not something I missed then
good - was just worried it was me being stupid
 
In fact, you kinda have to roll your own solution in this case. You can use before_request to check login/auth every time, but you'll need to manually mark and check which views are exempt.
 
@davidism kind of what I was thinking... just wanted to check I wasn't missing something already out there that did it
 
@JonClements working on a flask project now?
 
Yup... geomapping and charting system... shall be interesting
Anyway thanks... won't need auth stuff until much later, was just researching options, for what I'd have thought should already be implemented in something, but apparently not :)
 
3:31 AM
I just wrote a basic login and permission system for sopython, didn't bother with the existing extensions. None of them are doing anything very complex; whenever I use them I end up writing a bunch of code anyway.
 
Yup - anyway... I'll worry about it later... thanks for your advice :)
 
@Veedrac, can we do the same thing for jsonarray?
 
What is jsonarray? Also, why is this conversation taking 10 minutes between messages?
It will work for any valid json data
 
because I am struggling to fix it
 
3:57 AM
Like davidism said, "What is jsonarray?"
 
@davidism It would appear that jsonarray is a java thing. @CoKoder Python is a proper language with proper data structures; used correctly, it converts JSON (a serialization of a data structure) into a geniune built-in data structure with no need for such nonsense.
 
Anyway, Python's json module will load valid json, it doesn't matter if it came from Java's jsonarray. Is there even a problem? I can't tell.
 
4:14 AM
So, complete tangent: UKans among us: how do you feel re: the Scottish Independence referendum? We talked a fair bit beforehand, but now it's all done ... relieved? oppressed? vengeful?
 
@Zero we shall see in time... I'm sure there's individuals in all of those categories though :)
 
It saves me a decision at any rate: if I ever do go back to my homeland, I no longer have to decide between Toryland and the Chilly Peoples Republic ;-)
 
Of course if the promised EU referendum happens (in which case exit seems inevitable), that'll be enough excuse for a repeat ...
 
It will certainly be an interesting general election :)
 
4:23 AM
I was unexpectedly in the UK during the last GE (and the run-up to it) - was surprised at how excited I was by it, given that it doesn't really affect me that much these days. Might have to arrange to be back in '16 as well ...
 
Feel free to pop by if you are :)
 
No, it's '15 isn't it?
 
although you'd be a year late :)
 
quite likes the idea of turning up at a church hall or community centre demanding to vote exactly one year late ...
 
"It's not my fault - the flight was delayed!"
 
4:28 AM
I'll just claim it's a daylight saving time thing between the northern and southern hemispheres.
It was really weird moving from Bolivia to Chile - I moved several hundred miles further away from Blighty, but ended up with an (at that moment) smaller time difference due to DST.
 
@Zero it's not a completely sane world - you may have noticed :)
 
@JonClements Yes.
To save you following the links: officially, Chile changes to DST in late April every year, whereas in reality it hapens in early March every year. For small-p political reasons I have yet to comprehend, the governement never actually announces this until a couple of weeks before it happens, with hilarious consequences.
TZDATA can't change until it's official, and distros take a while to catch up with the latest TZDATA, so we get the same nonsense every time.
 
Sounds likes a sound governmental strategy... if I had a country, I must turn around one day and say... you think it's September... haha... well it's Christmas day fools!
 
Maybe there's method in the madness - "ha! you thought we were all asleep, but in fact we got up early and beat you to the sale!" or something.
Of course if I were dictator, I'd want to name a month after myself. Cities are small fry ... the Romans knew what they were doing.
 
4:45 AM
I'm not sure which is weirder, that governments keep messing with the timezone, or that distros don't have a better upgrade strategy for a package that is known to update every quarter.
 
@davidism in fairness I think it's reasonable to expect a little more notice from a supposedly first-world country re: changes to 25% of the classical dimensions of reality.
 
A bunch of really smart OS creators can't figure out how to upgrade repos faster than every six months. Oh wait, just use a rolling release schedule! Ubuntu will catch up some day. Arch and Gentoo and others work right now.
 
I'll play with Arch some day .... Shuttleworth is bound to annoy me enough at some point. I tried Gentoo and just couldn't cope with the feeling I was among prepubescent boys.
 
None of it will matter when Vogons show up to demolish the planet to make room for that new intergalactic highway.
Gentoo is a pain. I didn't really notice the user base, but compiling everything got to be too much effort.
The docs, wiki, and forums of Gentoo and Arch are really detailed, which is nice.
 
I did jump ship to Debian for a while after three consecutive releases of Ubuntu had a broken Samba - but (unlike, it seems, everyone else in the world) I actually really like Unity, so it would be a wrench to move away. Have toyed with recent GNOME in VMs and been underwhelmed, and KDE is just sickeningly awful.
 
5:04 AM
you liked Unity? :)
I kind of liked it at first, but then after using it more, was just, give me GNOME back
 
@JonClements I would even go so far as to use the present tense :-)
 
I can't figure out what's wrong with KDE. It looks good, is completely configurable, but somehow is a pain to use.
 
In the old days... KDE was a preferred choice over GNOME, then it got a bit weirdo, so I preferred the other way around... then swapped back for a bit... then swapped again
I'm happy enough with cinnamon these days
 
I don't have a completely vanilla Unity desktop - I have the side panel launcher thing smaller and autohidey, and probably had to switch to lazy focus, but otherwise it's very nice.
Oh and I don't have a Desktop folder. Stupidest idea of all time, and it's getting increasingly annoying to avoid.
I have this beauty in my crontab thanks to Firefox:
* * * * * rmdir $HOME/Desktop
 
seems a somewhat extreme work around :)
 
5:10 AM
Yeah, I turn off desktop icons in XFCE, so there's absolutely no point in a Desktop folder, yet there it is, taunting me
 
There is absolutely no way other than patching Firefox and compiling from source (and believe me I've searched) to stop it creating the folder on launch.
 
cbg @Jerry
 
cbg
 
It's strangely awkward when your avatar and mine appear in that order
(ahh... that's better)
 
Go on @Jerry, kiss him again :-)
 
5:16 AM
/me jumps behind Zero
 
:*
 
cbg @Jerry
 
cbg
 
co-leader :D
 
Ooo... one more answer until 1800 of 'em
 
5:20 AM
We should prepare something special for your 2000th answer ... a canonical of some sort.
 
@Zero could just buy me some tea and biscuits? :p
 
Okay, I'll bring Hob Nobs round next year when I come over to vote.
 
dog friendly chocolate ones I hope!
They did these caramel ones a while back... never been able to find 'em since
bit sickly... but oh my... so so more ish
 
If dog-friendly chocolate hob nobs exist, I'm unaware of them. I can report that the regular chocolate hob nobs are not transatlantic-flight friendly, after receiving a tasty but somewhat congealed birthday package from my sister.
Yes, they were doing the caramel (or was it toffee?) ones either last time I was back or the time before. Very nice.
Biscuits being out of the question, I wil ljust go and make some Yorkshire Tea :-)
 
5:31 AM
@Zero good choice... that's the main one I keep in the cupboard :)
(partial to some Earl Grey/Darjeeling occasionally, but normally Yorkshire Tea most of the time)
cbg @Antti
Right... my alarm's gone off which means I should properly go to bed... (being radical these days and doing things in reverse it appears)
 
Yeah, I like a good Earl Grey (or Oolong if I'm on a detox thing), but you can't beat YT. I also have marmite on toast ... and if I'm still hungry in twenty minutes, I might upgrade to marmalade :-)
 
marmite.... oh my god... if you ever pop by when you're over, I know we've got breakfast sorted easily then...
 
If I'm not having a bacon sarnie/fry up for brekkie (that's rare as I'm a light eater in the morning) - it's either marmite or marmalade on toast :)
 
Unless I have someone to impress, it's one of those or scrambled eggs.
 
5:37 AM
I cheat with scrambled eggs and just whisk them up in a microwavable bowl and shove 'em in that
 
If I do have someone to impress ... chuck marmalade, butter and a bit of water in a frying pan, warm up croissants, slice, put marmalade sauce inside and on top.
Guaranteed second date :-)
 
butter croissants I hope?
 
Of course!
 
hmhmm
 
Honestly, there's a lot this country gets wrong, but non-butter croissants just wouldn't happen here.
 
5:39 AM
not goin to impress me :D
 
@Antti I get the impression your wife wouldn't be so agreeable with the chance of a second date :)
 
Don't take this the wrong way @Antti, but I don't think my "guaranteed second date" schemes apply to you ...
 
:D
wouldn't work on my wife either but she needs noodles in the morning... :(
 
noodles? waaaaaat?
 
asians you know
 
5:42 AM
well - use to know a guy that had curry as breakfast... very glad I didn't live in his house/work in his office though...
 
Really? don't know a lot of Asians (mainly Japanese-American and Korean), but I don't recall noodles for breakfast. Weird variations on porridge, yes ...
 
it is not any noodles, it is soup
 
weird... always considered that a starter to a main course
 
Ohh, Korean soup. Damn that's good stuff.
 
5:44 AM
nope vietnamese noodle soup is always a separate meal
and the other soups are not starters but you eat them at the end
 
I must get educated in vietnamese food... sounds like it could be an interesting meal :)
(if you like soup that is... :p)
 
ah, wait...
good crash course is gordon ramsay's great escape
 
at the mention of marmite though, I'll just be digging that out later for brekkie :)
 
korean soups are great
if they have kimchi :D
 
I can't claim to be in any way expert on Korean cuisine, but the soups are just great, And bulgogi ... oh how I love bulgogi.
 
5:49 AM
+1
never been to korea but many of the korean dishes are familiar in vn
youtube.com/watch?v=Qc19DKqFoyY&t=258 <- there is the noodle soup that gordon considers the best in his life :D
"cooked by a lady with no teeth in a boat" :D
 
@ZeroPiraeus you made me google that... and yup... sounds up my street :)
 
To be fair, I don't have any teeth in a boat either.
 
hi anybody who can help me in python daemon
 
i want to call a script and pass an argument to it from python daemon
 
5:53 AM
@JonClements I was told by the first person who ever prepared it for me that it's traditionally served by a lady to her man, wrapped in a piece of lettuce, by directly placing it in his mouth with her fingers. It's possible she was embellishing slighlty, though ;-)
 
sounds romantic enough though :)
 
Worked for me ...
 
eat bulgogi with my gf but she just taught me how to wrap :(
ofc she was not a korean
*then gf
 
@AbhilashKumar What script? What daemon? What problem are you having? We can't help you if you don't give any details.
 
@ZeroPiraeus anw that list is flawed, it just has 1 vietnamese noodle soup :D
 
5:57 AM
Sep 18 at 5:15, by Abhilash Kumar
hi anybody here who can help me in python daemon
 
also I eat 10 of the foods on the list at home
 
@AnttiHaapala Officially jealous :-)
 
@AbhilashKumar have you managed anything over four days - and as @davidism mentions you need to provide more info. :)
1 message moved to recycle bin
1 message moved to recycle bin
 
2 messages moved to Trash can
 
Please read the room rules sopython.com/pages/chatroom and allow yourself a little patience for attention to be drawn to your question... although, it's certainly a much better effort than the one you posted here last week
 
6:01 AM
goi cuon, bibimpap, barbecue pork = char siu, fried rice, bulgogi, pho, green curry, kimchi, pad thai, tom yum, sushi, som tam at least on the list that my wife masters
 
path= "python XYZ.py "+ids
os.system(path)
 
@JonClements Trash can is the true trash room!
 
I'm just puzzled how we managed to move 4 messages when I only saw two :)
 
I tried to move 3, you moved 2 of them, and I moved the other 2. Math seems right to me.
 
ahhh... your moving message seems to have counted as moved... sighs
 
6:07 AM
Now that 2+2=3, I'm going to get some pretty good discounts at the store.
 
See if you can get them on dog friendly chocolate biscuits and me luv ya long time
umm... bbiab
 
I just remembered I said I was going to bed in a half hour three hours ago.
 
@AbhilashKumar you want to use the subprocess module, namely subprocess.call, say
 
I'd expect to find a dupe for that, but haven't seen a good one (in admittedly a short search).
@davidism I didn't bother trying to answer because "It keeps returning giving me an error" made me think that engaging with OP would lead down a rabbit hole ...
 
6:28 AM
I wasn't planning on continuing the conversation. I just like posting comprehension one-liners in comments.
 
Yep, seems reasonable to me ... and on one of the two most obvious interpretations of the quote above it'll hopefully help OP :-)
 
downvoted too
@ZeroPiraeus hem,
a function named average returning a square of a list is returning the list of squares of its elements :D
Also: "How do I Define the range and returning an array" :D
too much guessing
 
@AnttiHaapala I just assumed it stood for aminoethoxyvinylglycine ... as a non-chemist, that might be a perfectly cromulent function to have a name like that for all I know :-P
 
How to add list like this test = a[1,2,3,4,5]
 
sum([1, 2, 3, 4, 5]) == 15
 
@davidism no need to sum, i need a[1,2,3,4,5] only
 
As in, you want elements 1 through 5 of the list a?
test = a[1:6]
 
a[1,2,3,4,5] does not stand for [ a[1], a[2], a[3], a[4], a[5] ] but
a[tuple([1,2,3,4,5])]
 
6:59 AM
in which case a is a dictionary, not a list
 
@user3800040 your question is not clear. Because 1,2,3,4,5 is a tuple (and therefore a plausible key for a dictionary), your code test = a[1,2,3,4,5] could mean anything at all. For example:
>>> from collections import defaultdict
>>> from random import random
>>> a = defaultdict(lambda: [random()])
>>> test = a[1,2,3,4,5]
>>> test
[0.9476268314275231]
 
cbg
 
@all I select product A, 1-5 then i split the value like [1,2,3,4,5], now i need to add a[1,2,3,4,5]
 
Cbd
Or Cbg
 
7:15 AM
cbg @Bestasttung @RobertGrant :-)
@user3800040 I'm going to bed, but if you want an answer you'll have to explain yourself more clearly - with the best will in the world I don't have a clue what you mean. What are you actually trying to do?
 
@user3800040 Something like this?
from operator import itemgetter
sum(itemgetter(1, 2, 3, 4, 5)(items))
 
rbrb all ...
 
@ZeroPiraeus, I have a product Apple, i need to take no of apples like 1-5, then i save in another form like [1,2,3,4,5], now i need a apple=[1,2,3,4,5], then i select 6-10 means in needed apple = [1,2,3,4,5,6,7,8,9,10] how to get this...
 
Yeah that still makes no sense, sorry.
 
7:49 AM
How to make findall method to print only the matches not groups?
if i run this regex101.com/r/sT0fL2/4 regex in python, it should return only the groups 3,2,0 . How i tell findall function to print the matches only?
can' i use finditer method?
 
You should just use finditer and get the groups yourself.
import re
text = "hgfd 0022222233333 4444 5556555 0000000"
[x.group(1) for x in re.finditer(r"(\d)\1{4,}", text)]
#>>> ['2', '3', '0']
 
Cbg :)
 
Hello
Or maybe [x.group() for x in re.finditer(r"(\d)\1{4,}", text)]
Maybe even re.findall(r"((\d)\2{4,})", text)
It's hard to tell what you're looking for
 
i just want to print [222222, 33333, 0000000]
 
[x.group() for x in re.finditer(r"(\d)\1{4,}", text)]
 
8:01 AM
Oh, nice. Thanks..
 
cbg
 
cbg again
 
yeah, finditer is better than the findall magic
 
8:26 AM
cabbage
 
8:48 AM
Why the below code fails?
>>> text = "hgfd 0022222233333 4444 5556555 0000000"
>>> m = re.finditer(r'(\d)\1{4,}', text)
>>> m.group()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: 'callable-iterator' object has no attribute 'group'
 
It probably fails because a callable-iterator object has no attribute 'group'
 
@Ffisegydd Right on the money
 
so what's my code would be?
>>> for i in m:
...     print i
...
<_sre.SRE_Match object at 0x7fb7960df558>
<_sre.SRE_Match object at 0x7fb7960df5d0>
<_sre.SRE_Match object at 0x7fb7960df558>
 
Damn straight.
@AvinashRaj have you considered researching your problem yourself? Maybe opening the docs? Rather than asking here?
As your problem is easily understood if you'd just take the time to read the docs.
 
i didn't get anything from the above.
 
9:02 AM
'callable-iterator' object has no attribute 'group'
 
And yet I got everything from it, I understood your issue straight away by checking the docs. I suggest you read it properly and try to actually understand what it's saying.
And if you struggle with the Python aspect of it (i.e. you're strugging to comprehend the Python code/terms), then I suggest you start with a tutorial.
 
cbg( all )
(it is amazing how limited the chat md is..)
 
Yeah it can be a bit annoying. Especially when using italics as a period can mess it up at the end of a sentence
 
and the lack of multiline MDs, and that you cannot "merge" italic and bold text..
or this last one I wrote:
`cbg(`*all*`)`
and it made one big code block
 
9:18 AM
Maybe once standard/common markdown has settled down a should be put in for a better MD engine.
 
with the asterisks inside
@Ffisegydd hopefully
 
9:29 AM
I was wondering if people realized the PyPy is now faster than C++.
 
@Veedrac cool. Is the memory usage comparable?
 
Not really
I'll get you some numbers
It's really hard to tell because almost all of the memory is the interpreter in PyPy's case.
PyPy is using ~70MB of memory, C++ is using ~2.5MB, but more than 60MB of PyPy's memory is the interpreter.
 
10:03 AM
@Veedrac What if you don't use the STL in the C++ version? ;)
 
cbg
@Veedrac probably you ought to say: "I was wondering if people realized C++ is now slower than PyPy" :D
 
@ThiefMaster And use what? A sorted array?
 
10:19 AM
@Veedrac interesting
Vector shouldn't make much difference if he's reserving the space up front
 
How to get output from 1-5, to A=[1,2,3,4,5]
 
Still haven't solved it @user3800040?
You never did explain what you actual problem was properly.
And unless you do explain it, I doubt anyone will be able to help you.
 
looks like a Project Euler puzzle
oh wait, it's tagged Project-euler :)
 
@user3800040 try saying what you want a function to have as its inputs and outputs, and then a sample of the values for each
 
11:40 AM
 
12:22 PM
@Ffisegydd Looks like the problem that pops up on SO from time to time as a homework assignment. Something like "Given a sorted list of integers, identify all runs of 3+ consecutive numbers, and create a string representation where the interior part of each run is replaced with a hyphen". Ex. [1,2,3, 9,10, 23, 42,43,44,45] becomes "1-3, 9, 10, 23, 42-45"
Or, possibly, the reverse - going from the string to the list. It's not entirely clear.
 
stackoverflow.com/questions/25973976/… dupe. I closed as OT then retracted so can't vote again.
 
Think I'll go "too broad" on the second one
Hmm, I wonder if a Visual Basic script can call a C# library... That would be very good news for me.
 
12:44 PM
@Kevin I think they can all call each other if they're on the .NET platform
Actually I have no clue about that. Unless I'm right.
4
 
I can do it in dev. Here's hoping it works in production, because I'm about to write a few thousand lines of code and I don't want to do it twice
 
@kevin are you the C# guru of your company as well?
 
@Robert he is "The Kevin" - no other description is required to explain his awesome :)
 
I'm way better at C# than VB, although that may not be saying much
 
Um... gotta love those bugs that can't be reproduced
 
12:48 PM
As much as VB's bracketless syntax reminds me of my beloved Python, I can barely make a basic class with the thing.
 
Umm... looks like re-running a script worked this time, same input but actually produced output as opposed to yesterday where it didn't for no apparent reason whatsoever
Guess we'll see what happens when it runs tomorrow :)
 
@JonClements Getting ahead of yourself there - who said it'll even run‽
 
Hmm what's the best way to unnest a dict? Say I have a dict with some values as floats, strings, etc, but one of the values is another dict. I want to take my nested dicts key:value pairs and simply have them as part of the "upper" dict.
First person to answer with a quick and dirty solution wins a prize.
Points will be awarded for "dirtier" solutions.
 
How many values?
An arbitrary number of just a specific attribute?
 
{'owner': {'display_name': 'Martijn Pieters', 'user_id': 100297},
 'is_accepted': True,
 'question_id': 25913605,
 'answer_id': 25913659,
 'up_vote_count': 2,
 'score': 2,
 'down_vote_count': 0,
 'creation_date': 1411045986}
I'm bascially looking at the rep/answer thing again but actually doing it properly
So I've got every single answer that has been answered by all of us in a response, but the owner response is in it's own dict.
 
12:57 PM
d.update(d.pop("owner"))?
 
@Veedrac bah.. beat me :(
 
Wow is that it?
 
Also
from collections import ChainMap
ChainMap(d["owner"], d)
 
Ooooh an answer involving collections, I like collections.
I hereby award you the price! A half-eaten muffin.
 
I sometimes feel as though 21st century comp sci students will simply have to memorise one million handy functions to pass their degrees :)
handy functional functions, that is
 
12:59 PM
Mmmm. This muffin is very banana.
 
@Robert no - they just ask the people that have memorised previously on SO
 
Uh...yeah...banana...
 

« first day (1437 days earlier)      last day (3505 days later) »