« first day (1592 days earlier)      last day (3581 days later) » 

12:00
60 rps is pretty hardcore isn't it?
@PM2Ring feels like more work than necessary.
I was contemplating using itertoolsl.islice() here to.
I don't know, is it? I can always reduce it to 20-30 rps and let it take longer. Once I've got the data, I've got the data.
def divvy_up(it, lengths):
    it = iter(it)
    for length in lengths:
        yield tuple(islice(it, length))
@MartijnPieters I got it!actually i have not any idea about this ;) just I'm experiencing a dichotomy!(somehow ) :)
@Ffisegydd yeah I'd do that if it's a one-off
12:06
@MartijnPieters Even though my modification to your version is slightly shorter, I think your original is more straight-forward. Also, there's the overhead in setting up a generator expression, so short genexps that only yield a few results are usually slower than the alternatives. But I guess .islice() could be more efficient than your posted version.
I know you can also google, but thought I'd paste it while I was looking at it :)
@PM2Ring I added the alternative to the post, to use on iterables rather than sequences.
we should make funccall faster in Python :D
@Ffisegydd My gut feeling is to err on the side of politeness. On the one hand, there are efficiencies for both sides in servicing multiple requests in a batch. OTOH, you don't want to hog their server. So maybe throw in a short sleep delay every second or so. Also, use an honest user-agent string, don't pretend you're script is a browser (unless you really need to). Is this script just being run by you or is it possible that multiple people will run it simultaneously?
12:16
stackoverflow.com/a/23918614/918959 hehe at jorans anser at this
hey guys, I reinstalled the OS on my mac but I can't find the bin for python 3.4 . Any help?
@Brunaldo you'd have to download it.
It doesn't come pre-installed on OS X.
10.10 does have Python 2.7 installed.
sorry, forgot to mention that. I have installed it
Brunaldos-MacBook-Pro:~ Brunaldo$ python3
Python 3.4.2 (v3.4.2:ab2c023a9432, Oct 5 2014, 20:42:22)
but you cannot find the bin?
no :(
12:19
Unclear what you are asking.
you mean you want to know where it is installed? which python3 will tell you where.
when I create a new project in intellij for python, it gives you the option to choose which python version you want
@Brunaldo which python3
literally type it in your terminal
if I use the which python3 python file in intellij it say's it's corrupted
which is a shell command.
It tells you what path is going to be used if you type in a command.
god damn it, i was clicking on the wrong file
thanks guys <3
12:22
closing as typo :D
@PM is just being run by me as a one off. Eventually we will request the latest data, but E could probably do a request every hour for the previous hour.
As the measurements are made every 15 minutes
@Ffisegydd also, this sounds like a cool project
@Robert will eventually be uploading it tohttps://data.bathhacked.org
@AnttiHaapala At least it's not recursive. :)
It's an open data project I'm involved in. Aims to get all open data for the Bath area.
There's more than just river levels too.
12:27
@Ffisegydd Fine.
Yeah, quite cool
But yeah to start with I'll be polite. See what the max time period I can request is.
Only 525600 records...
12:42
@MartijnPieters now I hit the repcap
7 accepted answers @305
:(
hope someone will save their upvotes for tomorrow
@MartijnPieters I'm tempted to downvote stackoverflow.com/a/28695278/4014959 for abuse of list comp. :) A simple for loop would avoid re-summing from the start of list1. Alternatively, you could use a class to save the accumulated sum:
from operator import add

class acc(object):
    def __init__(self, func, value=0):
        self.v = value
        self.func = func

    def __call__(self, x):
        self.v = self.func(self.v, x)
        return self.v

list1 = [1, 2, 1, 2, 3, 2, 4, 1]
cumsum = map(acc(add, 0), list1)
python is not anymore the "one and only one obvious way"
@PM2Ring I didn't even bother to try and parse that answer.
12:47
@AnttiHaapala My earliest version of acc() was a closure that stored the accumulated value as a function attribute. But even I thought that was ugly. :)
@MartijnPieters so what would you say about itertools.flatten?
def acc(func, v0=0):
    def f(v):
        f.v = func(f.v, v)
        return f.v
    f.v = v0
    return f
Is accumulate a bit like reduce in other languages?
Except there is a reduce. Is it like a specialised reduce?
def flatten(listOfLists):
    "Flatten one level of nesting"
    return chain.from_iterable(listOfLists)
@AnttiHaapala you mean?
@MartijnPieters Ah yes. I'd forgotten about that. But I wrote those other things a long time ago, when itertools was still quite new.
12:50
nope, the arbitrary level flatten
@RobertGrant it is not reduce, it is rolling reduce :D
@RobertGrant It's like a cross between map and reduce.
bites what's rolling reduce? :)
"See functools.reduce() for a similar function that returns only the final accumulated value."
re-cbg
(Bites as in takes the bait, not as in I'm annoyed)
12:51
it reduces from start to end and yields all partial reductions from start
Ooh
Okay, that makes sense, thanks
accumulate
by default the cumulative sum but could be everything
so how did one consume the iterator
@AnttiHaapala Who what where? :)
the collections.deque(iterable, maxlen=0)
that is the "official way to pull an iterator through"
13:25
But why do you need to do that? Can't you just re-assign the iterable? Or del it?
i have seen this type of questions, n number of times. I don't know why people are willing to answer this rather than marking it as duplicate.
Because they want points
i need to get my python hammer quickly.
grumble stupid api...
Cbg
13:33
@Ffisegydd speaking of melting snow... scottishsnow.wordpress.com/2015/02/24/…
13:44
@AvinashRaj Someone should have a quiet word to kasra about that...
@AvinashRaj it is one among around 300 duplicates to the canonical. This is why we have a list of canonical questions.
Re. my river levels project (for anyone interested). I've contacted the Environment Agency to see if I can get a bulk download of historic data.
That's also a good idea
But you'll presumably need to write something anyway to top that data up?
Yeah. I've got a nice function which can take a start and end time to get the data within that time frame.
Once I have some bulk data I can just GET the data every hour or so, getting the previous 4 measurements.
Set up a cron job or something.
Yay, I beat Alex here :-) Party time...
13:51
@Ffisegydd sounds good
Data looks pretty cool though. Can see the rainfall we've had lately in the plots.
This may seem like a strange question. How can I iterate through every unicode character?
Surely you'd just iterate through the numbers? Or is that naive?
@Kevin "character"
you iterate over unicode codepoint
13:54
7
A: iterate through unicode strings and compare with unicode in python dictionary

unutbuFrom your description of the problem, it sounds like vocab is an encoded str object, not a unicode object. For concreteness, suppose vocab equals u'債務の天井' encoded in utf-8: In [42]: v=u'債務の天井' In [43]: vocab=v.encode('utf-8') # val['text'] Out[43]: '\xe5\x82\xb5\xe5\x8b\x99\xe3\x81\xae\xe5\xa...

there are no such thing as "character"
that is not well-defined
How do I iterate over every unicode thingy such that len(thingy) returns 1?
codepoint or something
But I like your definition better
import sys; map(chr, range(sys.maxunicode + 1))
python 3
thingies = [thingy for thingy in all_the_thingies if len(thingy)==1]
13:56
@Kevin though that too is illdefined
as there are codepoints that are not valid at all :D
morning everyone
like the surrogate pair stuff
arrow.parser.ParserError: Could not match input to any of ['YYYY-MM-DDTHH:mm'] on '20141029T080600'
wtf how do I parse iso 8601 timestamps into python
not some halfassed solution, it aint hard
but any other answer than "write yourself"
Oh god.... Natalie Bennett must be suicidal by now....
That has to be the worse interview I've heard a party leader give
The Andrew Neil one?
Well, the LBC one, with Nick Ferrari, was bad
14:05
I couldn't keep watching after five minutes or so.
Haven't heard/seen the LBC one.
@JonClements I read the transcript. Amazing.
Felt like I was reading a Newsroom script
You can find the awkward bit here
What the...
>>> import sys
>>> unicode_chars = map(chr, range(sys.maxunicode+1))
>>> [x for x in unicode_chars if len(x.lower()) != 1]
['\u0130']
>>> [x for x in unicode_chars if len(x.lower()) == 0]
[]
>>> [x for x in unicode_chars if len(x.lower()) == 2]
[]
>>> [x for x in unicode_chars if len(x.lower()) != 1]
[]
['\u0130'] disappeared!
@Kevin are you using python 3.x with lazy map? :)
@AnttiHaapala You don't like:
>>> print datetime.datetime.strptime('20141029T080600','%Y%m%dT%H%M%S')
2014-10-29 08:06:00
14:09
@JonClements Yes.
ofc I do not like it
@JonClements Ouch.
Ah, it's an iterable, yeah...
the thing is so damn simple. there is a format where you can say things like
This is one of the only reasons I don't vote Green: they genuinely don't seem to have any but the vaguest/most optimistic handle on figures
14:09
2015W13-1 and everyone knows what day it is
except the python programmer bc python does not understand it either
@Zero @Robert and what didn't help, was that later this morning, she was doing a presentation, and was asked by Sky News about her bad interview and to comment on it... then the deputy leader ran up to the podium, grabbed the mic. and said "Natalie is not going to answer that.... NO NO NO NO NO NO NO!" or something :P
Wow that is amazing
PROTECT THE PUPPET
I was annoyed by her performance on the Andrew Neil interview because his figures were obviously wrong and she didn't seem to notice, but that ... oh dear. They may come to regret pushing so hard for TV debates :-/
Shame they don't still have Caroline Lucas as leader; she's always been pretty good when I've seen her.
@Zero well... someone has mentioned perhaps they may wish to re-consider the TV debate :)
I wish this company used more python :\
14:14
@corvid you got a job? :)
@RobertGrant indeed, it's pretty cool
Well done, that's awesome
Ok, all this Unicode chat was just so I could answer this question.
I wish more people reduced their question to a proper example like this poster did.
I'm operating outside my usual comfort zone, as I hate and fear Unicode, so if you guys could give me a heads up to any problems in my analysis, that would be great. I want to delete my post before the downvotes roll in.
14:18
Upvote for effort
Pshaw, I only had to source dive seven files deep...
@JonClements No link to the indivisual comment so you'll have to scroll to find it, but:
she should know about costing..she is the leader of the cabbage party after all..
how can i do a group by on a django orm values queryset where i'm using an aggregate in extra()?
So we have to vote for her :-)
14:23
I'm a little worried that my conclusion is wrong, if ch can contain multiple unicode thingies. While in principle I think the type can do this, in practice I don't think _PyUnicode_ToUppercase accepts unicode thingies with length other than one
@Kevin just dont try to uppercase anything.
lowercase is the new upper case
@AvinashRaj As per this, we may not have to worry about attempts, I guess.
@thefourtheye: ah, that's a nice answer to slap someone else around the ears with too. :-P
@AnttiHaapala How about pypi.python.org/pypi/iso8601 ?
@ZeroPiraeus She's the leader of the Cabbage Party... how drunk was the Dark Council to appoint her!? :p
14:27
@PM2Ring better, but does not do tz
@PM2Ring obviously this is stuff you do not want into stdlib
During my adventure, I learned a fact that can be made into an interview question from Hell. "What is the value of x when type(x) is str and x.isupper() and x != x.lower().upper()?"
@MartijnPieters Even I used to ask for attempts.... After reading few discussions of that sort in the meta, I changed myself and started editing the question carefully :-)
cbg @davidism
cbg @Jon and all
@Kevin so what is it?
14:32
LATIN CAPITAL LETTER I WITH DOT ABOVE was the one I had in mind
But I see that there are a few more answers. 'GREEK CAPITAL THETA SYMBOL', 'LATIN CAPITAL LETTER SHARP S', 'OHM SIGN', 'KELVIN SIGN', 'ANGSTROM SIGN'
They convert into 'I\u0307', 'Θ', 'SS', 'Ω', 'K', 'Å' respectively
@Kevin locale dependent
I better delete my answer then, because then my "case 2" section only works for my particular locale
I guess I could re-run my code with all conceivable locales
uh, if I knew how to do that.
Any thoughts on stackoverflow.com/questions/28687907/… ? Tempted to cv as no repro.
I predict it's either very easy ('just do eval(your_program, locale) for locale in sys.allpossiblelocales') or very hard ('you will need to scour the web for internationalization mods, and recompile CPython from source for each one')
@ZeroPiraeus off-topic > why isn't this working? no code or traceback
14:40
Well yeah, that too ...
@JonClements > Note: this handles cases where word is not in my_sentence in a sane way - the other answers will give surprising results...
other answer. Because i deleted mine..
@AvinashRaj bah it's close enough... oh well... I'm sure the OP will find it out the hard way :)
I'm excited to announce that KevinScript finally has a working type system :-) Yes, Fred = Type("Fred", Object, ["__init__", function(self){self.frob=23;}]); x = Fred(); print x.frob; appears to do exactly what it is supposed to.
@ZeroPiraeus module named glob
user559633
14:48
neat, congrats starlord
All I need to do now is implement class name(parent){functions...} syntax, which is relatively easier.
Relatively in that there are no difficult design decisions to make, just a nightmare world of confusingly named variables and hextuply nested data types
@ZeroPiraeus I would give OP some more time before bringing down the close hammer.
@Kevin yuck, ks hass print statement,
@Kevin I think I need to stick with python
@AnttiHaapala worry not, I'm planning to get rid of it.
Initially, a statement instead of a function was preferable, because adding functions to builtins isn't very easy or nice-looking.
@RomanLuštrik Yeah, consciously chose to invite discussion here rather than cv-pls it.
14:52
But I hope to fix that in my next round of changes.
I also want to get rid of the semicolons, although I'm not 100% sure the language is syntactically unambiguous without them.
Like, x = Fred() print(durf) is fine because there's no way to interpret two expressions next to one another, other than by assuming they belong to different statements.
But there may be corner cases I'm not thinking of.
Interesting discussion on python-dev: Emit SyntaxWarning on unrecognized backslash escapes?. Would admittedly obsolete one of my canonical questions, but it's a trade-off I'd be prepared to see for the greater good.
@Zero the needs of the many...? :p
... outweigh the rep of the few, yes. Thanks; I was wondering how to diversify from last night's mangling of Eastern Philosophies ;-)
8 hours ago, by Zero Piraeus
Christ, that took more effort than it was worth.
I think you summed it up nicely ^^^ :p
Bah... can never remember which is the better one out of OBE, MBE and CBE
Ahh... COM - that's an easy way to remember it
xCMG is easier ...
oh, how i get the tag format?
@AvinashRaj [tag:cv-pls]
@JonClements Which one were you offered?
15:06
I am failing at debugging :|
delete-vote-pls stackoverflow.com/q/756342/1234256 (I know it's OT here, but when they're posted here stuff gets done.)
@Mooseman and outdated :D
Hmm, I notice a double standard within myself. I don't want to delete the post because it looks like something I might actually find useful. But I have no problem deleting things that other people find useful.
I don't know why I have this feeling, especially since I can view deleted posts anyway.
Great. I've started a philosophical discussion.
@ZeroPiraeus Interesting. A warning for unrecognised backslash sequences sounds good, but I'm not sure making them an actual error is a good plan.
15:11
I'm pretty sure the community at large would want me to delete. I'm not disputing that. I'm just confused by my own reticence.
(and by community I mean, the people that bother to establish customs via activity on Meta, not the horde of one rep users that would prefer all things to stay open forever)
@PM2Ring Errors should never pass silently (and habitually using unescaped backslashes is definitely an error on the programmer's part).
@PM2Ring @ZeroPiraeus they should be errors
it would make all that crappy windows code error out
@ZeroPiraeus Well it's not silent if a warning message is printed. I've always thought that allowing unrecognised backslash sequences is a dumb feature. But making it an actual error is going to break a zillion regexes.
@Mooseman It's okay... @Kevin talks to himself all the time - you get use to it :)
I have to say my sympathy for anyone writing a regex with a backslash in it and not using a raw string is limited ...
15:18
cbg
I can get a philosophical discussion out of "what should we have for lunch?"
@ZeroPiraeus Fair call
¡Paella!
(Indeed, how can anyone say what anyone "should" do? So prescriptivist. But I digress...)
@AnttiHaapala I'm almost convinced. :)
15:19
@Kevin well... I just had a bowl of chips... not normally over-keen on chips, just strangely craved some
Hopefully I'm not pregnant...
Anyway, it's way past rhubarb time for me...
Me too, actually. I gazed longingly at the chips in my snack drawer this morning, but eventually resisted.
Until lunch time comes around, at least.
Usually I have no appetite in the morning.
@JonClements Ahhh.... :O Puppy, I didn't realize you are lady-pup xo
@thefourtheye if I am - it's a surprise to me as well!
Well, you know, medical science handwave abdominal cavity technobabble habitable environment, so...
15:23
@Kevin amazingly even less coherent than Dr Who - good job :p
:-D
"J Richard Snape" - oh - that guy must hate Rowling...
guys I need new music
Jonathan Clements (born 9 July 1971) is a British author and scriptwriter. His non-fiction works include biographies of Confucius, Koxinga and Qin Shi Huangdi (the First Emperor of China), as well as monthly opinion columns for Neo magazine. He is also the co-author of encyclopedias of anime and Japanese television dramas. == Background == Clements speaks both Chinese and Japanese, and many of his works relate to East Asia. He wrote his Master's degree at the University of Stirling on manga and anime exports, predicting the rise of several trends in the international industry including back-to...
darude - sandstorm
15:28
Haven't been confused with ^^^ for a while now... which is a shame... the emails were interesting... oh how I miss someone else's fan letters
There's a Kevin that works at BigCorp, just as I do, and his name is the same as mine except for a different middle initial. Sometimes I get his emails.
4
At a glance, his job seems more interesting than mine.
Um ... your middle initial isn't K, is it? That would be unfortunate.
It is not K.
adds note to journal
@Kevin old
darude that is
15:32
@Kevin I'm guessing M :)
Heehee, I am employing the meme where any request for musical titles is met with "sandstorm" as a reply. I am as unique and special as the thousands of other people that do the same.
@JonClements Judging from my Github user name, that is an entirely reasonable conclusion.
Can anyone remember the music @davidism was playing on the livestream attempts.... that seems quite good coding music...
@Kevin yes.... github.... that's it.... /me hides social security records
adds further notes to journal
I propose that Kevin's real name is Kevin Mulder Scully.
That would make the romance subplots in my self-insertion X Files fanfiction very... awkward. Oh, Dana...
... and he's a 67-year old Cancer (or possibly Leo).
15:37
You know that Java existed when I was in college, and I've never indicated that I was an "adult learner", so that narrows it down somewhat
??
@Kevin you do not make sense
I'm saying I'm not likely to be 67, if I learned Java as a young man in college
From this information, I could conceivably have learned Java in my senior year in 1995, the year of its creation. Which limits my age to below the mid-forties.
So, could the 26 in your profile just be a lie? :p
Oh, is that publicly visible? :-I
Ok, the jig is up, that number is accurate.
@thefourtheye Because it's easier to read. — Two-Bit Alchemist 30 secs ago
Am I totally missing something here?
15:42
@Kevin yes... fear us and our 1337 deduction and hax0r skillz!
I can't fix the typo in Python string convertion, because the correct spelling is already taken as a title. Life is suffering.
@Kevin today it's your middle initial and age... tomorrow it's Global Thermonuclear War!
anyone notice the error in the above list?
I don't see a list, so I reject the question
Oh, if you mean "the list in the question Kevin just linked", yeah. It doesn't have a closing ']'
15:47
I also have a feeling that some of the strings got joined together, since the last one is so much longer than the others
I'm half-tempted to write a "what should be done about users who intentionally misspell words in their title in order to dodge the dupe detection system?" question on Meta
Wow.... there's not many people over 30 in this room... this makes me feel sad
But I expect the response to be "this happens rarely enough, that nobody cares about it but you"
@JonClements But each one of them is worth at least ten younger men :-)
Umm... hadn't seen a flag raised in the Lounge for a while...
Regarding recent flags, not sure if "kindly f--- off" is offensive or not. It clearly has the word "kindly" in it
It's like when someone says "no offense, but...". then you're not allowed to take offense!
DSM
DSM
I think it's offensive in itself, but I can imagine a context between friends where the juxtaposition is meant to be comedic and carries no offence. I wouldn't say it in a public forum.
Kindly cabbage for all!
15:55
At last - @DSM - I don't feel so old :)
Oh... lemme see if can find the clip of Reginald D Hunter trying to understand British humour
I can easily imagine a pub where two old friends use profanity like that instead of punctuation.
DSM
DSM
@Jon: here it doesn't matter so much because it's only words. The newbies at the office, full of early-twenties energy, make me feel ancient.
Well, on the bright side - life will soon grind them down :p
this might be a dumb question, but is returning a value in a callback a bad idea?
user559633
16:09
@corvid what do you mean?
user559633
@Kevin as a corollary: "I'm not racist, but"
user559633
you just know whatever next makes the world slightly worse for having been said
@DSM Reminds me of the comic where the stewardess is like "sorry sir, you have to turn off your Kindle during takeoff" and then the guy next to Kindle guy is like, "heh, I bet I don't have to turn off my good old book, do I?" and then the narrator is like "SMUG FOOL. YOUR TIME IS SHORT" and then his face morphs into a skull in a desert and it goes "SOON ALL WILL BE DUST"
So just tell the newbies that they'll be dust soon.
That evens the playing field nicely.
DSM
DSM
.. I think I'll be dust sooner, so I'm not sure I win that play.
user559633
I'm pretty sure that comic doesn't exist and you just created it.
user559633
16:12
also, is there a meetup group named ITalians? if not..
[Insert usual rant about cartesian doubt here. How can we be sure of anything, etc etc] but I'm 98% sure it's real
@corvid Not for any callback framework I've ever used
user559633
cartesian doubt prisoner's dilemma
(which is admittedly few, but still)
@Kevin reminded of an old joke... A bloke's grandmother constantly pointed out at weddings - "that could be you next...". He eventually got fed up with this irritating behaviour, so when at a funeral,,, he turned around to his grandmother and said: "that could be you next, you know?"... she never brought stuff up at a wedding again...
user559633
"that could be you, you could be that wreath of flowers...if you only believed in u r self"
user559633
16:15
"be the moderately priced bouquet of flowers you want to see in the world"
@tristan like if it had a success callback and a fail callback, returning from within those callbacks
I expect that whatever is actually invoking those callbacks will just discard the return value.
OTOH, as another example of a function whose return value you can't access, you get a TypeError if you return a value other than None in an __init__ method. It's conceivable that the callback lib developers took a page out of Python's book and decided to be strict about return values.
I suggest an empirical approach: try returning something from a success callback, and see if it crashes.
Metaclasses confuse me.
Incidentally, I got the biggest headache trying to implement Type.__call__ and Type.__init__ for KevinScript yesterday. I hope my implementation is perfect so I never have to do that again.
@Martijn could be worthy of python-internals?
As you've got a lot there about look up ordering and descriptors etc...
16:30
btw can IPython made to output >>> and ...
@JonClements not sure it is. Your call.
@AnttiHaapala Probably.
what shell do you use?
I find the ipython in, out confusing in pastes, yet often want to just copy paste shell sessions verbatim to so...
I just use the standard shell.
I don't want iPython features to accidentally confuse the issue.
Case in point:
Scratch that, I do see it in Python3.4.2 interpreter. Not in Python 3.4.2 + IPython 2.3.0 — Jon Surrell 1 hour ago
hah :D
I always mistype something in standard shell and edit schmedit
16:55
I have a long list that is continually updated (one element at a time). From this list I continually need to get the set of unique values for a subset of the list items (for example, the unique names of boys, and the list is all boys + girls). Currently using a set comprehension and it is causing an effing speed bottleneck. Someone suggested using a Collections.counter instead. Agree/disagree/other ideas?
@Pete well, how are you using the set?
I'm checking if certain elements are absent. E.g. make sure there are no "John's" and "Jack's" in the set.
Does the subset ever change? Ex. it's "only boys" now, but it might become "only women whose age exceeds 21" or "users born on odd numbered days"? Do you have an exhaustive list of all the possible subset criteria, or are they somehow dynamically generated?
If it does change, how often? Every time you run the script? Every month? Every minute?
@AdamSmith ... you jinxed your answer by pointing out its 9x slower
:P
16:59
yes, there's an exhaustive list. it doesn't change. It's prices, by the way.

« first day (1592 days earlier)      last day (3581 days later) »