« first day (1732 days earlier)      last day (3441 days later) » 

17:00
It really annoys me when co-worker asks me a question then goes on facebook midway through my answer while I'm explaining it. Then asks the same question 2 minutes later :|
@thefourtheye: someone reads my G+ posts?! :-P
I do, from time to time :D
@Martijn Did you by any chance change your keyboard?
@IntrepidBrit: and that's totally not because people are trying to find profiles for totally unrelated Martijn Pieters' :-D
I didn't know anyone even used G+.
17:03
@BhargavRao: yeah, I'm typing on an iPhone screen right now...
I had never seen spelling mistakes from you. I got hold of a few a week back (though they were edited after a few minutes) :P
@BhargavRao I typo all the time. I'm not a native English speaker.
So stick around and you'll be sure to find some my spell checker didn't.
Argh. Then I had been blind till last week :O
DSM
DSM
:-P There comes a point in fluency where saying "I'm not a native speaker" is simply an excuse for the mistakes we all make even in our native languages, and I'm afraid you're far past it, Martijn..
user559633
Is it accurate to state: "CPython compiles to “bytecode”, which is run on an interpreter, which in turn runs that code on a lower-level language" ?
user559633
17:14
Trying to think of a succinct way to express "interpreted->compile pass->bytecode->interpreter->actually executing"
Write Code -> Some weird stuff -> Program runs
user559633
@BhargavRao Yeah. Where "weird stuff" happens in hg.python.org/cpython/file/3.4/Python/ceval.c
I like the way they have XXX everywhere in that file
Right - back for a bit - what've I missed?
I threw a frisbee and you missed it. Bad puppy
user559633
17:20
@BhargavRao probably used as a tag like TODO or for other bad stuff (i think eclipse does this)
@JonClements We all know that Martijn is going to be a Tech Lead at FB :D
@BhargavRao Finally, somebody realized who the real bad puppy is ;-)
It hasn't been exactly under wraps for a while now :p
But @thefourtheye even you did not bother picking it up! So all is even now :D
That hashtag #generators :D
This good guy from joined the SE team a few weeks back.
user559633
@AaronHall a bit of the self-promotion?
Yeah, he lurks here a bit too. :)
Cabbage!
Yeah.
Gotta self-promote on the twitters
17:29
No you don't. You don't have to do it here either.
^ especially don’t promote the self-promotion here… :/
Yeah, lol, but stop doing it.
team meeting time...
17:36
I am a kitty cat meow meow
What were you when you were young?
He was a crow
Before that, legends say he was born human.
But he knows inside that he is a mutant species!
Is there a way to do selective dict unrolling? Like, I only want to pass most of a dict to a function, but I don't want to specify the full list of foo=dict['foo'].
There is no inside, he is hollow like an easter egg.
17:43
Maybe I just need to build another sub-dict.
It'd be nice if you could use ~to indicate NOT. So dict[~'foo'] would return a dict with the foo key, value pair removed.
Could have the same with lists
list[~1:5] for example.
user559633
on the other end of the black hole of corvid is a white hole that is spewing kittens
@Ffisegydd Yeah, that would be exactly what I need.
DSM
DSM
@Ffisegydd: we'd have to write ~(1:5) instead, though..
In R it is kinda like that.
17:48
I want to do do_things(**dict[~'foo']).
Yeah not saying it doesn't have its kinks to work out, but an interesting idea.
boss likes my UI, I just don't have the drilldown worked out...
that's my takeaway, he wants a few things though.
I ended up just building a new sub-dict where the keys are in the list of keys I need.
I just don't like it. :/
Allô.
def without (d, *keys):
    return {k: v for k, v in d.items() if k not in keys}
>>> d = {'foo': 'FOO', 'bar': 'BAR', 'baz': 'BAZ'}
>>> without(d, 'foo')
{'baz': 'BAZ', 'bar': 'BAR'}
@Ffisegydd ^
17:53
Do I need the .items() in 3?
DSM
DSM
Yep.
Default iteration over a dictionary gives you only the keys
Otherwise you iterate over keys only
or iteritems
17:53
Right, I always forget.
DSM
DSM
@Joran: nope!
or d[k]
etc
oh what?
iteritems wouldnt work?
>>> d = {'foo': 'FOO', 'bar': 'BAR', 'baz': 'BAZ'}
>>> d.pop('foo')
'FOO'
>>> d
{'baz': 'BAZ', 'bar': 'BAR'}
>>> d.iteritems()
Traceback (most recent call last):
  File "<pyshell#64>", line 1, in <module>
    d.iteritems()
AttributeError: 'dict' object has no attribute 'iteritems'
Not in 3
17:54
eh is it iter_items?
iteritems doesn’t exist in Python 3 because .items() aleady gives a generator.
@AaronHall That modifies the original dictionary though which is usually a bad thing.
<- py3 newb
@Joran We forgive you… :D
17:55
if modification is a bad thing, probably should be using namedtuples?
ig you really wanted to support all pythons dict((k,v) for ...)
Whoa whoa whoa. Don't use "we" so lightly.
I don't forgive you at all.
Sorry… ._.
We as in third person reference to self? Like how kings do :P
The Royal We.
17:56
All this time working on web apps and I still had no idea there is this "options" endpoint... hrmph... is this a new thing?
naw its bad form to modify a datastructure in a function regardless of its mutabillity unless you have a very compelling reason to
@AaronHall Maybe scroll up for the use case?
@corvid Not really… :P It’s just a rare usecase, especially for people just creating a web application.
We would like to announce that you have been granted the royal forgiveness :D
But it is often being used “behind the scenes”.
@poke I don't get what its purpose is. Why would a login go to options? Is it a cross-origin thing?
18:00
>>> import collections
>>> def dict_to_tuple(d):
...     nt = collections.namedtuple('dict', d.keys())
...     return nt(**d)
...
>>> d = {'foo': 'FOO', 'bar': 'BAR', 'baz': 'BAZ'}
>>> dict_to_tuple(d)
dict(baz='BAZ', foo='FOO', bar='BAR')
Yep that's the one @JoranBeasley
@corvid Browsers make an OPTIONS request for CORS to get the Access-Control-Allow-Origin header first before performing the POST, yes.
maybe ... it sounds like most pages just return 500 or something
before performing post? So I should somehow just... redirect to post?
18:03
@Joran No, success of the OPTIONS request is actually required in order for the cross origin request to be successful. So if you offer an API with your server that is accessible from outside (via CORS), you want to make sure that your OPTIONS works.
That makes sense, but what should be done in the options route?
The OPTIONS request contains the Access-Control-Request-Method header, you need to validate that (whether you support it or not), and then return a response containing the headers Access-Control-Allow-Origin with the allowed origins and Access-Control-Allow-Methods with a list of allowed methods.
Ahh I see, missed the Access-Control-Allow-Methods header, but had the other one
Thank you poke
18:08
Btw. check your server library there isn’t something for CORS already.
For example in nodejs, there is a connect/express middleware that does this all for you.
There shoud be, but it's not reacting as expecting
Are you on Flask today?
Alas, I am not, but using a more traditional stack than meteor
Angular.js + Node.js, my boss really likes javascript
but what are you using for the server? You aren’t using the raw http.createServer, are you?
-2
Q: how would i write a simple python program which gives advice?

user5116391I need help writing a program to give advice I am very new to python so therefore have very little knowledge I need to create a program which asks the program user if they want advice if the program user says yes python should give them a silly output message such as "hug the person underneath u"...

They're back.
18:19
bah shows I dont write enough server
@JoranBeasley list.sort()?
@poke Just a very simple express back end, but the back end is hardly built out... my job is more front end engineering these days
I would have definitely voted to close that one.
It's raining and I think I can see the sun beams...
@corvid If it’s express, use the cors npm package…
18:35
well actually the back end I am accessing is in Meteor... theoretically, this should work though
uhh, not sure about that
18:50
Is there a nifty one-liner to replace search and replace a number? For e.g I have
>>> s = "eth0 properties blah.."
and want to replace 0 with 1
>>> re.sub('(eth)(\d)', r'\1' + int(str(r"\2")) , s)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ValueError: invalid literal for int() with base 10: '\\2'
Why worry about it being a one liner?
i thought i had this working in the past but don't remember...
hence i'm fixated on the one-liner solution. Some threads on SO have a solution with a function but i'm curious if this can be done with a one-liner.
Don't worry about it being a one liner, really. Down that road lies madness.
i see
Making everything a one liner is a plague :p
18:53
Why not re.sub('(eth)(\d)', r'\g<1>1', s)
I am a one liner, and look at how I came out
WTF
For Ffisegydd’s and corvid’s last message my name was in front of the line instead of theirs…
I was ultra confused.
DSM
DSM
Didn't look that way on my end.
If I have an object as a property of another object, is there an easy way to reference data on the top-level object?
@JonClements nice solution thanks :)
18:57
@Morgan The object inside can’t know where it is referenced from, so no.
class Parent:
    def __init__(self):
         self.child = Child()
         self.id = 1
class Child:
     def __init__():
         self.id = parent.id
@poke Hmmmm, alright. :/
Imagine this:
DSM
DSM
I think you'll have to tell children who their parents are.
x = Child()
a.child = x
b.child = x
Now what is x.parent?
@DSM But I don't want them to know they're adopted.
@poke Yeah, good point.
I'm trying to increment a unique ID each time the class is instantiated, but the unique ID needs to start at 1 and be sequential for each parent object. :/
19:01
That was fun - some naughty user has ended up 800 rep down :)
Who? Where? link, please!!
DSM
DSM
@MorganThrapp: I'm not 100% sure I know what you mean, but in the past I've put itertools.count() at class level and then called next on it on instantiation.
how do you lose 800 rep?
sock puppets?
DSM
DSM
Cheat to get 800 rep and then have it taken away?
19:04
It’s mod stuff guys, nothing to see
ok, but who was it?
:)
@DSM That's kinda what I'm doing now, the issue is that I'm creating multiple instances at the same time.
btw, @poke, I was able to get it working, thank you for the help!
yay :)
So, in my example above, self.child is a list of Child() objects. Each one should have a sequential ID, but it should reset to 1 for each new Parent() I create.
19:06
Just had to make a custom authentication method, set the headers on an option request, and it worked pretty seamlessly from there
@MorganThrapp Inversion of control: Tell the child which ID it should have.
DSM
DSM
@MorganThrapp: I thought self.child was a Child instance, not a list? But anyway, if it is a list, what's wrong with self.child = [Child(id=i) for i in range(1, num_kids+1)] or something?
@poke That's a possibility.
Well, let that be a lesson to everyone. If you sockpuppet and vote for yourself, it will be taken away. Easy come - easy go.
It’s way cleaner like that. Testable too.
19:08
@DSM It's a list of Child instances. I have to have the ID at creation time, because the Child has children too that need to know Child's ID.
It's a whole big mess of crazy. :P
DSM
DSM
I don't think it's quite as crazy as you may think it is :-), but I admit I'm not quite seeing the difficulty so I'm probably missing something, as usual.
stackoverflow.com/q/31406359 I edited it, there was a pretty good question hiding in there
The biggest issue is how many levels there are. It's File -> Batch -> Entry -> Addenda. Each Entry needs a sequential ID that starts at 0 for each File, but persists between Batches in a File. The Addenda also need to know their parent Entries ID at creation time.
But, the Entries and Batches are created via a function call to their respective parent.
@davidism Your wish is my command.
needs three more reopen votes
DSM
DSM
19:14
I guess I don't see why you can't just pass the ID information when you build the object in the first place.
@DSM Yeah, I might just do that. It's just a pain to persist the ID over multiple batches in the same file, because the batch can't report back up to the file "Hey, this is what my biggest entry number is".
DSM
DSM
It could if you pass an id creator instead of the id itself, and everyone gets their ids from that.
Anyone have a spare reopen vote for that Q of davidism's?
@DSM That would actually be perfect. Thank you!
@davidism You can answer it now.
19:28
I would if I knew the answer. I'm still messing around with it.
DSM
DSM
Even without an answer, I think the world is a better place when questions are rehabilitated. #inspirational
It's unfortunate that the op reasked the same question after deleting that, got downvoted, and deleted that one too. Hopefully it doesn't count too far towards a ban.
19:54
re-cbg
CR elections are finishing in a minute!
I wonder how the distribution of readership goes on answers. I imagine it's a Poisson. With lambda approximately 1... But I need to study my statistics more...
DSM
DSM
I feel like the CR guys are like the guys who hang out at a different pub.
I hang out at meetups. Hanging out at a pub is a foreign idea to me.
@DSM or the ones that will drink wine instead of beer or something?
I added an executive summary to my answer on yield...
DSM
DSM
20:06
@JonClements: yeah. It's like we have the same general interests but a different focus.
Begin with the end in mind.
Begin at the beginning, and when you come to the end, stop.
Do the difficult things while they are easy and do the great things while they are small. A journey of a thousand miles must begin with a single step.
Thank you, generic motivational poster generator. /s
DSM
DSM
I think Aaron is hinting he's trapped in a fortune cookie factory.
Anymore over quoted random pearls of wisdom?
Welp I'm off to live the life of a pirate, night everyone
DSM
DSM
20:14
Oh, and for those keeping track: the guy from earlier today who had the "this garbage python statistical packages" rant now says "Thanks. I figured it out. It had to do with the type of fit specified into the fitting routine", which is a lot less dramatic.
@corvid rhubarrrb
DSM
DSM
@corvid: may you find many shiny things.
I want a "drama queen" voice for my car's GPS.
20:29
Being upvoted gives me strength, and upvoting gives me courage.
That's sad.
@Air You took the cabbage craziness to the next level :D
@Air where, exactly, is the cabbage? I wasn't clear on that.
Air
Air
20:33
@davidism ← → ↑ ↓ ↔ ↕ ↖ ↗ ↘ ↙
John Stalvern is the cabbage
Was originally also tagged "mysql", "flask", "flask-sqlalchemy" and "sqlalchemy": stackoverflow.com/posts/31416282/revisions
Rhubarb guys
wrote up a critique of the top answer in my yield answer too...
bye @thefourtheye
Air
Air
20:50
@davidism Pretty vague question when it comes down to it. How does it work? Um, on what level? It sends arguments to a method on the string class...
People who don't know how to phrase questions any better than "how does this work" deserve answers that begin, "You see, inside a computer, there are many electrons..."
user559633
@Air when a neutron just doesn't feel charged to do anything...
Kindness in words creates confidence. Kindness in thinking creates profoundness. Kindness in giving creates love.
Sure.
Please stop posting random platitudes.
Air
Air
21:09
and then the user pointed to where there was only one set of messages in the room and said, "RO, why during this most trying period in my day did you abandon me?" and the RO said, "when you see only one set of messages, my user, that is when I kicked you"
3
Wow, 15 minutes of silence...
21:20
^^ I aspire to such style :)
off to bed, rhubarb all!
@vaultah don't forget your toothbrush! :p
heya @MattDMo
21:24
Just rolled back an incorrect edit...
To one of your posts?
someone else's, in fact, one in competition with mine, but it made the answer worse, so rollback it goes. It doesn't invalidate my criticisms of the answer though.
Very noble (good on you)
Thank you very much.
Hello Steve.
cbg and rhubarb, all. Just wanted to observe that I actually scored some rep today. 'Been a while, but I am still making the effort.
21:38
How's the new gig?
Great fun but time consuming!
@holdenweb keeps you out of trouble :)
I would imagine so. One foot in the ivory tower, one on the ground?
rbrb, y'all. See you next time I get to have some Python fun.
Take care Wayne.
21:46
@Wayne rbrb :)
Room's rather quiet...
Lol
Mastering others is strength. Mastering yourself is true power.
Air
Air
@AaronHall What is "annoying others with this bullshit"
Just reading some Lao Tzu. Seems share-worthy.
Air
Air
21:58
Now, if you want to augment PEP 20 with the Tao of Python, that might be share-worthy
Well, I need to run to Bitly for the Python Office Hours meetup. I love helping people with Python.
Au revoir.
Air
Air
ttfn, "tao tao for now"
Anyway - how ya been @Air?
Air
Air
@JonClements If I'm being honest, not great. My household is just getting over the third of an indeterminate sequence of biblical plagues.
Keeps life "interesting" in a "I'd rather it be boring" kind of way though :p
Air
Air
22:07
Yea, and the youngest shall get a double ear infection, and the first two days shall obliterate the weekend, and the next three shall obliterate the sick leave of the father; and then the father shall get pinkeye, which begets the pinkeye of the son, which begets the pinkeye of the wife
and the wife shall develop tonsilitis, which begets three doctor's appointments and two rounds of antibiotics; and lo, it shall be viral and give no shits about the antibiotics; but the antibiotics will give her the shits
I'm suddenly disappointed there's no record of "The Book of Air" in the Bible now...
user559633
It would be called ether or something of the sort. IIRC they didn't have a concept of "air," much like lack of knowledge of space when writing the stories
Air
Air
And an opossum shall die behind the HVAC, leaving nine babies to be delivered to the wildlife rescue
Probably in the process representing the vector between the fleas and the house cats
And there will be no rejoicing
However, you can take consolation that you've made everyone else think their life probably isn't so bad as they thought it was before reading the good book of Air :)
Air
Air
I work in mysterious ways. At least, that's what I tell my supervisor.
On the bright side, my union bargained for a raise this FY and I should be getting a step raise in Q4
And my wife has an interview at the end of the week for a job that pays 25-50% more than she currently makes
So that's how I am, Jon; how are you? :)
22:12
As long as it doesn't rain for 40 days and 40 nights and you have to quit the day job to build an ark?
Air
Air
Hmm. Hopefully little risk of that, with the drought.
Famous last words :)
Air
Air
Though we could use some rain. My makrut lime tree almost bit the dust.
Anyway... I'm fine... just busy... gonna watch the first episode of the new Dragon's Den... then go to bed, then up at4am
Air
Air
Yikes. That's almost what a friend of mine refers to as "ass-early in the emo morning"
Air
Air
22:38
I find it amusing that competition between software tools breeds competition between indexing/ranking websites for said tools.
staticsitegenerators.net calls itself the "definitive" list, presumably to distinguish itself from staticgen.com which is limited to open source tools
Bob
Bob
23:06
hi
heya bob
Bob
Bob
23:23
Hi Jon... I have some programming issues related to python ... could you help me ?
Air
Air
> [You do not need to ask if it’s okay to ask a question.
You may ask your question without a preamble](http://sopython.com/chatroom)
Note to self: MD line breaks incompatible with MD links.
I'm out. Rhubarb.
Bob
Bob
I have 3 program files:
1: that collects the data from a source and store it in RAM.
2: that analyse the data from .txt file.
3: gives some command in real time.
I want to merge the first to files to make a online data analyzing tool.
What will be the approach to do this ?
ummm requests.get?
The problem here is that Bob doesn't know what he doesn't know.
23:39
cbg
How can we solve Bob's problem?
easy just draw one circle
Perfect. Joran, can you have that finished by Friday?
ok, Paul's slotting talks for PyGotham, it's a one-man show, so I'm heading home because my poor wifey-poo misses me.
@Bob the reason for the comments is you've asked about 12 (or more) questions with your one question without even realizing it. Start with step one, when you have problems ask and then move to step 2, ... 3 ... 4
I'm a great delegator!
23:44
no, that is unrealistic expectations, expect it to take a minimum of one month
ok, try to do it in two weeks, we'll followup on your progress at the next standup.
Cheers!
adios @AaronHall
dang its like a real work conversation
jk :P my work is pretty great usually
Bob
Bob
@Jg I want to make some .tmp files
sorry
i am trying by myself... if dont get i ll ask
23:51
not mad, and not really criticizing - learning how to break a problem into steps is part of learning to be a developer
Bob
Bob
@JGreenwell so how should i proceed ?

« first day (1732 days earlier)      last day (3441 days later) »