« first day (1509 days earlier)      last day (3455 days later) » 

1:30 AM
cbg
How to turn [('x', 'y', 'w', 'z'), ('a', 'b', 'c', 'd')] to [('x', 'y'), ('w', 'z'), ('a', 'b'), ('c', 'd')] ?
what i tried is...
    >>> [(x,y),(w,z) for (x,y,w,z) in lst]
SyntaxError: invalid syntax
 
That's just zip
read help(zip)
example:
l = [('x', 'y', 'w', 'z'), ('a', 'b', 'c', 'd')]
your_answer = list(zip(*l))
 
no, i'm not asking to take the first ele from one tuple and also the first element from another tuple to form a tuple.
 
1:45 AM
Oh! woops. I think you might be able to use chain from itertools. Lemme think about it a sec
Okay. Try this instead:
l = [(1, 2, 3, 4), (3, 4, 5, 6), (5, 6, 7, 8)]
list(chain.from_iterable([(a,b), (c,d)] for a,b,c,d in l))
 
thanks...
 
 
3 hours later…
 
2 hours later…
6:24 AM
Cbg
 
7:06 AM
@davidism voted
 
cbg
 
8:08 AM
@Ffisegydd cbg
How's your rage?
 
I was generally rageless throughout. I was just annoyed.
 
@Ffisegydd that fudging sword..
 
I honestly don't see what people's problem is with it
 
@Ffisegydd it is just lame..
 
How?
 
8:19 AM
It's like, "We've run out of all the cool lightsaber ideas"
 
umm.. I don't think I can present you any educated reason..
 
How though, is that not a cool lightsaber idea?
 
it is just a feeling.. I feel iot in my gut.
@RobertGrant something like that, yeah..
 
It just looks as though you'd stab yourself with it
 
that is also true
(although they feel the force)
 
8:20 AM
Now a gun that fired mini-lightsabers, that would be cool
Or lightsaber nunchuks, that deactivated the side you're holding/that's hitting you automatically
 
The best part is is that it's canon
People are going apeshit at JJ Abrams
When it's already been done before.
Hell, they're had lightwhips.
 
A lightsaber morning star would be awesome
But anyway, it's the future, it should be cooler stuff, not stuff that looks older than the original lightsaber
 
8:38 AM
What's next, the lightrock? Throw it at your enemies!
 
Cbg :)
 
cbg
 
9:15 AM
Cabbage all
And also - the lightsaber thing makes sense. I always wondered why jedi had any fingers left after their first duel
 
9:33 AM
cbg
 
cbg
 
Ummm... got a client saying they haven't received an invoice... turns out, they might be right... ummm
I also can't find a sent copy, but it appears to have been paid...
weird
 
You mean the invoice pixies are actually doing their job?
 
I'd rather pixies than gremlins I guess?
 
Is there a "best practice" in Python for having a nested method if it doesn't serve any purpose like accessing the private scope?
I think it would be better to just have an outer psudo-private _ prefixed method?
(and that also won't be imported automatically because of the underscore AFAIK)
 
9:53 AM
if you're using a "helper" function thats specific purpose is to make that function "cleaner" it's fine
A really convoluted example
def group(iterable):
    from itertools import groupby
    def helper(el):
        unique_vowels = set('aeiou').intersection(el)
        if 'e' not in unique_vowels:
            return 1
        elif 'y' in el:
            return 2
        elif len(unique_vowels) == 5:
            return 3
        return 0
    yield from groupby(iterable, helper)
 
10:11 AM
Wow... 30MB/s - that's not a bad transfer rate
 
Jealous
 
I wish that was my home connection, and not a server :(
 
cbg again
Just had a fire drill.
 
10:27 AM
Sweet...
 
Cold.
 
better than "oh yam... rbrb - FIRE!!!!!"
 
We failed the last one hard. Loads of the students went down the main stairs rather than the fire escape and thus burned to death when the huge bottleneck occurred.
And so they had another one 2 weeks later, and because people were so jaded from the last they didn't even bother leaving their offices until the Fire Wardens bollucked them.
It was the Fire Warden's fault a bit though, as every Wednesday morning they test the alarm by buzzing it for N seconds, but you're not meant to leave as it's just a test. They had the drill at the exact same time, so lots of people also thought "oh it's just the test"
 
10:45 AM
@Ffisegydd that is ridiculous
"The fire evacuation test is a semitone higher"
 
@Robert how are you finding ipython?
 
cbg
about to go into a meeting soon, but there it is.
 
@Ffisegydd not really used it yet, been so busy
Holidays in 3 days; hoping to look at ipython and flask a bit then
It's also such a general tool, I think the problem is I don't know what to use it for yet :)
 
Yeah I'm hoping to get a lot of coding done over Christmas
 
But I imagine as soon as I find something I can do in it, then I'll use it more and more for different things. I need that first thing that makes me fire it up every day.
 
10:50 AM
Yeah. I keep it open to answer questions and as a calculator
 
Hey guys! I'm new to chats. Can somebody give me motivation for learning Python? I have read dive into python. And don't know what else to do.
 
Just answered a question and wanted to test my code against Ashwini's. There is a %timeit magic method which is just beautiful
In [103]: %timeit x[~np.in1d(x,y)]
10000 loops, best of 3: 35.3 µs per loop

In [104]: %timeit np.setdiff1d(x, y)
10000 loops, best of 3: 86.7 µs per loop
@mario23 Pick a project and do it. The best way to learn is by doing.*
 
@mario23 why do you learn python anyway?
 
@Ffisegydd err ^ ad $ are line anchors - not boundaries :)
 
[*] = I find the best way to learn is by doing, you may find otherwise.
 
10:54 AM
(think you meant \b and \B?)
 
@RobertGrant A semitone?!
 
@Jon They're string boundaries unless you pass the multi-line flag aren't they? And yeah I meant them :P
 
@Jerry I'm working in NLP as a research programmer.
 
so, your motivation is that you're losing your job if you don't I guess =P
 
@mario23 you may find Kaggle competitions a good way to learn. They're pretty advanced but have NLP problems sometimes.
 
10:57 AM
but yes, I found that being in a project helps a lot; and I think it's more fun than doing a course, though you may find yourself doing things a bit awkwardly or missing things here and there
in any case, you can always come back and clean up
 
I always have to double take when seeing NLP - for some reason I always think of neuro linguistic programming...
 
@mario23 we've even got a machine learning project ourselves which will eventually involve some pretty nefty NLP.
 
@Ffisegydd Thank you! I will try. But I feel like lacking something always like being thrown into wilderness @Jerry Exactly. That insecurity always demotivates me, like sometimes, make me to think why am I even doing this.
 
And yeah I assume you meant Natural Language Processing.
 
@Ffisegydd Sorry for not being clear. yes, Natural language processing. In our lab most work is in Perl and Shell script. But, I am feeling like a left-out fellow without knowing languages like Python or Java or C++, although I have studied(shallow knowledge) all these in College
 
11:02 AM
@mario23 I guess that's how you learn. I don't mind first getting the 'main' way to do something and consequently learn tricks around or more elegant ways to do the same thing. I find that making something work as needed comes first, and performance/efficiency of the code shouldn't be too much of an issue since you know it's the first time you're doing something like that.
 
@mario Well I suppose your first thing would be to at least familiarise yourself with nltk.org as that is the de facto NLP package for Python AFAIK. Then maybe look for projects around it.
 
@Jerry Thank you mate! That is a good insight:) Is it possible to learn Python within a weeks time, since I want to , as @Ffisegydd mentioned and you may also agree, I want to get my hands in the REAL tasks.
 
If you already know the basics of programming (what a loop is, how if statements work) then you can learn enough Python to get by in a day. Within a week you could pick up pretty much all of the medium-level bits and bobs.
 
@Ffisegydd Will study NLTK this week and take a hit at Kaggle competition.
 
But ten years later - you still won't be a master :p
 
11:16 AM
Yeah that's true. Python is very easy to learn, but rather difficult to master.
Only one man has mastered Python. And he's a Dutch supercomputer.
And he still gets surprised from time to time :P
 
Oh - he's still learning :)
(although admittedly - has a lot less to learn than the rest of us)
 
He is asymptotically reaching mastery.
 
I wonder what his airpair rate is
 
if you have to ask, you can't afford it? :)
 
@IntrepidBrit not a Fawlty Towers fan? :)
 
11:21 AM
Awww look.... there's a cute puppy showing on airpair.com/python/workshops/python-3.4 :)
 
@JonClements that's got to be a good place to be :)
 
@RobertGrant I am, I thought I was following the script ;)
 
Ah, nice
 
But yeah, can see why you'd think I didn't know though :)
 
@JonClements I'm sorry if I offended you guys. I just want to reach a state where, given a task, I won't be shaking with diffidence whether this can be completed or not, within the absurd timeframe that project leaders say. IMHO, I think, being a master requires you to be spending every waking moment thinking in Python.
 
11:24 AM
Those typically happen when a daemon thread wakes up at an unfortunate
moment, finds the world around it destroyed, and raises some
random exception *** while trying to report the exception in
__bootstrap_inner() below ***.  Quite an explanation!
 
@mario23 no offense was taken at all - don't worry :)
 
@mario23 who seemed offended? :)
 
cbg
 
@tilaprimera cbg
 
Thread module __bootstrap() had that comment... is that not literary?
 
11:27 AM
@mario yeah I don't think anyone was offended :) we do tend to have a rather string sense of humour in here though so don't worry.
Also if you bump into someone called tristan, he was born offended by everything so take no notice of him.
 
laurels
@tristan................:D video_gamer_antagonist :D laurels
 
@RobertGrant I thought like that. But, chaps here are so humble and eager to help out guys like me, despite being so knowledgeable and talented programmers.
 
I blame the Dutch one. He's giving us a good name :/
 
We're actually trying to get you to join our cult, which is why we're so nice.
We have nothing but ulterior motives.
 
@mario23 oh, I haven't been able to learn much python yet, things keep coming my way and... yeah... programming isn't my main focus, but it's here and I keep it in the back of my mind
 
11:33 AM
"knowledgeable and talented programmers" - which room are you talking about!? :p
 
@Ffisegydd Or Interior motives. Because we're a chat ROOM. ba-doom-tish
 
stahp.
 
@Ffisegydd @JonClements Haha!! "sense of humour" perceived.
 
@Ffisegydd it's not a cult - it's an "organisation"
@IntrepidBrit you can go and sit in the corner for that one :)
 
Managed to regain a moderately healthy lead over davidism again
 
11:39 AM
cbg
 
I am knowledgeable and talented ;)
 
@Jerry I'm the same :)
@Jerry other than the programming bit. But in terms of Python it's hilarious how rubbish I am at the moment
 
every newb has a certain fixed amount of newb credits with me... they do replenish, albeit slowly... but if you happen to use them all too fast you will not get more, ever :D
 
11:41 AM
@AnttiHaapala quite a good way of putting it, yes :)
 
Hmm I'm getting close to numpy bronze.
 
@AnttiHaapala I think many people are like that? I happen to be the same =P
@RobertGrant I have to pull the docs almost every time I do something in python xD
 
I learned programming from the books... for a long time I didn't have anyone to ask from, but when I could it made me better. If you do it right, you do ask but not too much :D
 
errr... I have nginx serving a site that has no configuration file
how is it even working!!!!?
 
Config file was deleted after starting the server?
 
11:53 AM
Okay, that's freaking me out
 
Good. Revenge for Aniket.
We should change the bug label on sopython Github to do-the-needful
 
Waiiiiiiiiit a second. Rewind! Mario looks like Tintin from his profile picture. I smell identity theft
@Ffisegydd (and yes)
 
@Ffisegydd shia labeouf?
 
1 message moved to recycle bin
That was freaking me out too :)
 
@Intrepid done for Nidaba, I wonder if @davidism would mind if we changed it for sopython-site? :P
 
11:58 AM
@Ffisegydd try it and see if he notices? :p
 
I wonder what "Authentificate" could mean...
 
Why would pop8 complain about query.filter(User.name == None) (SQLAlchemy code)?
 
Has the tooltip always been centered like that?
@RobertGrant probably because it expects is None
which obviously wouldn't work
there's a isnull function though
 
@JonClements It's not centered for me
 
12:08 PM
@Robert use: query.filter(User.name.is_(None)) instead
 
I am trying to ask a python question but for some reason the code won't display.. the 4 spaces method seems to have stopped working
how do you display python code in a question?
 
 
@JonClements according to the SQLAlchemy docs that's valid code, but they say that PEP8 won't like it
 
correct
it is valid - the linter just can't get the context of it
 
Ah okay. It's a shame, because == seems a really neat way of doing it
Thanks
 
12:16 PM
oh it's now 8 indents?!
 
Hello
 
Curse you regex!
 
12:33 PM
this was posted in the regex room some minutes ago
 
Wow
That is a brilliant idea
 
Seen similar before, but not so complicated.
 
@Jerry I solved that one before, I think.
There is a whole site dedicated to such puzzles.
 
I think that while I could use positive/negative look ahead/behind for this problem, it isn't really necessary.
 
yea, just... my neck hurts if I take too much time to read the slant expressions
 
12:34 PM
I printed it out, I think.
that or was handed it on paper.
 
yea, I'd much rather like that instead
mind sharing the matter @Ffisegydd?
 
It's the final test, it's matching the ending full stop.
At the moment I'm using rstrip to remove any accidentally matched full stops. I don't mind doing this too much as I'm matching urls and they should never have an ending full stop, so I won't accidentally remove part of the url.
 
[\d\.]* that part is the problem here
 
Yep
 
it's supposed to match only the python versions?
 
12:37 PM
Yeah
So it can be 3, or 2.7, or can be excluded entirely
 
That won't match 2.7, will it?
 
hmm, there's another place the dot matches, ok, let's see
 
[\d(\.\d)*]*
 
Yes, as it matches as many numbers and full stops as it can.
 
[\w\.\-]* as well.
@RobertGrant No, don't use [] for grouping, use (?: )
[] disregards the order characters come by
 
12:39 PM
Oh yeah, you're right
Sorry, it's been a while
 
it's fine :)
I would replace the [\d.]* with (?:\d(?:\.\d)*)?
and the second ones with (?:\w+(?:[.-]\w+)*)?
 
Yeah
 
@Ffisegydd: one more test case for you: docs.python.org/dev
 
maybe (?:\d+(?:\.\d+)*)? instead if you have something like 2.7.11 or w/e
 
Thanks Martijn
I don't think the docs include the bug patches
Only major and minor
 
12:41 PM
@Jerry yeah even better, might as well have that
 
you can have letters in versionings?
3.5.0a0
 
Well at the moment 2.7.9rc1 is the latest 2.x version but its docs just uses 2.7
 
ok, if you don't have letters in the url, then that should do it
 
(?:\d+[(?:\.\d+)(?:\.\x)]*)? :)
 
(?:\d+(?:(?:\.\d+)|(?:\.\x))*)
that would be what I think you meant =P
 
12:44 PM
Ahh huh... typing shutdown now -r in what you thought was an ssh session, but didn't notice had disconnected is interesting :)
but I'm back :)
 
@JonClements hah :) didn't know it would work in that order
 
(?:\d+(?:\.(?:\d+|x))*) or that for shorter
 
Ah that's quite cool
For those rare moments where you want something to apply only to 2.x.5 versions :)
 
xP
 
(?:\d+(?:\.(?:\d+(?:rc\d+)?|x))*)
Sod it. .*
 
12:48 PM
Awesome, thanks guys. That passes my unittests.
 
glad to help ^_^
 
Doesn't seem to have actually asked a question
 
1:05 PM
Still learning python so please excuse the lack of correct vocabular.
I'm trying to test a simple web application (using webpy) that uses session data.
The application is running as intended but I'd like to write an automated test. So far I'm failing miserable with everything that needs session data.

In the test I have this:
resp = app.request("/page")

app is from the application and
app = web.application(urls, globals())

/page "goes to" class Page(object)
in there I define GET:
def GET(self):
 
@Tentacel if you have a lot of code, please put it in a pastebin rather than directly into chat.
Also that is basically a question, so have you instead considered asking a question on the main site?
 
In a what? Sorry that is all pretty new to me.
And ok, I'll make a question out of it. I hoped to get a bit faster input this way
 
You may get faster input but you'll reach orders of magnitude more people looking at it if you make a proper question from it.
 
what happened in 2012, so that the development of all the python google-docs APIs have stopped?
 
@PeterVaro google probably got bored. This seems to happen a lot.
 
1:18 PM
Email from tech support this morning: "so is your problem resolved?" Uh, no, because you didn't do anything.
This is more like grief counseling than troubleshooting. "Your admin rights aren't coming back, and the sooner you move past it, the better off you'll be"
 
I feel stackoverflow.com/q/27272693/3005188 should be closed. I feel it in my waters.
 
Aye, voting as "requires reproducible code sample"
I'm not crazy about code snippets that have break and no loops
 
I'll go along with that.
 
cbg...
has anyone had an experience with hackerschool? looks interesting...
 
tristan has IIRC
 
1:29 PM
@RobertGrant not only the official google API
but the 3rd party wrappers too..
 
@Ffisegydd Ah thanks...
@tristan could I trouble you for a review? I am planning to attend that post my undergrad...
 
(devil's advocate: "the Needs Code Sample reason ought to be used only for problems that ask 'why isn't my code working?', but this question is more like 'what do I need to do to my working program to get different output?', which is a slightly different category")
 
@Kevin yeah agreed. It's more like Don't Tell Us Your Life Story; Narrow It Down
 
I'm willing to accept huge code samples, as long as it runs.
I'll take "ten thousand lines that copy-paste-run on the first try" over "five lines, but it has to read from proprietary_data.txt and access www.skeezyLookingSite.com and I've removed all the import statements for clarity"
 
there should be a carriage return before the code begins
 
1:48 PM
any one participating in the global hackathon?
 
Ooo... tax free allowance goes up to £10,600 next year... that's cool
 
Woohoo
 
I wish I was allowed to get my figures as wrong as the government... Osborne thought we'd be borrowing £37 billion this year, but ended up borrowing £91 billion
 
My next regex trick will be to parse any url from text...
 
Yay :D I reached 1k :D
 
1:55 PM
@rvraghav93 congrats!
 
thanks =)
 
Okay: anyone want to throw any crazy/unusual URLs at me? Bonus points for variety! It's for science!
 
@tila is in the lead with 1 point!
 
jumping in the air with excitement
 
1:58 PM
@Ffisegydd co.za
 
Nice.
 

« first day (1509 days earlier)      last day (3455 days later) »