« first day (1733 days earlier)      last day (3440 days later) » 

15:00
@user1065000 Earlier you said: "I want to match 'test_' or '_test' but not both in a string. They can be anywhere." But now it looks like they can only be at the start or end of the string...
Oh, they can be anywhere. I can do that, mwahaha
They can be anywhere? Blow this for a game of soldiers, please supply an exact question.
Anything to make this monstrosity better.
In which case 'foo_test_bar' has both '_test' and 'test_' in it -_-
This is why I generally avoid regex questions - you design an excellent regex that works correctly against the test data & then the OP turns around and throws more data at you that shatters your original assumptions. True, that sort of thing can happen with non-regex questions, too...
15:05
cases = {'test_file':True,
         'file_test':True,
         'test_test':False,
         'file_file':False}

def foo(s):
    start, end = s.startswith('test_'), s.endswith('_test')
    return (start or end) and not (start and end)

for case, result in cases.items():
    print(case, foo(case) == result)
    #file_test True
    #file_file True
    #test_test True
    #test_file True
Apparently there's an upper limit on subgroups in vim
This is why we should ban questions and just talk about vegetables instead.
@Ffisegydd quit stealing my ideas
@user1065000 I really hope your takeaway from this was "I shouldn't use regex for this", not "I should use two regexes"
Why come up with my own ideas when I can steal yours instead? Helps to reduce my carbon footprint and saves the environment. Why do you want me to stop helping to save the environment? Are you a monster?
Day Without Internet #4: I'm actually at my old flat with internet. You may think this is a good thing, but all it's done is remove the serenity I had managed to cultivate. Now going back I'll start again...and it'll be harder this time...
DSM
DSM
Morning cabbage for all.
15:16
cbg DSM
Hey up DSM
@DSM cbg
@Ffisegydd What an awesome expression. I'm adding that to my vocabulary.
DSM
DSM
@RobertGrant: oh, thanks for the Vivaldi pointer. I'm giving it a try. Little flaky on Linux still but looks interesting.
Sure :) Yeah it's not 100%, but I quite like the design, and definitely like the lack of tracking
Vivaldi+ddg ftw
15:20
Hi all! Any ideas on why garbage collection doesn't clean NumPy arrays the way one should expect it to?
http://stackoverflow.com/questions/31422150/numpy-ndarray-objects-not-garbage-collected
@Robert now all you've got to do is make your own ISP and use your own network system and you'll be sorted.
Yeah but that sort of tracking is impossible to avoid :) I mostly just like giving Google less stuff.
Also it's the guys who made Opera, and I love(d) Opera
IMO one thing that's really annoying about JS is there are SO many libraries that do nearly the same thing slightly differently
Somewhat a problem with any package ecosystem. PyPI isn't exactly the pinnacle of "there should be one way to do it"
Or even Python's packaging tools
And rbrb
15:27
Python itself and the stdlib violates its own Zen a bit -_-
I suppose, haven't run into that as much with PyPI. I am stuck between if I want to use plain ES6 or Typescript ._.
DSM
DSM
@corvid: oddly enough I had to make a similar decision recently. I went ES6, and spent some time tracking down a bug that using TS would have avoided. :-/
@DSM in that case, what was your reasons for the decision?
"got multiple values for keyword argument" is how Python says, "Hey, you stupid Ruby programmer. The first argument is self. How many times do I have to tell you?"
15:34
^ that answer disqualified itself with the first 3 words.
@davidism Am I a bad person?
DSM
DSM
@corvid: none that stand up after the fact. :-) Originally I wanted to use plain JS, but since I vastly preferred ES6/7 I wound up using a transpiler anyway. Then I thought that it would be too annoying, but it turned out not to be. Finally I told myself "well, it would be weird to be learning a different dialect of JS than my framework is using", but now it looks like they're converting to TS. :-)
@PM2Ring no, you're too good a person for that kind of question :)
@poke I suppose I can convert that print statement into a function... Can you see anything else there that would break on Python 3?
I'm flagging that other answer as naa, even though it will probably get disputed.
15:37
@PM2Ring The CGIHTTPServer is merged with http.server on 3.
"I have some code over here" "In my opinion" and "Read docs like those other people told you" is not a good answer.
DSM
DSM
But is it NAA, or simply NAGA?
@davidism Yeah, it will probably get disputed. It's mostly a link-only answer with a bit of fluff that should be a comment.
Oh, I love this. Build fails without an error message.
@poke I (kind of) remembered that, but was too lazy to look up the Python 3 way of invoking the server. :)
user559633
@WayneConrad it's how python reminds you that it's not a functional language :P
Okay, been working too long today.
I keep getting hung up on why parameters are sometimes called arguments
The etymology of the word has previously never bothered me before now
Calling parameters arguments is one option.
In maths an argument is typically something more like a variable IIRC, whilst a parameter is a fixed value.
@davidism that's a terrible Q :)
15:54
Y'see, now that just makes sense. Part of me was wondering if it was quirky programming humour, like TWAIN
What's the proper flag for "Here's my homework, now give me codes, please"?
@Morgan gasoline and a lighter.
@JonClements And that OP looks like a severe HV.
Yeah, I feel bad for the new guy who got roped in to that comment exchange.
@WayneConrad I see what you did there...
15:55
@Ffisegydd We need an RFC for FOIP. Fire Over IP.
DSM
DSM
@PM2Ring: I didn't until you pointed it out. :-)
@MorganThrapp I'm sure we could whip up a Python library for it.
@Ffisegydd from Fire import BURNTHEMALL.
what did the mall ever do to you?!
@IntrepidBrit It killed my parents.
It mauled them to death.
15:59
Awwwwwww yeeeeeeeah!
"Hello. My name is Inigo Montoya Morgan Thrapp. You killed my father parents. Prepare to die burn."
I'm a wordsmith, me
re-cbg
16:03
@PM2Ring :D
@davidism I'm sure he'll see losing 20 rep as a reasonable trade off for getting rid of the OP :p
I have always thought of them as variables, as opposed to arguments and parameters. But in a programming context, those usages are everywhere, so I understand them all.
I'm making some required options. Yes, that's an oxymoron. Yes, the optparse docs say that's silly. And, yes, I have a good reason for implementing a silly oxymoron.
DSM
DSM
optparse?
Hi,How can we compare two json array objects in python? EG: first=[{id:10}] second = [{id:10},{id:15}]
16:15
What do you expect the comparison to return?
@DSM Stuck in 2.6 for this code. Should I be using something else?
argparse is the new one, although people debate the relative merits between the two
mitsuhiko wrote click based off optparse
@davidism Which python editor are you using ?
means which IDE
PyCharm, but why are you asking me?
@davidism first=[{id:10},{id:20}] second = [{id:20}] . I need to get which object is not in the first compared to second?
16:17
@davidism click looks interesting.
DSM
DSM
@Wayne: naw, if you're in 2.6, it's fine. (I'm in the argparse camp myself, but it's hard to get too worked up about it. :-)
oh .. just asking .. been in sublime .. so lookin 4 d change
@WayneConrad I recommend Click. I really like it.
Alright folks
Smell you later
Seeya @IntrepidBrit
16:22
Rb, @IntrepidBrit
@DSM my boss's concern is it would be too hard to learn an extra dialect, think that TypeScript is close enough to JS?
@IntrepidBrit we'll smell you first :)
I understand the problem with these JS supersets is that you eventually wind up using frameworks and plugins and they don't play well together.
I played around with CoffeeScript a while back.
DSM
DSM
@corvid: as languages I think they're more than close enough, but as someone who'd never written any JS at all up until a few years ago I'm not qualified to know how well they compare on large projects.
rhubarb
16:28
eh. The part where there's no import statement is what really gets me. Dependencies are really painful to manage
DSM
DSM
@corvid: I thought recent TS added support for es6-style imports?
stackoverflow.com/q/21417304 too broad, and appears the op abandoned the idea in the comments
@DSM It does, I'm saying plain javascript doesn't have imports and that's a huge hole in the language imho
user559633
@corvid they're just files, you can include others by calling them as needed if undefined:)
yeah but it makes it so much more explicit and easy to follow to just see import my_module and go to that to debug
DSM
DSM
@corvid: that's among the reasons I realized ES < 6 was a nonstarter for me.
16:54
I feel like if ES6 is releasing in september, there's no reason not to use it
user559633
i agree that having some 'real' language features would be nice. this is what i use to do includes: gist.github.com/tristanfisher/cfb70f859c99ddc79f13
DSM
DSM
@corvid: with sourcemaps I don't even mind transpilation too much in the interim.
@corvid There is no “release”. There is only browser adoption, and browser support you need to care about.
Eventually everything should pick it up, right? Also, only have to support modern browsers
@tristan Why are you reinventing the wheel?
user559633
16:56
@poke what do you mean? i just use that when i don't have internet access and my dev version won't be able to talk to a CDN to load some JS script
user559633
oh, that's probably fine too.
DSM
DSM
The face I make when I no longer understand how a certain part of my C++ code ever worked: :-|
@DSM That's how I feel about most all of my code.
on my latest
DSM
DSM
@Ffisegydd: I have mixed feelings about "programmers actually signing all their work"..
@DSM we already use it a fair bit to chat to each other, it's a really nice site.
Not so much about signing our work but for quickly encrypting and verifying other peoples identities.
cbg
Got a ping on my 2 month old answer to add details. :/
17:14
@Bhargav I had a ping on this 1 year + old question saying "You should explain that dateutil is a third party library."
Even though I explicitly link to the (non stdlib) docs :/
I'm surprised you actually updated the answer, it was fine how it was. Also, that comment might be wrong about bytes being faster. Did you actually test it?
No. I trusted J.F.
not sure if it's actually applicable, but it was a pretty interesting talk anyway
Downloading that right away.
This might be the first useful JS library ever. ;) github.com/tessalt/echo-chamber-js/blob/master/readme.md
3
DSM
DSM
17:26
Two upvotes for an answer with a syntax error, which obviously doesn't work conceptually, and which can be easily verified to fail. :-/
@MorganThrapp oh wow, this is cool
@vaultah It's all the benefits of having comments (people won't email you) without having to actually deal with the people who leave comments on personal blogs. :P
stackoverflow.com/q/31420883/400617 unclear (when the author of Flask-SocketIO doesn't understand your socketio question, there's a problem)
lol @ that echochamber
.translate() for Unicode string is very slow (compared to bytes version). See Best way to strip punctuation from a string in PythonJ.F. Sebastian 21 mins ago
I read that link and still it is confusing
17:37
Brandon's a really nice guy. I got to have dinner with him after his keynote at PyGotham last year.
Woohoo! The library is feature complete. Just a few more tests, then put it into production and find out that it meets my needs perfectly the design is hooey.
DSM
DSM
What does the library do? (Not that I'm hoping to race you to file a patent or anything.)
@WayneConrad I can break it help you test it. I promise I'll yell at you file bug reports.
does anyone know when the next room meeting is?
DSM
DSM
17:48
I was expecting it to be in August or so, FWIW.
Probably some time late August. We don't have more of a schedule than "somewhat quarterly".
Darn it, I might not be here then.
DSM
DSM
I think we traditionally post a heads-up in the starred list a few weeks in advance.
Is there some sort of document where you can add points of discussion for the next meeting?
Once we get closer, we make a page for topics.
If you want to bring something up, just let us know and we'll put it on the agenda.
DSM
DSM
17:52
And just to be clear, unless the topic is clearly out of bounds, by "we'll see" he means "we'll be responsible for", not "we will loftily consider your petition". :-)
Uh yeah, that's what I meant. >_>
@DSM Can I airily consider it?
I mentioned it a few weeks ago, but I'm not sure if I mentioned that I might not be able to bring it up myself
so it could be no one really took note
Basically, I wrote a python-bot
which can (among other things) execute python code right on the chat
and was wondering if you would be interested in running a copy of it in this chatroom
you would need an API key from Sphere Engine though
I'm (slowly) working on a bot actually written in Python. Executing code is not really what we had in mind, but we can definitely discuss it.
Yes, arbitrary code! As root!
17:59
This one is also written in python, it's hosted on github and based on a sort of SE-Chatbot framework
DSM
DSM
So if someone types os.system("remove_all_files_recursively /") it'll execute it somewhere? That seems unwise, esp. for a room which has had visitors in the past who enjoy, shall we say, unauthorized security testing.
@DSM the code is run on Sphere-Engine's sandbox or whatever you would call that
Not on the machine where the bot is running
Hmm, could have sworn SE-Chatbot was something besides Python.
DSM
DSM
Ah, so you're using someone else's sandbox tech. Much better idea than trying to handle it yourself. :-)
@DSM That's what I was thinking
18:02
We have the "no large blocks of code" rule, and anything small enough is easy enough to just run in your interpreter while you're writing it.
each piece of python code gets its own thread that waits for a response from the server
Is there someone here I can talk to about matplotlib?
In fact - I think we already have a sphere api key - as we were looking at it a while back...
@Anthony welcome, please read our room rules: sopython.com/chatroom: just ask
18:03
that's python_bot
@JonClements cool
Sure, sure. Cabbage, I suppose.
DSM
DSM
When you say "Cabbage, I suppose" I hear it in the dignified tones of "Dr. Livingstone, I presume?"
In any case, I was wondering how matplotlib works, in some sense. I was reading the second answer here :stackoverflow.com/questions/4700614/… and I was wondering why `fig = plt.figure()' was ever called. The code seems to work with out it.
I can run the bot in the sandbox real quick as I did last time, if anyone's interested, some cool features have been added since then.
18:06
actually, both answers are not answers, they're both just "debug the problem"
(How do I make code look code-like in this chat?)
@Anthony All it does it explicitly create a matplotlib figure instance.
Which means that, if you needed to, you could modify it.
For those interested, my bot is running in the sandbox now
18:10
@Ffisegydd But why does it work without it- was anything actually done to the figure? Moreover, why doesn't matplotlib require a specific instance of a figure- isn't this a kind of strange behavior?
and thank you @davidism, is that on the somewhere? I didn't see it.
No, plt.subplot will create a figure for you if you don't already have one.
@Anthony it's at the bottom of the chat window
That it is, thanks.
Holding my breath after googling a Python lib, getting the docs, and then changing the version pulldown to "2.6" to see if my antique version of Python has it.
And @Ffisegydd but, for instance, if I just do plt.plot() I can generate a plot without ever explicitly creating such an object. Can you have more than one plot at a time? I just feel like there's some kind of magic going on somewhere- I seem to be modifying an object without ever explicitly referencing it.
18:14
He's not around at the moment but - HAPPY BIRTHDAY ZERO
user559633
Yeah, happy birthday Zero
Happy Birthday Zero!
Surprising that this question has not been asked before.
DSM
DSM
Similar precedence related questions have been. No idea why this one became so popular.
@Anthony Yes in that case you're basically using the "pyplot" interface which is designed to be easy to use but means you may struggle to do more complex things.
If you want more plot than a time you'll find it easier to use the more advanced interface, let me whip up an example.
import matplotlib.pyplot as plt
fig1 = plt.figure()
fig2 = plt.figure()

ax1 = fig1.add_subplot(111)
ax2 = fig2.add_subplot(111)

ax1.plot(blargh)
ax2.plot(blorgh)

plt.show()
I generally shun the pyplot interface as I much prefer being explicit.
DSM
DSM
Is that the right name for the stateful interface? That plt there, isn't it matplotlib.pyplot?
18:24
So basically what plt.plot does is "Oh hey there! Let's see if you have a figure instance around? Nope! I'll make one for you! Awesome! And I'll make a subplot in the figure! Duuuuuuuuude!"
How can you tell if a requested resource is offline?
It actually says Duuuuuuude does it? That's so far out man!
@Ffisegydd I see, thank you. And also, does plt.show() flush plots, or something? I can't plt.show() twice in a row.
plt.show() will just say "Okay, let's show any existing plot instances that you've made. DUUUUUUUUUUUUDE!"
DSM
DSM
18:27
Ha. Couldn't figure out why my code wasn't indenting correctly, but
void test_weights():
probably wasn't going to work. :-)
Rhubarb
rbrb @thefourtheye
@Ffisegydd So then, does creating a figure also create a plot instance? So how do I create a new plot instance with the same figures, after doing plt.show()?
@Anthony sorry I don't understand specifically what you want to do?
I'm just curious why, if I write plt.show() twice, I don't get two plots.
18:41
You've only created one plot though.
7
A: difference between plt.draw() and plt.show() in matplotlib

Ffisegyddplt.show() will display the current figure that you are working on. plt.draw() will re-draw the figure. This allows you to work in interactive mode and, should you have changed your data or formatting, allow the graph itself to change. The plt.draw docs state: This is used in interactive m...

What? They're releasing mpl 2.0? :O
DSM
DSM
<anime voice of confused disbelief> "Ehhhhhhh?"
Just saw in the mpl docs headers. They're warning people that in 2.0 they're changing the default visual style (taking some pointers from seaborn maybe? :P)
@davidism That was fun, thanks.
DSM
DSM
Oh noes! If they set numpoints=1 by default like everyone wants, where will my rep come from?!
@Ffisegydd I think I'm confusing something, but I don't know what. After creating my figures, plt.plot() looks for them and finds them. Does it create a plot for me as well? And does the plot get deleted after calling plt.show()?
18:49
No it doesn't get deleted, it gets shown. The object is still there, it's just visible.
Calling plt.show again does nothing as it's already visible.
Finally Completed the answer
Bytearray was really really fast stackoverflow.com/questions/29998052/…
10 times faster than the generator expression!
Oh. How does it know it's visible? I was under the impression is was some kind of print-like thing.
This programming question is actually fairly difficult
@Anthony I don't know. At this point you'd be better off code-diving and looking yourself. I can tell you what matplotlib does, but not necessarily how it does it :P
(Without code-diving myself)
@Ffisegydd I see- thank you for all your help!
19:00
@Anthony look on the plus side - you're not having to get yourself in d3.js mode with a headache - might have to pick @Ffisegydd's brains at some point :)
Once I start at BigCorp I'll be able to officially call myself a consultant and hence charge by the minute.
@JonClements Unfortunately I have no idea what you mean lol.
@BhargavRao That comparison is not really fair.
You have to have the same input all the time, it being a string, not a bytes object because your solution happens to need that.
Yep @poke I edited the answer to take care of that a few seconds ago.
@Ffisegydd rounded up to the nearest day of course :)
19:07
I added ('mississippi').encode('ascii', 'ignore')
Fwiw, I've found code diving tge best way to work out the detail of what pyplot is doing. I know what you mean about plt.show(), if you call it then shut the window, then call again, the plot is "lost". Somewhat counter intuitive, maybe - a side effect of pyplot doing lots of implicit stuff
@JRichardSnape I think another issue is that I'm using ipython, so the fact that there was a pop up window was not known to me.
Or rather, I wasn't even thinking about how it works outside of ipython
Ah, I see. Yeah - similar issue, albeit different display mechanism
But so it just flushes the plot? How can I get it to re-plot?
I'm with fizzy, as soon as you want anything clever or to re use axes or figure objects, go explicit and drop pyplot
Having said that, pyplot is still ready useful for quick get-up-and-running stuff and I use it a lot
Ready = really (phone typing)
19:15
Ohhh. Alright.
Thanks everyone.
Bah... and now a slight nose bleed - f*ing typical I'm wearing a white shirt
Grrrr, stupid banks and their stupid, stupid, faces. grumble grumble.
Are you speaking of Riley Banks?
@BhargavRao Hmmm?
The cliff faces on the banks of Dover?
19:23
lmao. Edit: "lmao" fits better
@MorganThrapp Only @vaultah can understand
@BhargavRao :(
Pro-tip. Search for vaultah on twitter and see his tweets!
Oh, haha.
@BhargavRao Please replace ever occurrence of bytearray with bytes, thanks.
Also, all the translate solutions working on strings are not going to work.
Actually @poke I am following all the suggestions from J.F. there.
I will edit it to replace bytearray with bytes in a few minutes
"Use a debugger and figure it out" is the answer to most problems, but Stack Overflow wouldn't be a very good Q&A if that's all there was. Edit your question to include a minimal, complete, and verifiable example and edit your answer to actually address the problem. — davidism 2 mins ago
Hopefully that doesn't sound too mean.
I was considering adding something similar when I saw your earlier link. I think that's reasonable.
Hi, is it possible to build up a streaming API using Python, I am using flask for now for building APIs ?
DSM
DSM
I might have added :-) after "all there was", "specifically" instead of "actually", and maybe "Could you please edit" and "problem?" to soften it a bit, but it's perfectly reasonable as it stands.
19:34
@black-perl yes, it is possible
Wish every question was that easy
@davidism , So I have a service constantly running in background that collects data, I need a way to send the most updated data when a GET request arrives, if any ? Is building a streaming API would be good choice ?
I don't want to involve any databases.
If I have an improvement to someone's answer, should I edit it in? Or just leave it in a comment?
@davidism I guess a queue of JSON responses would do the job :)
Should be a comment @MorganThrapp
@vaultah Okay, that's what I did. Just wanted to make sure.
19:42
@poke Yep. bytes is faster than bytearray
I am adding that to the answer. Thanks a lot
shouldn't this work? [a - b for a, b in zip(list(word), flattened * 2)]
probably not, you can't subtract strings
@vaultah Reminds me of videos where youtubers would go into black neighborhoods and bait locals into fights with hidden camera 'pranks'.
Hrmph. I just want to subtract two lists and remove all that appear in both
Subtract two lists?
19:46
Uhh... what?
@corvid Sets.
@poke That won't work because I need the same amount of occurences
Counters.
Eg, I have ['b', 'b', 'b'] and ['b', 'b'] and I need ['b']
19:47
If you can produce sample input/output, one of two things is going to happen.
1) You get SO karma
2) You realise the solution before you finish posting to SO
@corvid what if you had ['b', 'b'] and ['b', 'b', 'b']?
answers += 1
Argh. Now how do I attribute that to you @poke. :(
@Bhargav Attribute what?
@davidism still ['b']
19:49
@poke For bytes is better than bytearray.
Do you care about order?
@AaronHall no way! You post answers regularly on Stack Overflow too? We never would have guessed.
collections.Counters makes a great bag/multiset.
@corvid What about ['a', 'b', 'c', 'a', 'b'] and ['a', 'b']? Do you need order? If so, which are removed?
@davidism I'm always surprised when users of a site use the site.
19:50
@BhargavRao Oh, no need for attribution
@corvid use a counter, then take all the keys who's values are odd
@poke Thanks a lot for that find. :)
Now there are eight other alternatives on my answer
Oh, did you kick him?
Nope, wasn't me.
19:51
@corvid What you're talking about sounds an awful lot like stackoverflow.com/questions/9960133/…
@AaronHall You know what’s also nice? Not bragging about one’s own accomplishments all the time, especially when in a community where all around you are just as helpful as you (or even more helpful actually). Do you see anyone constantly bragging about what awesome answers we post or problems we solve? No. That’s because we don’t need to brag with what we do in order to earn respect from others, and because we know that bragging without anyone asking for it is just super annoying.
Well that test was discouraging. Thought it'd be a somewhat easy problem
@poke It's just a shame he left the room. I really hope he sees this.

« first day (1733 days earlier)      last day (3440 days later) »