« first day (1559 days earlier)      last day (3393 days later) » 

8:03 PM
150 PE tags gone in ~1 hour
 
user2555451
And only 190 to go. This is the final stretch!
 
0
A: Python: How to insert None into a list?

Antti HaapalaA not-so-serious attempt at winning the code golf at this task, without any extra imports. Works similarly on Python 2 and 3. L = [1,2,3,4,5,6] R = list(sum(zip(*[iter(L)]*2+[iter([].sort,0)]),())) print(R) Prints [1, 2, None, 3, 4, None, 5, 6, None] Q.E.D.

 
The first 90% takes 90% of your time. The last 10% also takes 90% of your time.
 
stackoverflow.com/q/5023849/2359271 reading comprehension, not programming
@AnttiHaapala 7 answers on that question, 4 from trusted users, and nobody bothered to take the tag out of the question title =/
 
I went through a phase where I removed "Python" from titles, but it's like trying to boil the ocean by screaming at it.
It doesn't help that half of those posts will refuse to be edited because removing "In Python" makes its title an exact dupe of an existing title
 
8:10 PM
@Kevin When I bark at it, the sea parts... try barking not screaming :)
 
How to insert elephant object into a Python container? —Le Petit Prince
 
Could it be considered bad design when doing a task which is very common is also very verbose?
 
It would be nice if we had a canonical target for "re.match only matches starting from the beginning of a string. Use search instead"
@corvid Yes.
 
I feel like I must be doing something wrong here then... making a json response should be super easy in any framework
 
Interesting post from the side bar: classic mac line endings are just \r. Maximum barf.
 
8:17 PM
stackoverflow.com/q/6245370/2359271 code dump, make it run faster
 
isn't the point of project euler to have to figure it out on your own? :\
 
@JonClements don't think that will work for me. My conversational Dog is quite rusty.
I can't get the back-of-the-throat sounds right, so "where is the bathroom?" comes out as "your mother smells of alley cats"
 
@iCodez < 100 ..
 
user2555451
We're almost to the last page (assuming you set 50 per page).
 
we are getting ugly there
 
@corvid They're fairly lenient on the matter. After logging in, their about page says:
> Making use of the internet to research a problem is to be encouraged as there could be hidden treasures of mathematics to be discovered beneath the surface of many of these problems. However, there is a fine line between researching ideas and using the answer you found on another website. If you photocopy a crossword solution then what have you achieved?
Although practically speaking this is more like "you can use prime sieves you found on Wikipedia" than "you can copy-paste a solution from SO"
 
@ZeroPiraeus Wasn't sure what reason applied there.
Also: It looks like you and I picked almost the same random "not starting at the top of the page so we don't run into iCodez" starting point >_>
 
@AirThomas Unclear.
 
@ZeroPiraeus I know, that's what I'm saying.
(The guy on first base!) ;)
 
What?
 
8:26 PM
Isn't that second?
 
Your reply of "unclear" could be interpreted as "this post should be voted as 'unclear'" or "it is unclear what this post should be voted as". The ambiguity here is humorous and similar to the popular Abbott & Costello "who's on first" skit.
Die, joke, die!
 
Ours is an evil starlord :(
 
@Kevin yeah that's what I mean, asking on SO seems like a last resort kind of thing
 
what does it require to delete own question?
 
Sometimes it's OK. like the "find the first collatz sequence whose length exceeds ten thousand" question very frequently causes problems for people because you'll overflow an ordinary 32 bit int before finding the answer. That's the kind of problem that's very hard to identify on your own.
... And debugging those kind of "gotcha"s isn't the point of the site, so it's fine to get a push in the right direction there.
 
(possibly already posted that ... hard to tell at this point since I don't have del votes)
 
what does "upvoted answer" mean, 0 or no + votes?
 
@AnttiHaapala context?
 
@AirThomas Sorry :-( I try to resist interfering with bits in progress, but my instinct to overexplain things is very powerful.
 
8:33 PM
I remember that problem, that was really weird, but my brother pointed that trick out
 
27
A: Does systematic self-deleting need to be prevented?

Jeff AtwoodThis already happens, though -- if a question has sufficient answers and/or votes, the question owner is prevented from deleting it. Originally based on http://blog.stackoverflow.com/2009/01/adventures-in-delclusionism/ Edit: I've tightened up the requirements here based on recent abuse by a sp...

 
@AnttiHaapala net score of a single answer of 0, is okay, but not > 1 answer, and not a single answer with a positive score
 
stackoverflow.com/q/3137178/2359271 (and needs many downvotes to get there)
 
0
Q: How to solve this Project Euler problem without summing all numbers?

MichaelCan one solve this problem without just summing all those numbers?

so downvote that answer and q, then the op which was online 2 hours ago can delete it :D
 
@AnttiHaapala also note that an OP can't "undelete" if the question was community deleted
and no-one except another mod can reverse a mod deletion
 
user2555451
8:35 PM
Heh. I got a comment asking why I'm resurfacing all these old euler questions.
 
yeah ofc
 
community can reverse a mod close, but not a delete
 
can get rid of that q faster if op deletes it after seeing downvotes :d
 
This one looks like it needs a rollback of answer-in-question, but not totally clear since "optimize this" is open-ended
 
8:39 PM
stackoverflow.com/q/2928603/2359271 question about the PE problem statement, not about programming
 
Interesting, a recent optimization means that normal dicts are now ordered in PyPy.
4
 
user2555451
Everybody please downvote the last two euler questions so we can delete them.
 
itshappening.gif
 
Downvoted. Anything else you need downvoting?
 
user2555451
8:45 PM
0
Q: Project Euler 79: what am I missing?

EvertI'm not interested in the answer, but I need to be pointed in the right direction Here's problem 79 I first try to analyze the file myself. I've noticed that the number 7 only ever appears as the first digit. This immediately implies that all the numbers containing 7 never overlaps with under ...

 
yesterday, by Kevin
In ten thousand years, it will just be the cockroaches and the Project Euler questions.
Those cockroaches are going to be lonely :-)
 
Technically we're only getting rid of the tag. Many, many PE questions remain.
 
user2555451
Questions about code related to PE are fine (assuming they are clear and answerable). We were killing the junk tag.
 
Look at that - lunch time already. Burnination is thirsty work. (rbrb)
 
8:49 PM
can you use ternaries in argument lists? Eg: do_the_thing(item if item is not None else other_item)
 
@corvid Yes
A if B else C is an ordinary expression, so you can put it virtually anywhere
 
after coding 3 weeks 24/7 in javascript, I can only praise python -- although I do recommend you guys to develop a bigger system in js, just to realise how well-designed python is.. viva la gvr!
btw cbg(all)
 
so can we burninate those 2 remaining project euler tags???
 
@PeterVaro same situation I am in right now. Node.js and Angular.js e'ry day
 
user2555451
8:52 PM
no, not until we get some more downvotes.
 
My first work project that wasn't legacy maintenance was 80% javascript. I learned that I really like having the ability to import.
 
@Kevin "ordinary" is the one after "quaternary", right?
 
user2555451
We're not ready yet!
 
@corvid I feel sorry for you.. :P
@Kevin import is actually not the worst part that is missing from JS
 
8:53 PM
@ZeroPiraeus It must be, since the language construct A if B else C has five sub-expressions and/or keywords, and five is one more than quatenary.
 
user2555451
We'll brag on Meta once those two are dead.
 
@PeterVaro I also really like having classes, but js has acceptable workarounds.
 
I think the terrible design is coming from undefined AND null and the others -- but MOSTLY from the "magic" of the this
 
@PeterVaro what kind of stuff have you been doing with javascript? Javascript is pretty good compared to some languages but seems to have a lot of oddities
 
8:54 PM
@iCodez You definitely deserve the honour of the edit :-)
 
@Kevin a closure in a method using both the inner this and the methods -- what is the nicest workaround?
that will only be a filthy, dirty hack
 
this occasionally bound to wacky things, like the window object instead of the current object instance, but that only accounted for a small percentage of my debugging time.
You only have to get bitten by that four or five times before you start to look out for it
 
actually I don't do this related mistakes => I just hate the act that my code is clunky
 
@PeterVaro I'm pretty sure I did var self = this or vice versa more times than I would like to admit
 
@corvid a form-generator and builder application
@Kevin that is one of the workarounds -- and actually the only one I know for the problem I talked a few lines earlier
otherwise I use .bind() when one kind of this is needed
 
user559633
8:57 PM
@PeterVaro do you do freelance graphic art for hire?
 
@tristan not these days => I barely have time beside work => that's why I'm less often here
:(
 
DSM
Finding out you're about to run out of diskspace on a box with running simulations is frustrating. #thursdays
 
user559633
:( alright, i'll come back when i have a lot of money to bribe you with
 
I think my greatest wish was for forEach to work on all array-like objects. Oops, it doesn't work on the object returned by document.getElementsByTagName, hope you don't need to iterate over those a whole lot! (I did)
 
user2555451
8:58 PM
@ZeroPiraeus Alright. When those two die, I'll write up a Meta answer and say was killed courtesy of sopython. :)
 
@Kevin I wish arguments was an Object instead of an Array, or at least a proper Array..
how wonderful are the nice *args and **kwargs in python?
and the unpacking?
 
Very nice.
 
and the explicit self as first argument?
 
the problem with javascript is the -"ava"
 
ahh.. I love python.. I love it so, so much.
 
8:59 PM
I have mixed feelings about explicit self.
 
@Kevin why?
 
I am very lazy and don't like typing self.
... That's pretty much it, really.
 
:D:D:D:D:D
use a proper text-editor which will autocomplete for you :)
 
James Powell aka dutc showed a cpython hack which made implicit self
 
why do we ever want that?
 
9:02 PM
it was a hack :D
 
this strict explicit self makes python OO so transparent
 
bbiab
 
You'll save four seconds per class declaration!!!
 
heya @JonClements and also byebye :)
 
user559633
how selfless of him
 
9:02 PM
Incredible.
 
@Kevin I read that as "four seconds per method declaration" :D
 
@Kevin ahh one more thing that is bugging me a lot in js => a real string formatting with interpolation
not with concatanation
 
@AnttiHaapala That's true as long as you type exactly 6/4ths of a character per second.
 
@PeterVaro easy
 
"self" plus comma plus space is a lot of work ;-)
 
9:05 PM
@AnttiHaapala sure, with sprintf for js
 
DSM
My view on "self" is simply that it's hard for me to get worked up about it much.
 
but that's also based on concat
 
@DSM True. Let's argue about the Global Interpreter Lock instead.
 
user559633
yes, let's argue about the GIL
 
    function format(string, dictionary) {
        var args = arguments;
        if (typeof(args[1]) === 'object') {
            args = args[1];
        }
        return string.replace(/\{([a-zA-Z0-9_\-]+)\}/g, function (whole, parm) {
            if (parm === 0 || args[parm] === undefined) {
                console.log(whole);
                alert("invalid argument designation " + parm);
                return "[[invalid]]";
            }
            return args[parm];
        });
    }
 
user559633
9:06 PM
My official stance: I like it.
 
user559633
I think it's convenient and it's saved my butt more than it's annoyed me.
 
My second through eighth cores are becoming listless because Python never uses them :-(
 
@Kevin that's the only thing that has to be improved
 
Idle CPU cycles are the devil's plaything.
 
user559633
9:07 PM
celery workers are waiting to do generic tasks on half my CPUs :)
 
there are 2 things that are wrong with python: GIL and stack.
 
@AnttiHaapala hmm-hmm
 
user559633
what's wrong with the stack?
 
DSM
@Kevin: just be patient and mutter "STM" to yourself.
 
celery workers in your area are waiting to do your generic tasks! Click here now
4
 
9:07 PM
@tristan do not use C stack for python stack (ala stackless)
 
user559633
@Kevin aww, now i'm depressed
 
user559633
why not?
 
I don't know what celery workers are, so I hope that joke makes sense.
 
user559633
async task queue
 
Or at least, is incomprehensible in the manner my posts usually are.
 
9:08 PM
@PeterVaro basically you never need % formatting in javascript :D
 
@AnttiHaapala actually GIL and stacks are not closely part of the language, they are implementation details AFAIK
 
DSM
The joke worked either way, so I think you come out ahead.
 
@PeterVaro ever printed hex
 
It's gotta have the right "flavor" of confusingness if I want to maintain my brand.
 
user559633
it got a star, so ostensibly someone thought it was sufficiently frisky
 
9:09 PM
@PeterVaro true
 
DSM
mutter Kevin gets stars for celery but nobody likes "Llanfair" mutter
 
user559633
Llanfair?
 
It was a pun he made earlier this week :-)
 
user559633
I assume maybe there's something called a "lan fair?" and llan is something nonsense northern england-sounding
 
@iCodez: wow, is... gone!
 
9:10 PM
@MartijnPieters pls downvote the remaining...
 
user2555451
Yup! We just need to kill those last two.
 
is it bad practice to redirect from the front end rather than from a response?
 
I may have starred it after I came back from being afk, but I saw that he followed up with "come on, you know that's funny" and that phrase triggers a Manchurian Candidate style reaction within me where I can show no appreciation for the target thing.
 
user559633
I honestly do not understand the "llanfair" joke
 
DSM
This is why I've started writing Julia.
 
user559633
9:12 PM
@corvid what do you mean? javascript redirecting the browser because it feels like it?
 
basically like this:
archive.controller("edit", ["$scope", "$location", "Article",
  function($scope, $location, Article) {
    $scope.article = new Article();
    $scope.submit = function() {
      $scope.article.$save(function(success) {
        $location.path("/archive/" + success._id);
      }, function(fail) {
        // don't redirect, but handle the error
      })
    }
  }
])
 
user559633
ugh that formatting what did i ever do to you
 
My only objection to redirecting on the client side is that the client can read the script and manually navigate to the "success" page. That might be a security problem, depending on what you're trying to do.
 
user559633
@corvid the only downside is what kevin said or if you aren't then again validating on the backend
 
Ex. if(password_matches){redirect_to("example.com/admin_panel");} is trivially worked around
 
9:17 PM
basically the possibility is that it will violate some constraint of the database, for example, not having a unique title. But if that's on the callback of save, won't it inherently not work if they try to go there? It has to save first
 
user559633
yeah^^. i put it in the same ballpark as doing address validation on the frontend to speed up user feedback, but then validating again on the backend
 
@iCodez downvoted, what do we have to get them to to delete them?
 
user2555451
The first one is already being deleted. The other needs to go to -3 I think (otherwise, we'll have to wait).
 
@davidism -3
 
9:28 PM
And then there was one ...
 
here are more than 7 ppl, who didnt downvote? :D
 
0
A: Burninate Project Euler

Martijn PietersAfter some Python chat room denizens got itchy about programming contest meta tags, we went ahead and started cleaning. The project-euler tag was a natural progression once we started. Now properly burninated are: programming-competitions, ai-challenge, acm-icpc, codechef, codeforces, facebook-...

 
user2555451
@MartijnPieters - That's great! Note that Zero and me also killed and .
 
@iCodez 16 tags, I'll add
 
@AnttiHaapala can't until it is downvoted.
 
well -1 :D
 
user2555451
@MartijnPieters Also, the tag we still have to kill is with no "s" on the end.
 
Question is now downvoted.
and delvoted.
 
What we really need is the Dark Cannon, which will take all the Dark Council accounts and coordinate down/close/delete votes automatically. As long as well all trust each other... <_<
 
So after two upvotes and two downvotes, Bhargav Rao tried to salvage their bad JSON-decoding answer. Not sure what the point is in keeping that post..
 
lol
 
downvoted that awfulness :P
stackoverflow.com/questions/6234917 @ZeroPiraeus pls dv :D
 
@AnttiHaapala Way ahead of you mateyskip :-)
 
9:50 PM
then just need 1...
@iCodez ^
 
user2555451
Do you want that deleted or downvoted?
 
delete voted :P
there is no content :P
 
user2555451
Oh. Well I already did that.
 
ah :D
shit zero just has 10.4k :D
 
@AnttiHaapala Feel free to help rectify that situation ;-)
 
9:53 PM
haha :D
I remembered you had something like 40k :D
 
@AnttiHaapala Hahaha not while I keep fatfingering bounties I don't ...
0
A: How can I get 2.x-like sorting behaviour in Python 3.x?

Fred SNot running Python 3 here, but maybe something like this would work. Test to see if doing a "less than" compare on "value" creates an exception and then do "something" to handle that case, like convert it to a string. Of course you'd still need more special handling if there are other types in ...

 
-4
Q: Python : One else for multiple if

DamgotI created some functions which return 1 if all went well and 0 if there was an error. Now, I need to execute all this functions in a defined order and verify all functions. If one of them return 0, I need to reboot. I intend to use multiple if but with one else : if function_1() : if functi...

something to do with this :D this is so exceedingly bad q, the question asks something like how can I do short-circuiting and... (Except that 4/5 of the answers thought that it needs non-shortcircuiting one)
 
user559633
10:51 PM
wow such removed very change mind
 

« first day (1559 days earlier)      last day (3393 days later) »