« first day (1784 days earlier)      last day (3167 days later) » 

3:00 PM
I didn't bookmark it because I thought I'd be able to easily find it again. But I guess I should've expected that either the comment or the whole question would get deleted.
 
I kind of liked Doom...
 
@PM2Ring A bad choice there, given that it was delv-pls request
Aug 29 at 15:32, by Bhargav Rao
http://stackoverflow.com/questions/4066361/how-to-obfuscate-python-code
 
@JRichardSnape We're getting there, but it may take some time if the question quality of the last couple of days persists.
 
Don't worry. Despite the eternal September, the temporally normative September is worse.
 
"For loop problem" would be the worst title I've seen today, except I saw "Python Flask SQLAlchemy" earlier. Please try to clean dupe targets up if possible. :-)
 
@BhargavRao I found one with consecutive for loops reading the same file...
 
There are many actually.
After a query I found 100 results. Atleast 50 would be the same (Worst case ratio)
 
DSM
Morning cabbage.
 
cbg DSM
 
DSM
3:12 PM
I'm having one of those #clientfromhell days. Doesn't bode well for the weekend. :-/
 
@BhargavRao There's this stackoverflow.com/q/7247031/4014959 but it's not great.
 
@PM2Ring Even this is a close call for that
 
@DSM ooh commiserations
@BhargavRao surprised you didn't flag the comments there ;-p
 
Oops @JRS. Thanks for reminding
 
user559633
Thanks all :)
 
3:15 PM
This is a good answer: stackoverflow.com/a/3906148/4014959 although the question doesn't use a nested loop.
 
@tristan How did it go about?
 
user559633
@BhargavRao pretty good. swing and a bit of a miss on an implementation of a ring file implemented by a function that takes no arguments
 
DSM
I would have missed that too, not knowing what a ring file is.
 
Thats awesome.
 
user559633
e.g. file is ['a','b','c'], write a function that takes an optional initializer and returns the next item on each call. e.g.
r()->'a'; r()->'b'; r()->'c', r()->'a'
r(1)->'b', r()->'c', r()->'a',r()->'b'
 
3:18 PM
@PM2Ring One of the reasons I added doc links to my answer is for the sake of completion ;)
 
user559633
the problem being that using an iterator will exhaust it
 
DSM
So file is global w.r.t. the function, or is that passed as an argument?
 
user559633
it's global, not passed
 
user559633
brb
 
@tristan I guess you weren't permitted to use itertools.cycle
 
3:24 PM
Requires dark magic:
seq = ["a", "b", "c"]
def r(idx=None, last_visited=[-1]):
    if idx is None:
        idx = (last_visited[0]+1)%len(seq)
    last_visited[0] = idx
    return seq[idx]
>>> print r(), r(), r(), r()
a b c a
>>> print r(1), r(), r(), r()
b c a b
 
DSM
But if the iterated object could be something not a sequence (like a file) you'd need to handle the cache yourself.
 
itertools.cycle maintains its own cache so it can handle any iterable. But that's wasteful for things like sequences. Or for files, which can use seek(0) in the generator.
 
DSM
Depends on what you're trying to conserve, memory or random access time, I guess.
 
user559633
@PM2Ring Yeah, I figured that would be out of bounds
 
3:29 PM
This is why you should memorize the implementation of every itertools recipe.
 
Although I guess that wouldn't be allowed either.
 
Pardon me. I meant to say, this is why you should memorize the implementation of every itertools function.
 
DSM
Sometimes I wonder how different Python code would look like if all the functions from the more-itertools/itertoolz/etc. packages were in the stdlib. Would the community have fractured into those of us who like functional-style code and those who don't?
 
When they say "you can't use cycle", you create an identical version from scratch and give them a sly wink
 
Why stop there? Memorize the implementation of Python and you can just re-create all of it.
 
3:32 PM
That's what educators are preparing us for when they give problems like "find the largest item in a list without using max"
they knew... They knew all along.
 
user559633
For what it's worth, this was an interview for a job in a different team at the company I already work at. If I said "itertools cycle", it would be met with a "yeah, good point, but this is a walk me through your thoughts question"
 
wow - they're brave if they want a walk through your thoughts
 
"Yeah, and my first thought is "I'll use itertools.cycle", followed closely by "while I wait for my coworkers to reinvent the wheel, I wonder if anything good is on reddit?""
 
DSM
Lock and load, gentlemen. We're going neurologically in-country.
 
user559633
@JRichardSnape Haha
 
user559633
3:41 PM
I already had the position, but I asked to be interviewed because I'd think it was unfair to everyone on the team if I got to skip the formal interview process -- I wouldn't like it if someone got on my team from a "side-channel" (and it's possible that in the interview process, it could be decided that I wasn't as strong a candidate as assumed)
 
user559633
@Kevin I thought about this, but it binds to the func on a param I didn't think I was allowed
 
DSM
You could use a function attribute (hacky, but works.)
 
user559633
Haha, awesome.
 
user559633
i considered just dropping something in the global scope
 
DSM
(cracks knuckles) Sometimes you've just got to break out the hasattr.
 
3:46 PM
Why doesn't this def function return a value?

    def browse(self):
            filename = QtGui.QFileDialog.getOpenFileName(self, 'Open File', '.')
            fname = open(filename)
            dataLog = fname.read()
            fname.close()
            return dataLog
   ? (Sorry if i messed up the format)
 
user559633
@JeanP Control+k. No other non-code text. Don't apologize, just fix :)
 
Please indent each line by 4 spaces (or press ctrl+k) to format blocks of code. You can edit messages for 2 minutes. The backticks are only for inline code, remove those.
 
Don't you mean 30 seconds?
 
user559633
What do you expect dataLog to be?
 
21 seconds
 
3:48 PM
To go!
 
dataLog is the text in the file.
it prints it out when i call a print command but i cant get it to return outside.
 
@Ffisegydd nice
 
user559633
@JeanP Is it an empty string being returned? Are you at the end of the file?
 
DSM
"i can't get it to return outside" is not actually a thing, if you know what I mean. You executed some command somewhere, and it didn't do what you expect. That command, and its context, are what we need to know to help you.
 
So okay. If the file has "Bird and Cats" it will print within the def if i call print dataLog Now what if i need to use what dataLog has outside of this def. I have an understanding of return from C but i was expecting it to work similarly here.
 
3:52 PM
@JeanP So if you do print(dataLog) inside the browse() method it prints the file contents you expect, but if you do print(myobject.browse()) you get a blank line?
 
HA see that was my issue I didnt know how to call it outside of the def.
I was used to just calling the variable rather than the def with the variable.
 
@JeanP "defs" are called functions, or methods
you have to call the function to get its return value
 
user559633
MOS DEF
 
the names of things inside functions don't mean anything to the outside world
 
DSM
MOS DEF != Ford Prefect
 
3:56 PM
Is this a def jam?
 
Yeah I figured as much, In C i could just return any name and set that name to a variable. and be done with it. I didn't need to call the function to get its return value.
Thank you
 
user559633
>>> from mos import def
>>> def.mathematics()
youtube.com/watch?v=m5vw4ajnWGA
 
DSM
@JeanP: "I didn't need to call the function to get its return value" -- umm, yes you did.
 
 I meant something like

     int get_num(int num)
     {
       printf("Please enter an integer from 0 and 2\n");
       scanf("%d", &num);
       if (num == 1)
         return num;
     }

now if i print num outside it would give me num.
 
DSM
No, it wouldn't.
 
user559633
4:00 PM
No, it really wouldn't.
 
user559633
What DSM said, but louder, kind of inappropriately loud, now that you think about it.
 
stop shouting tristan
 
Like how deep of a voice are we talking about here Tristan?
 
DSM
Python and C do have many differences, but this isn't one of them.
 
and i just realized what i said @DSM lol You're right
 
4:03 PM
:slaps JeanP with a wet fish:
 
I would have preferred a dry fish.
The smell is stronger.
 
user559633
@JeanP 1970s trans am idling
 
Speaking of py and C
 
@tristan that baby can purr
 
4:06 PM
Err @PM cough cough The 10 min rule
 
@BhargavRao Whoever made that comic is very, very rich I hope.
 
user559633
@wonderb0lt why?
 
@BhargavRao Well, wait 5 minutes. :)
 
@tristan It's relatively old and is still used a lot.
 
user559633
@wonderb0lt oh, i see, it's the first time i've seen it
 
4:08 PM
rhubarb
 
rbrb PM
 
@wonderb0lt The Hejibits website has a "donate" link, so I assume they're not so rich they no longer care about money.
Internet ubiquity is hard to monetize, especially when people photoshop out your copyright notice and webpage url
 
@Kevin Thanks for the source. I was just looking for it
:(
 
A phenomenon well-illustrated by this comic
 
user559633
Anyone want to make narcissism.me into a Social Somethingsocialsocial Networksocial so we can rake in the dozens of dollars?
 
4:12 PM
Rbrb. Heavy thunderstorms here.
 
Stay safe. Avoid open fields and don't shout "all gods are bastards"
 
I plan to leave, Kevin comes up with a good one liner, I stay back
Sums up my day to day activity here
 
I'm just plagiarizing from Pratchett :-)
 
DSM
@Morgan: huh?
 
@DSM It's a site from NASA where you can (theoretically) sign up to have your name sent to Mars on the next rover.
But it doesn't seem to actually work, and it looks like it was designed by a 5 year old in the 90s.
 
-3
Q: static page vs dynamic page, which is much more effective?

Jimmy YangI understand that there are many answer in the web to this question. However, the comparison is not to the point. The mainstay is that static page is inferior to dynamic page. However, I use python to create and update static page all the time. Some people argues that "A static web page (sometime...

 
DSM
That's because it's not the NASA site but a broken copy. Compare this.
 
Is it just me, or is "but you can regenerate them all the time" not really a great argument for static vs. dynamic sites?
 
4:29 PM
That looks the same to me, and the link I posted was just tweeted by NASA.
It resolves to the same domain.
 
DSM
The version you linked sends me to cloudfront. The version I linked sends me to mars.nasa.gov, and it looks very nice.
 
Same
 
Huh. They both send me to cloudfront.
Unless I open it in an incognito window.
That's what I see.
 
DSM
cloudfront looks like that. I see
 
Yeah, I see that in an incognito window.
 
DSM
4:35 PM
I don't understand the redirection.
 
It's because of HTTPSEverywhere.
If you access the site with HTTPS, it breaks hard.
 
DSM
Ahh, that makes sense.
 
Yeah, I'm liking https everywhere less and less lately for that reason.
It's really the site's fault for not supporting https properly, though.
 
So then I stand by my original statement of NASA not being able to build websites. :P
 
4:37 PM
stackoverflow.com/q/32402409/400617 needs mcve, op explicitly says "I can't write that"
 
V. tempting to comment "sorry dave, I can't do that"
 
cbg all
 
cbg Jon
 
cbg
 
Friday \o/ and all that
 
4:47 PM
That "security" question is funny, what makes people reinventing the same wheel all the time.
 
Bleh... I hate parsing really particular strings to mean something. Like 1/2x, why not just have { perSlot: 1, slots: 2}?
 
Hey up all
 
ugh
 
@bereal also all of the "answers" are really comments by the OP
 
yep
 
4:50 PM
What a donut
 
What bothers me, is that the guy has traffic to monetise. And I don't.
 
And an awful lot of it, if they really think that rebuilding millions of static pages a day is more efficient that dynamically building them as requested
 
oh, that's the same guy
 
Afraid so!
There should be a moderator flag for "this isn't really serial voting, they just keep asking legitimately terrible questions"
 
And even worse, he will implement that in some dumbass way, and that will somehow work, and pay him enough.
 
4:56 PM
I can use my new 20k powers to immediately vote to delete it once it's closed. Abuse!
 
It's almost enough to convince you that life isn't fair
 
wow, his other questions are just as awful
 
Right, good weekend rhubarb everyone
 
Are answers on meta sites expected to have perfect grammar? Or there's some leeway (like on SO) and somebody will fix the answer (eventually) if the grammar is terrible?
 
@vaultah I'm sure it will be fine
 
5:04 PM
Thank you
 
Aww, the low quality queue uses up my delete votes now :(
 
In Regex, is there a way to say "two of this capture group, separated by this token"?
 
r'(hello):\1 will match 'hello:hello'
 
@corvid google 'regex backreference', the syntax varies slightly between implementations
 
What if it was something like 1-2/3-4x?
 
5:10 PM
I don't know, what if?
 
do you mean just two of the same pattern?
I don't think there's any shortcut, repeat the syntax
(\d-\d)/(\d-\d)x
 
This sounds a lot like your "match exactly 3 or exactly 6 of this pattern" question from the other day
 
I think this pattern matches it ^(\d[-]?\d)[\/]{1}(\d[-]?\d)[x]$
 
[-]? is equivalent to -?, [\/]{1} is equivalent to \/
 
True. And it doesn't work for a single number not separate by a hyphen, like 1/2-3x
 
5:18 PM
OK, your question appears to be totally different than what you opened with.
What do you actually want to match? Give examples of what should match.
 
What should pass: 1-2/2x, 1/2x, 1-2/3-4x, 1/2-3x.
What should fail: 1-/2x, 1/3, 1-2-3/20x
 
@davidism I don't think the forward slash even needs to be escaped
 
yeah, that too
\d(?:-\d)?/\d(?:-\d)?x
 
\d(-\d)?/\d(-\d)?x
right, was just fixing that
 
They seem to work for everything, excellent, thanks y'all
 
5:55 PM
rhubarb all!
 
rbrb!
 
cbg
Wow @JonCle good you here!
 
cbg
I am!? :p
 
6:10 PM
Wanted to ask you somethin since yesterday :P
If 3 answers have the same material and one of them (posted last) gets 6 times the upvotes than the rest, is it fishy?
 
@BhargavRao That depends. Are any of them fish?
 
Yeah. Smelt like one
 
@BhargavRao it's possible that a new answer got the question some more attention, and people just happened to come across, see a decent recent answer and decided to upvote it
 
That seems plausible. Sometimes these thoughts never strike in my brain :(
 
Heck, I've deleted enough posts that have been flagged as copying that have received more upvotes than the original answer (sometimes from 5 years ago) on the question, just because more users, question getting bumped and viewed etc...
 
6:19 PM
So mod life is quite interesting?
 
@BhargavRao "quite interesting" is one way to describe it :p
 
Thoughts about this? JS-based prototyping for Python? Well, the syntax is basically JS but....
http://tobyho.com/2009/05/23/prototype-inheritence-in/

Honestly, though, the best example they give is easily done via the method = unbound.__get__(self)
 
@JonClements Guess only Ninja's can handle it :D
 
And I would imagine it's a lot of work really. I've tried moderating large communities, but nothing the size of SO.
 
6:22 PM
@Kevin Readin your answer there. Probably needs a bit of explanation on reduce.
 
@AlexanderHuszagh It's liveable with :)
 
The two code blocks are essentially equivalent. reduce does what the first code is doing.
 
From when did achievements tab start showing current community stats? o_O
 
:D @JonClements, sounds like it's a keeper then. I've been amazed while moderating what people think is "permissible" behavior.
 
Another use this not that kind of answer
 
6:42 PM
@AlexanderHuszagh Well, the good thing is that SO has a community that has the tools and inclination to moderate itself :p
 
DSM
6:53 PM
Did they just change the SF exchange's little icon?
 
Don't think so. It's been a 120 degree rotationally symmetrical thingy for as long as I can recall
 
DSM
I agree it's been symmetrical but it doesn't look right to me for some reason. Possibly I'm in a dissociational fugue.
 
Maybe there's a gas leak.
Wayback machine from Jun 1 shows that the favicon is the same
 
7:14 PM
Corbyn 'Obsessed With Destroying The Moon', Warns MP
Finally, a politician with a platform I can get behind
 
I really wish there was a way to make in case insensitive. :/
 
x.lower() in y.lower(), but I imagine that's about 14 more characters than you'd like
Or possibly y is a list and it doesn't work at all
 
Yeah, I need to check each element of a list against each key of a dict.
 
DSM
 
I ended up with:
bulk_row = []
data = {k.lower():v for k, v in data.items()}
for field in map(str.lower, schema):
    if field in data:
        bulk_row.append(data[field])
But it just feels wrong.
 
DSM
7:19 PM
I think the difference I'm seeing has to do with the rendering of the grey bits between the red crescents.
Possibly something I did changed a default size of something.
 
That seems likely. I don't see those gray dots on my normal zoom level, but they appear when I ctrl+mousewheel
 
@MartijnPieters I'm out of flags, I wouldn't nag you directly if it weren't A) extreme and B) me out of flags stackoverflow.com/a/32404587/1768232
 
cabbage @durron597
 
@JonClements You too ^^^
 
That's a lot of flags
 
DSM
That doesn't need mod intervention, does it? Non-mods can vote to delete -3.
 
Guy is posting many portugese answers to one qeustion
 
user559633
@durron597 Why do you feel that's worth pinging people directly? That's just some stupid posts
 
ah, I see the full problem now, you just linked to the one post
 
DSM
Ahh. Looking at the sheer number of answers, I withdraw my objection.
 
7:26 PM
I wouldn't even come in here for this reason if I had any flags left, but I don't.
'twas the combination of the two
 
user559633
@durron597 Ah, I see the problem -- when I was looking, someone was already addressing the user's activity, so I couldn't see what you were seeing. My bad, apologies.
 
Thanks @JonClements
 
All the answers there were nasty
Mods could have another option Purge all answers :D
 
DSM
Hopefully that wouldn't be common enough for it to be useful.
 
alright, going back into my non-python life once again. take care room
@DSM agreed
 
7:29 PM
rbrb durr .... Left even as I type this
 
You snooze you lose ;)
 
Thanks to booze, I had to snooze.
 
@durron597 you must be around 100 flags, that's dedication to use them all up.
 
Given that durron is from SOCVR, he will be needing more than that.
 
@davidism he also maxes out his votes, close votes and delete votes, as well as all his reviews each day as well :(
 
7:31 PM
Impressive rates
 
@davidism Yeah, I'm capped on flags
Currently I'm getting about 99.5 helpful per day average
 
DSM
That's almost as many helpful votes as I have EVER.
 
@durron597 Howz the [source] going on?
 
@BhargavRao Last I checked we were at like 330 347
 
7:35 PM
[fdisk] has 29 from 2 days. All on hold
 
@DSM It's only been that high for last few days, I only have 1400 total helpful flags. Getting most of them from 10k tools, I didn't know how to do that last week
(p.s. I mostly left so quick because initial reaction of me coming into to ask for flags didn't meet with good response, I don't want to flood your room with off topic white hat nonsense)
 
Yeah, I did that from the 10k tools a couple times, but I just gave up and stuck to my after a while (online and offline).
 
DSM
My experiment with the various queues was pretty unsuccessful. Might as well stick to my niche.
 
Hey up all again
 
7:38 PM
Once I get to 20k. I'll get started with cleaning up the stuffs
 
Whiskey in space, followed by motion sickness in space.
 
August was a really good month for me. Marshal and Copy Editor badges, Java gold badge, 20k rep, #28 on month rank for rep gain.
I'll probably cool it now and actually, um, do my job.
 
Yeah, now that I've hit 20k I think I should get back to work during work hours. <_<
 
@davidism High five
 
user559633
@davidism Well done
 
7:43 PM
The problem is that I'm too entrenched in my habits now. I'll just have to resign myself to never getting any work done.
 
Not answering crappy gimme teh codez questions and duplicates is a relief, to be honest.
I'm glad it's over.
ironic the only way I was able to get my dupehammer was to answer duplicates.
 
Most of my points towards Python gold came from Flask questions. I don't venture to the general language tag often. But it was pretty satisfying just watching the new queue and hammering away.
 
@davidism that's weird if you're focusing on that you got gold in first; though, I have gold in but not even bronze in
 
user559633
Any feedback on why I'm eating downvotes on this question? stackoverflow.com/questions/32405417/…
 
Most of them are tagged python too, and the ones that weren't got edited. The other main source was sqlalchemy questions, same deal there.
 
7:50 PM
Why the downvotes comment Free flag :D
 
Looks like the OP is trying to do memoisation...
 
user559633
Is that a free flag? Because it looks like the asker doesn't know how to do object instantiation and that's what my answer provides
 
@tristan I have no idea what that question is asking, nor how the code you wrote is related
but I'm not voting at all right now, I only have a 5 point buffer :)
 
DSM
IIUC, the OP's code should work. "But once I set it for one object it is automatically set for the whole class." must not mean what I think it does.
 
Looks like the OP could even just do return getattr(self, 't', h) anyway
 
user559633
7:52 PM
I believe he wants to check hasattr to see if that object has 't'
 
@tristan But from where did you get the apple and worm example?
 
user559633
I just wrote it up quickly to show how instantiation and objects work based on that trainwreck of a question
 
@davidism oh - congrats on 20k :)
 
DSM
Oh, yeah! Pineapples for davidism.
 
Wow. That's great davidism. Can relax till 30k :)
 
user559633
7:54 PM
Forget it, it's too much of a friday to get downvotes trying to help a noob out. Back to just downvoting everything and slapping ice cream out of the hands of people
 
Bah. Where's Kevin's self answer :/
 
user559633
love that //
 
heading home, rhubarb all
 
rbrb davidism
 
7:59 PM
rbrb
 
DSM
Weekend rhubarb (which is too late because he's already left.)
 

« first day (1784 days earlier)      last day (3167 days later) »