« first day (2357 days earlier)      last day (2590 days later) » 

8:06 PM
Guess who's back
 
*sigh*
that's gonna be one long suspension
 
That indentation. ;_;
 
wait, it's probably too late for Bhargav
consider leaving a custom mod flag linking to the suspended user and the original post, @Ilja
mentioning that he's already had two sock accounts nuked today
 
Where's the first dupe?
 
8:14 PM
No, I mean the comment on Ilja's says it's the third, and links to that one, so where's the first?
 
the second sock account came when the original user had been suspended already for 3 days
ah, that got nuked I think
@davidism second post
 
been on an ongoing PR for literally three days, keeps asking for changes and then asking to revert changes :|
 
well make up your mind :P
oh, "keeps", I read that as "keep"
I love this guy
@AndrasDeak It is very important for me to get an answer to this question. When I get the right answer I will delete the copy and the original question will remain with the answer — user7792137 55 secs ago
 
wim
feature request: cash bounties
 
8:30 PM
what do you mean?
 
wim
When it's very important to get an answer to the question
 
To whom it may concern: I've flagged the new sprout
 
wim
cash bounty or gtfo
 
fortunately that would never fly
imagine the rep whores when it isn't just about rep
 
just curious why was his first account suspended? was it because he made a sock puppet account to ask a closed question or something?
 
wim
8:33 PM
@BhargavRao u here?
 
@MooingRawr that, and having all 60 rep from upvotes on their own question
@wim he's already been pinged by Ilja if that's what you want
(he's not)
that was the sock getting nuked
and if I remember correctly, one user was 4 months old, the other 6
so it's been going on for a while
just reposting under another account might be an honest mistake (...) but this is blatant abuse
 
oh I see he messed up :D
sometimes i feel bad for OP like him :\
not the suspend part, but the not understanding something part
on another note, I picked up playerunknown battleground if anyone wanna play :D
 
wim
8:49 PM
collections.ChainMap is great
this simple little thing is so useful for config management
 
9:02 PM
@wim is it even more useful than itertools?
rhubarb
 
10:01 PM
Hmm python could really use a .? and ?? operator..
Those are actually things that I miss in python after using C# a bit
edit: ?. operator XD
 
10:27 PM
cbg
 
wim
what would the .? and the ?. operators do ?
 
I'm pretty sure it's the or from this or that but I forget for sure
106
A: What does question mark and dot operator ?. mean in C# 6.0?

Jon SkeetIt's the null conditional operator. It basically means: "Evaluate the first operand; if that's null, stop, with a result of null. Otherwise, evaluate the second operand (as a member access of the first operand)." In your example, the point is that if a is null, then a?.PropertyOfA will evaluate...

Okay, so not quite
?? is, though
To save people looking up what the ?? is.. It is the null-coalescing operator and will return Name if it is not null, otherwise it will return "N/A". — Steve Mar 5 at 1:09
so ?. would be None if thing is None else thing.whatever
 
anyone watching the spacex feed?
 
10:50 PM
@WayneWerner ?. "stops executing once it sees a None value" - so A?.B?.DoSomething() will first check for A to be not None, then B to not None and then do something. - If one of the variables are None it returns None
A ?? B "returns A if is not None, else B"
 
11:09 PM
How would I write this: "{{0}}".format(S) - where I want a result like {hello world} if S = hello world
 
"{{{0}}}".format(S)
 
11:27 PM
I'd rather use '{%s}' % S in such a case. much more readable IMO
 
@paul23 Ugly as sin, but you could do print(None if x is None else y.fnord if y is not None else z.fnord if z is not None else None)
 
As I said: I miss it from c# :P
Though pythons way is obviously to just do it and catch the exception.
 
or even '{'+str(S)+'}'
Though I think I'd probably just go for the '{{{}}}'.format(S) option
@paul23 yeah, you'd probably see something like the following
for thing in [x, y, z]:
    try:
        thing.do_something()
    except AttributeError:
        pass
    else:
        break
I suppose that'd be the explicit case
because you could do something like that in C# too
which is also why Python's ternary looks like thing if <statement> else other_thing rather than foo ? bar : bang
because what does ? : even mean?
 
% formatting rules. I haven't seen the advantage of .format.
 
DSM
Oh, hey, Brandin. Do you still have the C++ code showing the difference from Python from the other day?
 
11:48 PM
Yes, the savage benchmark. I happened to see it in Petzold's book (Programming Windows) and wanted to try it. I don't think the purpose was for it to give a specific answer, though. I just thought it was weird that I would get a different result in Python.
#include <cstdio>
#include <cmath>

using namespace std;

void do_savage(int n)
{
    double a=1.0;
    for (int i=0; i<n; i++)
        a = tan(atan(exp(log(sqrt(a*a)))))+1.0;
    printf("%.10f\n", a);
}

int main()
{
    do_savage(10000000);
}
 
DSM
See, I get 9999817.5159477126 from that, not the 9999818.4485011194 you report. So I'm not sure that Python is involved in any way except coincidentally.
 
Yes, in Python I get about 9999817.5. So it is consistent except for GCC? Strange. Maybe a difference in how GCC implemented some math functions.
I think Python is using the Microsoft library for those.
 
DSM
So as near as I can tell, the only thing which is different is that on your machine you get a different result from your C++ code than it seems to me you should for this collection of operations. It's not Python losing precision for some reason.
 

« first day (2357 days earlier)      last day (2590 days later) »