« first day (1730 days earlier)      last day (3443 days later) » 

00:54
Here's the builtin implementation for 2.7: hg.python.org/cpython/file/cfb84be6c7fc/Modules/…
That's doing a lot more than the small swig one.
and the swig one isn't very robust:
>>> example.fact(34)
0
>>> example.fact(33)
-2147483648
>>> example.fact(32)
-2147483648
>>> example.fact(31)
738197504
 
5 hours later…
06:13
I hate to ask this... but would anybody like to help me optimize? I'm running a script in the cloud where I'm allowed 1GB of free RAM, but apparently my script has started to exhaust that. I know that my script could be optimized quite a bit.
user559633
06:24
@kaloncpu57 Hey there. Post your script in a github gist?
@tristan Alright, will do!
gist.github.com/kaloncpu57/7387cf50a6cadc4fc4e9 I can put in comments in a lot of places if that will help...
user559633
when you say that you script has exhausted ram, how did you determine this?
I kept getting Segmentation fault (core dumped) so I looked it up and found that it probably meant the RAM was being used up.
user559633
oh, no, that's not a very good way to determine that your script is at fault.
I'm sure if it is the RAM, it has to do with opening and closing a file every half a second.
Oh, why not?
user559633
06:31
you could look on the outside and watch the process with top or ps or something of the like on linux or OS X
Alright! I'll try that really quick.
user559633
because a segfault can happen for any number of reasons and a more likely candidate is something else than memory
user559633
as for "i open and close a file every half a second", if you mean this: gist.github.com/kaloncpu57/… then the context manager will close the file for you appropriately -- you'd only have to worry if you were opening very large (more than say 500kb) repeatedly without closing it
user559633
and that would only be if you were opening a large text file and assigning it to a new variable
Ok, there seems to be quite a bit of memory still free when running the script.
Also, I meant this gist.github.com/kaloncpu57/… but I guess that's not AS important anymore.
user559633
06:41
oh, you could use a context manager there too
user559633
to make sure that it gets properly closed
user559633
but yeah, memory is an unlikely culprit here
user559633
you always run this in python3, right?
I was sure thinking 1GB of RAM was a lot for this script to use up.
Actually, I'm pretty sure the VM has Python 2.x installed.
user559633
@kaloncpu57 Okay, you're sleeping for 0 second then gist.github.com/kaloncpu57/… means time.sleep(0) on python2. time.sleep accepts a float, so you could do time.sleep(.5) if that's what you want to express
user559633
06:45
brb running downstairs to grab a coffee
Oh! That's really good to know.
user559633
python 2's 1/2 is equivalent to python3's 1//2. you could also say 1.0/2 to express .5 in python2
I just used 0.5 for now. I'll keep that in mind though.
Is there anything you see that might cause this segfault?
user559633
07:17
@kaloncpu57 time sleep of 0 wouldn't cause a segfault.
Is it possible to get an execution profile that reports the line number?
That way when you get the segmentation fault, it will indicate the line number and it will be easier to track down what is causing the segmentation fault
Cbg all
The last thing I was working on before this started happening was lines 108-109, 117-118, and 122-123...
Every other error I get comes with a line number... I'm not sure how to get one for this.
Huh... It seems to be running for a normal amount of time now.
I didn't even change anything since the last update of the gist.
I can't reproduce the problem now... I kind of dislike when things magically fix themselves.
user559633
07:59
@kaloncpu57 your code isn't running in isolation in the system. it's possible something else was happening.
Yeah. I guess I'll just have to accept that it could have been crashing due to something else.
Thanks for all of your help anyway!
user559633
Yeah, no problem.
Hey up lovelies
user559633
Hey!
user559633
08:16
I figured out what "optimistic procrastination" looks like in case it comes up in pictionary
user559633
user559633
Oh man, my talk got accepted for PyGotham!!
08:31
Gratz. Will it be put online? Like all your other... videos...
user559633
Conference or "other" videos? Yes to the prior, I neither confirm nor deny the existence of the latter.
Cabbage all
user559633
cbg
Well done on getting your talk accepted @tristan
08:45
What's the talk on again? Why Ruby is better than Python?
user559633
@JRichardSnape Hey thanks
user559633
@Ffisegydd Why more lines of code make for better programs. Otherwise, if you don't write more lines than needed, you're like a painter that doesn't paint or a runner that doesn't stretch.
user559633
09:00
["foreign function interfaces for web developers" and it's about integrating your application with other languages to better handle the constraints/thresholds of programming for interactive websites. i'll also be talking a little about aeronautics, real-time & reactive programming]
user559633
okay, airport time. have a good sunday everyone
take care
09:21
4
Q: Python backreference replacing doesn't work as expected

O'SkywalkerThere are two named groups in my pattern: myFlag and id, I want to add one more myFlag immediately before group id. Here is my current code: # i'm using Python 3.4.2 import re import os contents = b''' xdlg::xdlg(x_app* pApp, CWnd* pParent) : customized_dlg((UINT)0, pParent, pApp) , m_p...

how to achieve the same effect with re.DOTALL?
anybody here?
anybody can help me?
 
4 hours later…
13:23
Hey up
Hi, Fizzy. Quiet here ATM.
I'm trying to write cover letters :\ they feel artificial
You moving job @corvid?
Every part of the interview process feels artificial to me. I can basically never find a good segue to talk about collectible trading card games.
13:34
what if you applied for a job to program collectible trading cards? Apply to work at Blizzard for Hearthstone team
Incidentally, it is said that programming for Magic Online is the worst job in the world
Noncompetitive pay, perpetual crunch time, and ever-increasing technical debt.
Sounds like every game programmer ever.
Unfortunately there are an infinite supply of starry-eyed nerds that will jump at the "opportunity"
Their recruitment process is literally to go into game shops on Friday nights and ask "anyone here know how to program?"
Could be worse, could be in QA.
This is true.
brb
13:39
On the other hand, the gaming industry is not that big, so if you're involved in the making of a triple A game, you can easily transfer across the gaming industry to other companies
"We've released a new build, please verify bug #314159 where one card has the incorrect image after 9000 games."
^ that's still better than "if you run into this rock at exactly the right angle, you might clip into the geometry. Test to confirm"
I disagree. Not when you have daily builds. Over 9000 games a day is a lot of games.
A recent xkcd on job interviews:
13:45
"Name one situation where you turned a weakness into a strength". "Normally, the card 'Illusions of Grandeur' is impractical to use, due to its expensive cumulative upkeep. I used Donate to give the permanent to my opponent, foisting the responsibility onto them and eventually causing them to lose 20 life"
interviewer nods, writes "good at passing the buck - management material???" in notebook
You're my hero, and I'm not even being sarcastic.
If only admiration was a currency I could exchange for goods and services
But I do value the sentiment - just not in a way I can turn in and receive a loaf of bread from the supermarket
We should set up a donation button on the sopython site.
"If you enjoyed your time today, please consider subscribing. Subscriber benefits include: coloured text, extra stars, immunity from our MTFLs scathing wit, and more!"
"All subscriptions go towards buying Kevin some bread."
14:01
Like KickStarter - if you pay the max donation, you get a personalised quote from the StarLord himself!
Try our new panda hat DLC
(Some photoshopping required)
"Backers rewards include tristan writing a personalised insult to your mother and davidism kicking you out of the room. Back now!"
3
It's flawless - Kevin will be able to buy Walmart with the donations - not just some bread!
cbg
So after decades of using Windows, i finally made the right decision and switched to Linux...
3
14:15
Speaking of davidism...
I'm wary about bots making fully-automated edits, even suggested ones. At a minimum there needs to be an emergency shutoff somewhere that the bot checks before each edit, as with Wikipedia bots. If the bot edits slowly enough for someone to notice before it's made all the edits, it will at least limit the damage in cases like this one‌​. — Jeffrey Bosboom 7 hours ago
The claim to fame that keeps on giving :)
14:46
@davidism ahh yes... useful update...
15:02
I was debating replying to that comment. :-]
I don't think Jeffrey Bosboom was having a go at you, he's just pointing out what can happen When Bots Go Bad.
Sounds like a new TV series :)
I was debating replying amusingly to that comment. :-]
Well - you should be obliged to now... otherwise it's just teasing :)
Nah, you're probably imagining something better than what I could come up with.
15:20
Make a donation to Kevin - he needs bread. He'll write something for you :)
@Kevin see - already getting your hi-tech begging off the ground - I want my 10% referral fee though! :p
How do I convince a competent newbie to incorporate his giant comment into his answer? stackoverflow.com/questions/31368683/…
@PM2Ring just say that comments are hard to read when they contain code and aren't guaranteed to hang around - so it's better if he edits and makes use of formatting available in answers etc...
Shall do
Bah, load of effort on bounty question, OP doesn't accept any of the answers, award bounty to any or respond to comments or queries. I dislike that because it makes me feel petty that I'm annoyed.
15:38
@JRichardSnape might get an auto-awarded bounty as a runner up prize though?
Yeah, I'll get half, but it's just a bit disappointing - is there something else the OP wanted, cause I could probably address, waste of opportunity to learn / improve etc.
Anyhow, not to worry, their loss.
How long left on the bounty? Could be they've forgotten about it or otherwise busy?
@JRichardSnape I'd say you're justified in being annoyed. And on that note, there's been no movement on the question that I wrote that class factory thingy for the other day.
Grace period just expired. they've been on the site, I and others have left comments. Ho hum. Maybe they just forgot or something
@PM2Ring yeah, weird, with such a specific requirement, you'd have j thought they'd be all over that ctypes question. Still, it's a nice answer.
This guy keeps editing his answer in response to my comments, but it's still wrong. I suppose I should give him some more time before I down-vote.
@JRichardSnape Thanks! Maybe he's just forgotten that he asked the question. :)
15:51
Seems everyone is having problems with OPs today
Also cbg
cbg @JGreenwell
Greetings, JGreenwell.
Unfortunately, OPs are a necessary evil. :)
Also, hi to Johan Larsson! I'm listening to some nice stuff on 1.FM - BLUES RADIO http://205.164.62.21:7040
It's my own fault for answering non-python questions
4
so what's the deal with front end engineers seeming to be so desireable to companies lately?
everyone wants to build client-side systems 'cause it's hip
might also depend on the area; like here the majority of jobs are C#/.Net, the highest paying jobs are legacy (COBOL in particular), and the analytic jobs are hard to come by but are some of the best companies to work for when they exist
Wow. People are still using COBOL? I used to know COBOL, but that was a few decades ago.
speaking of analytics: would you consider scorecards a "new" analytic method (model)? I got into "a bit of a row" with a professor over some big data definitions and whether scorecards where new (his assertion) or whether they were old techniques with updated UIs (mine)
My first programming job was COBOL, 1999 when they threw anyone they could in front of a terminal to fix legacy code
Oops! It's that time again. Rhubarb, everyone.
16:15
rbrb
16:30
Can someone point me out how to properly run this python module:
what do you mean "properly run"?
Please don't post lengthy code snippets here, use pastebin services instead
@feners welcome, please read our room rules: sopython.com/chatroom
use dpaste.com to post long blocks of code.
I mean the I've tried to run it through console but nothing...
16:32
properly like: pinky up when you hit enter
when I run the module directly with python, it runs and stops...
and sorry for not following rules!I will use pastebin next time!
use it this time
ohh yeah!lol
Since the file contains a hashbang at the top, you need to make it executable and then call it from bash correctly.
chmod +x my_file
./my_file
I'm assuming that what you mean by "run properly" is "don't require python in front"
Even though both methods are "proper" (whatever that means)
I believe that is what I want..lol
Please excuse my newbness
Because I'm supposed to type in when it runs..
16:37
If by "type in when it runs" you mean "provide user input", then you can do that no matter how you run it. I'm still not clear what the actual problem is.
:24405832 i type chmod +x  in my console?
Yes, in the terminal
Hey up again
yo fizzy
:24405889  chmod +x ./rev.py
like so?
16:40
Yes. Stop formatting like that. Use backticks around a line of code to format it.
@davidism Nothing happens when I do this. The hasbang at the top, what do I do with that?
@feners you leave it. That command marked the file executable, so if you keep following my 2 step instructions, you type ./rev.py next to run the file.
stackoverflow.com/q/31369737/400617 extremely unclear or needs mcve, user cannot seem to explain themselves
Ahhhh! Got it
Thanks man!
17:10
Day #1 with no interwebs: I'm already bored beyond description. Viewing cat gifs on my phone isn't the same. I'm not sure how long I'll last, how long I'll stay sane.
@Ffisegydd Just let sanity slide... it makes life soooo much easier...
17:50
I tethered my phone to my computer and burned through the monthly limit in 4 days.
When I moved in to my house, not recently. It was worth it, I would have gone insane like @Ffisegydd otherwise.
18:03
If anyone who contributes to Flask is ever around, thank you for allowing me to successfully get rid of webpy completely. I enjoy using the framework so much more than I did with Django. Thank you
cbg @Peter!
hey, hey @JonClements 'sup?
Same old... you?
same here is well :)
18:13
Ahh.. we're exciting then :)
indeed, dear sir, indeed!
actually I'm working on something pretty cool now -- but I can only show you on Tuesday
:)
I eagerly await :)
@davidism Yeah I may consider getting a 1 month dongle if it'll more than 2 weeks.
18:38
Deadpool trailer looks insane.
there's a deadpool movie coming out?!
Deadpool is one of my favorite comics
Yeah Feb 2016. It looks immense.
18:59
Just checking to see what "Lucy" is like... seems to have a good rating.... sounds like a relatively interesting plot
not really a movie person; last movie I really liked was "the imitation game" though I did wish the blue-ray had a real-life vs. hollywood feature or some other biography of Alan T.
19:41
Guys, I have a little problem and I'm about to go crazy on the keyboard, however, I think the question is a little to simple to be asked on SO.
So I tried to make a multiplayer chess game
and as far as I'm concerned, it's very messy and not really understandable, but it works
So, I created a matrix class, which creates 8x8 matrix, has a method to put symbols, display matrix in a nice formating etc etc
And I got stuck on socket part
I was reading a book "Black hat python programming" as there was a nice explanation on how to create a simple TCP server and a client
And the problem was, when client and server got to connect, client sends a message, server returns ACK and the connection closes
in order to get them back in contact, you have to restart the server and restart the client
since I need data to be sent after every turn
really very simple, starting column, row and ending column row
But it doesn't help if the connection closes after first conctact
He was using threading and socket for server and only socket for client
So my question is, how do I make them communicate constantly without those connection teardowns? Is there maybe a command that makes them do it (like .close() on both parts?)
If anyone is interested, I can send you the code, it's like 600 lines of junk, but no need to worry about math part, I only need to get the comm working
760 lines*
Dan
Dan
I have an object that seems to lose an attribute value between two functions and can't figure out why
driving me crazy!
can anyone take a look at it for me briefly? It's a short script
Well, I'm not sure if I could help you, have you tried debugging it and checking value of the attribute at every suspicious line?
Dan
Dan
@Meaty yes
I can print the value right after assignment
Well, that's a good way too.
Dan
Dan
then when another method in the same class tries to reference it, it has an empty value
this is the script: pastebin.com/U1WCv7FU
19:50
sec, let me take a look
Dan
Dan
it expects this input via stdin: pastebin.com/y73m79pq
uff, networking again, I myself am struggling with this lol :D
Dan
Dan
self.location is the issue for the IPAddress object
in line 47 it gets the value just fine
I printed self.location to verify
but in line 78, self.location is an empty dict
sec
hmmm
It's a lot of new code to me
but here's what I think
you line 47 is under else condition
does this look like a good build for a meh tier computer? pcpartpicker.com/p/v7BRxr
19:55
is ti possible that condition was fullfilled?
and the value wasn't assigned
So when you try to get it out in the other class, it just can't get it?
Dan
Dan
@Meaty the value is assigned when the ip address is classified, which occurs at initialization
Oh!
Dan
Dan
see line 47
yeah, that's what I'm telling you
at init
you're assigning it as an empty dict
Dan
Dan
and notice than in line 74 I am only listing public IPs
19:57
in line 47 it gets it's value
Dan
Dan
and only public IPs get a location assigned
@Meaty yes i verified that
so it sees self.location just fine inside the class
Yeah, I'm starting to get what you're saying
Dan
Dan
but when instantiated inside the other class, it is missing
Yeah, I haven't ran across that problem yet, and I've done this, creating objects of another class in a class and it seemed to work just fine. :/
But try asking it on SO directly then, I'm sure someone will know the answer
Dan
Dan
@Meaty k
20:02
And man, I envy you, your code looks so nice :D
I mean tidy!
Dan
Dan
@Meaty pep8 ;)
@Meaty I just figured it out!
I need to switch two lines around, 13 and 14
self.location is assigned during the method call in line 13
but then in line 14 it sets its value to an empty dict
oh, I'm glad you did, I'm still struggling with client-server thingy....
And my code is so messy, it's hard to organizes it...:P
organize*
Dan
Dan
i need to declare self.location as an empty dict before calling self.classify()
thanks for trying to help tho
appreciate it
no problem ;)
20:33
hi
hi
new profile pic
thoughts?
@vaultah probably could migrate that question?
not sure, don't think SO will allow that
 
1 hour later…
22:03
Hi!
meow
23:06
python multiple assignment gives unintuitive behaviour
x = [1]
x = x[0] = [2]
You'd expect x to be equal to [[2]] at the end
And that's what most languages do
But in python, x is equal to a list containing itself
try this:
y = x = [1]
x = x[0] = [2]
and now inspect y.
y remains [1]
fwiw, you pretty much don't do that in any real-world code unless you actually want this behavior.
Why would you want this behaviour? It's entirely unintuitive
(and then you still deserve to be name-called by whoever reviews your code because you're writing weird code that'll just confuse other people)
23:15
Sure, but that doesn't excuse the behaviour
true.. i guess every language has some WTFs
i think the ordering of loops in list comprehensions with more than one loop is much worse
[a for a in b for b in c] will fail; you actually need [a for b in c for a in b] (assuming you want for b in c: for a in b: lst.append(a))
It makes sense when you break them into multiline and space them like for loops.
too bad that's pretty much unfixable except with a new major version of python that is willing to break backwards compatibility in a way that might not always fail but simply change the behavior of existing code
@AaronHall: I don't think so. if you read it you read "take a for each a in b for each b in c"
[a for b in c
        for a in b ]
I think that makes sense
Now multiple list comprehensions - that's something that shouldn't be in real world python code.
multiple assignment is trivial to read compared to that (at least if it were working correctly)
*multiple assignment with dependencies
23:41
Hi I want to know the reason for downvotes on a question (& answer) I posted that seems to have gone cold. May I post the line here?
*link
If someone could take a look and let me know that would be great. I see @ThiefMaster is here, TheifMaster, do you think you could explain to me?
Your answer looks like you were posting "what i've tried" style information as an answer, even though it should be part of the question
I get that, why downvote the question though?
wasn't me
Haha! Not blaming you! I'm new to SO. Just wanted to know the customs and traditions here.
Oh.. where you actually trying to post a question and the solution? In that case I can undelete your answer.
But with the comment you posted on the answer it sounded like you actually had a question related to that "answer"..
23:51
Yes I was. But I've now modified the question itself to make it easier to read and the previous answer is in What I've tried section.
I have a question about your solution though, what if I want each permutation to be a different list?
uh, to be honest, i haven't read that much of your question.. i just noticed that the loop can be simplified to a list comprehension
and looking at the clock (almost 2am here) i don't think i'll want to have a closer look right now :/
Oh! That is alright :) Thanks for your help.

« first day (1730 days earlier)      last day (3443 days later) »