« first day (1840 days earlier)      last day (3091 days later) » 

12:00 AM
so pending becomes the a b c d in Aa + Bb + Cc + Dd = n
and qty is the A B C D
though we can discard the actual amount
bleh I missed a level of nesting in there haha
I might make an SO question later
idk
I'm feeling dumb
and mostly distracted with work and family stuff
so it might just come to me at 2 in the morning :P
 
 
1 hour later…
1:16 AM
One day I will understand why duplicate answer X gets 100+ rep, but duplicate answer (or even original answer) Y gets 0 rep.
But not today.
It would be kind of nice if questions were unanswerable for 10 minutes to give us time to find a dupe.
 
I think it has something to do with alignment of certain stars.
 
@TigerhawkT3 or today
and FUBU
 
FUBU?
 
1
Q: Why does python 'in' operator behaves differently according to tuple/list size?

KarataIn python2: >>> 'a' in ('ab') True >>> 'a' in ('ab', 'c') False If I just want to test whether certain string exists in given tuple, looks like I cannot use 'in' operator when the tuple size is 1? Is there a consistent way to do this?

this one I take it?
 
There's that one, yes.
But generally, I have a lot of answers that I thought were really good with 0 rep, and a few that I'm kind of embarrassed about with a lot of rep.
I have 18 points in the Haskell tag for list(enumerate(s)).
Ready for some lols? I added my username to the Google search for a dup just now, and apparently I've gotten 75 rep for pretty much the same answer.
 
1:21 AM
hahahaha
 
well next time you know which one to mark as dupe
 
wow that's hilarious
 
E.g., I thought this recent answer was pretty good - kind of non-obvious, took 10-15 minutes of testing, etc., but no feedback of any kind.
 
probably because there are 20 other questions that pushed the question you answered off the top, has happened to me also
 
1:25 AM
Yep.
Someone should make an alt account that does nothing but answer the same duplicate question.
Some kind of reasonably-obscure gotcha question.
 
For me the most recent one is this: stackoverflow.com/questions/32899275/…
 
Like the floating-point question, for example.
 
Haha, yeah.
If only we can have some kind of bot to figure out those dupes and automagically answer...
 
We were actually working on a bot to identify dupes, but @Ffisegydd got a "job".
 
Can you imagine if, ten years from now, someone gets full mod powers just by saying "0.1 + 0.2 is not equal to 0.3" 500 times?
 
1:29 AM
Is community bot an on-going project?
I had community bot dupe hammer something I flagged today
 
I think that's when the OP agrees and accepts the dupe.
 
yeah, that
 
oooh
 
nice.
but yeah, answers that actually took me actual work in figuring out usually get me +1 and accepted if lucky, but answers that took me next to zero effort (like this one from today) gets like +3 in like 5 minutes.
 
same thing for me
 
1:33 AM
don't think this can actually be fixed, especially when people can game this
 
The problem is that new programmers aren't interested in the multithreading/Cython/metaclass/etc. stuff because they know they don't need or understand it.
 
I wrote up this really long post on mocks the other day and got 2 and an accept (which is still fine :))....but the simple one liners I sometimes put can get me like 5-6
 
So instead there's lots of visibility and votes on things like "how do I split a string on whitespace?".
 
yeah because everyone jumps on it to answer
 
yeah, however if a question actually took thought I usually had fun doing that, otherwise I don't even bother. Speaking of that, the whole interactive app with background stuff is something I wanted to do and figure out, and I may have a new thing that can make use of it
 
1:34 AM
Which seems like a new and interesting problem to everyone who's never done it before.
 
if you happen to be that one person who answers it by the time they get there...you get the upvotes
 
especially when people are looking
 
I'm probably part of the problem... I don't vote often enough, and it's usually to DV a poorly-researched question or incorrect answer. :(
 
comprehensive answers usually get votes eventually
 
hahaha me too. DVs out number UVs for me.
2
Q: Freeze stdin when in the background, unfreeze it when in the foreground

jeckyll2hideI am trying to run a sript in the background: nohup script.py > out 2> err < /dev/null & The script (Python 3.4) does at some point: answer = input('? ') (it has a menu running in one of the threads) And the nohup call is crashing with: EOFError: EOF when reading a line Because of the /...

that one is the worst, because the questioner didn't really understand what I was talking about.
and to be fair, at the time I didn't quite get what he was asking due to how it was asked
and I agree, comprehensive answers eventually get indexed by google and that got me votes over time.
 
1:38 AM
Whenever I get a vote on something I posted more than a few weeks ago, I am stunned.
 
also citing sources is a good way to write
 
cool. I have a few that I put some time in to that I liked....would be a pleasant surprise if in a few months I see some +10s come my way :)
 
yep, generally I cite documentation whenever possible because [citations needed]
 
when I write a lengthy answer I tend to put a lot of examples
 
I really enjoyed writing this one and hope to find an efficient way to use it in py
 
1:42 AM
Nice answer.
 
and this... article took a forever week to write and revise and i kinda consider it unfinished, would've like to 'fill up' on the html some more
thnx
 
I'm very new to contributing, so I don't have much of a selection...but this is the one that I have put the most work in to so far. I still want to work on it actually. Put more context around what each test method is doing.
 
@idjaw btw, application example in python?
 
nice, teaching people how to build tests.
while I tend to avoid full-on mocks, sometimes it is just not possible with certain kind of frameworks
 
@CSᵠ don't understand your question, sorry?
 
1:48 AM
oh man, that bitwise trick on char is so obvious if one had to think about it, but in fact it can be obscure.
 
@idjaw I have a feeling bitwise on strings in python is cumbersome, you have any idea how to?
@metatoaster it's like... they designed the ascii table that way...
 
haha, as I said it's obvious if someone thought about it
so glad ebcdic mostly died in a flaming death
 
@metatoaster you can't be that old
 
more that I am young enough to never had to ever deal with that
 
@CSᵠ Unfortunately, I am not the best person to tackle bitwise on strings.
 
1:56 AM
>>> ('a' & ' ')
TypeError: unsupported operand type(s) for &: 'str' and 'str'
>>> chr(ord('A') | ord(' '))
'a'
yeah no
 
eh, maybe someone is, I'll get to that eventually
 
anyone else having difficulties accessing SO right now?
 
same as JS
 
yeah, SO is flaky atm
 
ohh, good, it's not only me
same as JS
 
1:57 AM
then again, in python, of course someone can probably subclass the str type and define __and__ and __or__
 
Probably Cogent acting up again.
 
total butchery of something, whatever that is
well, even sending messages here occasionally pop up a retry/cancel thing.
 
yep same
 
python question,what is the go to framework or tech to build slick UI aside from possibly bootstrap?
Specifically for python based apps
 
but isn't bootstrap css+js?
 
2:00 AM
I don't know about anything that cares about Python
Foundation by ZURB is used a lot
 
yes
 
> Oops! Something Bad Happened!
We apologize for any inconvenience, but an unexpected error occurred while you were browsing our site.

It’s not you, it’s us. This is our fault.
 
We are currently mitigating an attack. Standby for updates.
 
whoever is attacking SO is silly....how will those attackers get their answers when their scripts stop working and they need help troubleshooting? pfffft...
 
who can be that dumb to attack SE?
 
2:03 AM
north korea
j/k
 
might be some script kiddie who got told off or something idk
 
@StackStatus I'm coding at the moment, and just like every programmer in the world, I'm stuck til you're up again haha
 
Site seemed slow.
 
2:22 AM
>>> ''.join(map(chr, [32 ^ ord(x) for x in "Hi There World!"]))
'hI\x00tHERE\x00wORLD\x01'
meh, but a start //cc @idjaw
 
groooossss
 
utter vomit
 
We are back online and monitoring all systems.
woosh...@CSᵠ that is some kind of something.....
 
Everything is beautiful in its own way.
 
Keywords can't bring us down.
 
2:32 AM
huh?
 
He confused Ray Stevens with Christina Aguilera.
 
Not "confused" so much as "never heard of Ray Stevens."
So yes, I never heard of Ray Stevens Ray Stevens with Christina Aguilera.
 
Don't worry, I had already Googled it and watch a few seconds of the video. His tie was very 1970.
 
2:48 AM
There just has to be some Python library where you can do import simplenetworks as sn; sn.connect(other_comp_ip) on one machine and import simplenetworks as sn; sn.connect(first_comp_ip) on the other, instead of all this socket and port and listening stuff.
 
If you were going to interview a django developer for his Python skills for a non-django job that would be more focused on research and data-munging, what would you ask them?
 
I'd start with some questions on lists (focused on when to use list slice and when to use map) then move to stuff specific to the job (numpy, building decision trees, association, classification, clustering)
 
map - good idea...
explain decorators ?
explain descriptors?
explain context managers?
 
3:42 AM
also if it is heavy data - some questions about data preparation
 
data preparation... like what? defining schemas?
I want to pull up the django repo and ask for a guided tour
 
like pre-processing; what is scaling vs. whitening, scaling of target variables in regression, umm....how to handle normalization - stuff like that
defining schemas could fit in that as well
I like the decorators question as that would also help see if they follow current syntax from PEP or use one of the alternate forms (and if they can justify why)
 
PEP syntax? what do you mean by that?
 
I am guessing PEP8
I would also throw in unit testing into that mix
 
I mean decorators aren't really mentioned in PEP8 but there is an interesting PEP 0318 and it would be interesting to see how they justify why they write decorators the way they do
I bet at least one will point to the 1609 rep post here
 
3:59 AM
To me there's not really any question about it, one should use the @ syntax, but maybe I should ask if they have any programming habits that go against the Python grain.
 
@AaronHall You can be a fairly decent Python programmer who doesn't often use decorators, doesn't often create context managers, and doesn't even know that the descriptor protocol is what underlies your use of property.
 
Yes, I think descriptors are going too far, potentially, but if they're a real wizard, why not have a stretch goal? :)
 
to a programmer who is used to functional languages, decorators are just a neat but stupid looking toy :p
but that isn't me, I am just a humble programmer who happens to use python most
 
I would think decorators would be embraced by functional programming.
 
the one I talked to think the python specific syntax obscures what they really are
 
4:03 AM
well he's entitled to be wrong, I suppose. :)
 
after seeing some questions related to that I am more inclined to agree with them
 
@AaronHall I don't always use decorator syntax, but I spent a long time maintaining codebases pre-decorator...
 
3
Q: How to apply class decorator at base of all decorators on methods

John KaffI am using this way of decorating all methods import inspect def decallmethods(decorator, prefix='test_'): def dectheclass(cls): for name, m in inspect.getmembers(cls, inspect.ismethod): if name.startswith(prefix): setattr(cls, name, decorator(m)) return cls return dec...

 
ok, gotta get up early, but Patrick's leaving me hanging...
 
oh welp, was going to have you look at that
assuming you haven't done so the first time I posted that here
 
4:04 AM
Hanging about what???
 
but still, I have a feeling I did something terrible in the answer I gave
 
@PatrickMaupin I was hoping you'd have a killer point
 
@AaronHall Ah. Sorry. Codeine still in effect. If there is a point, I'd certainly ask about descriptors, and if they know, that's awesome. If they don't know, discuss them and look for excitement/lightbulbs/whatever.
 
my decorator reordering code actually has a function that behaves like a decorator that takes in two callable arguments.
 
@metatoaster read it, not sure what the criticism is, just because newbies' intent is ill-advised doesn't make decorators a bad idea.
 
4:09 AM
I am not saying it's a bad idea
I am agreeing with how the syntax can mask their true nature
 
I have code that can read a textual representation of a register set and dynamically create a matching class hierarchy that lets you read/write registers on hardware. There's some pretty low-level stuff there, but honestly, I didn't need to know about the descriptor protocol to create it.
 
Honestly, I think without the @ syntax minimizes them such that they could be easily missed.
 
@AaronHall Don't disagree. But when the "@" syntax first appeared, it was... jarring.
OMG! My favorite language is turing into Perl! jarring.
 
ok, for real, bedtime, thanks for the discussion folks!!!
 
but yeah, the difference between someone with a deep academic background vs. someone who just wants to get something to work in a way that is slightly more intuitive
 
4:11 AM
g'night.
 
lol good night.
 
you guys are awesome!
 
night Aaron
I still like Perl
 
well, expressiveness in a way that a newbie can grasp. With the way programming/CS is taught these days not everyone can actually grasp what pure functions even mean
 
4:13 AM
@JGreenwell Doesn't make you a bad person. Just misguided. :-)
 
granted I haven't really used it in .... wow, ten years apparently
it means sin(x) :P ;)
 
Perl is really good for some things. TCL is really good for some things. sed is really good for some things. bash is really good for some things. Python is at least OK for a lot more things than any of those. I choose to do most of my work with the general purpose language that handles most of my tasks in an at-least OK fashion...
 
I like Python because you can write pseudocode and then run it through the interpreter.
 
haha. as they say, perfect is the enemy of good
 
I use...what they pay me to use (mostly C#/PowerShell atm) and python always due to its general purpose nature making it more likely to be useful at every job
 
4:18 AM
Python is basically good enough (TM) for me.
 
@TigerhawkT3 True dat. In previous jobs, I used to write Python code and testcases and then slowly refine the code until it was translatable line-for-line into assembler. You can't even do that in C due to the lack of multiple return.
 
plus Python is fun; never discount the power of fun
 
The only thing I miss from other languages is the ability to shoehorn assignment statements wherever you want, like x = 0; while x<10: print(x++).
 
except you get fun like this :)
 
@JGreenwell Yeah, I think the popularity of Perl and TCL and Python is partly due to the fun dyamic (or no in some cases) typing, and the automagic memory management. But Perl and TCL become less fun as the programs get bigger.
 
4:21 AM
if ((options == (__WCLONE|__WALL)) && (current->uid = 0))
        retval = -EINVAL;
beautiful.
also damn this backdoor attempt was 12 years ago.
 
Yeah. I remember that at the time.
 
and that was why bitkeeper was kept around for yet longer
 
C compilers can easily be set to warn you about that stuff. But if too much of your codebase does it, the warnings become meaningless noise.
Most lint messages in the wild are meaningless noise -- for any language.
 
yeah, and the rest of the world pays for it, unfortunately.
 
yeah, I think Python overtook Perl (at least for me) as "Yet another way..." went from fun to hair pulling and I needed the "one canonical way" to keep my debugging and testing sane
 
4:31 AM
hahahaha tell me about it.
it's more fun if you throw zope/plone into the mix
by fun I mean fun enjoy going bald
 
5:16 AM
ASK dupehammered something... 0_0
 
5:28 AM
Morning CBG all
 
Cbg.
 
I have a small doubt about set implementation
    a=set([1,2,3])
    print a
    {1, 2, 3}
    a.add(4) # It returns None here if it returns True it would be helpfull
    print a
    {1, 2, 3, 4}
    a.add(4) # Again here it returns None it it returened Flase it would be helpfull
    print a
    {1, 2, 3, 4}
I feel the return type when adding to set can be Boolean stating whether it has been inserted or not
We can write a wrapper function to do that but I felt it would be efficient if they did it inbuilt in python
Is there any reason why they did not do it ?
 
The standard behavior is for methods that mutate an object like that (add(), append(), etc.) to return None.
 
So "explicit is better than implicit" is the reason why they use None as the return type
 
5:42 AM
with regards to the possible outcome, but do read further down, the later arguments are more convincing.
and a return value of None is the default return value for all functions, so there is nothing magic about that.
 
Actually I did search about set before asking in this SO question stackoverflow.com/questions/4221968/…
 
> If a method mutates and object, it does not return a value. That's the rule.
not sure if that's actually correct, but sure.
@VigneshKalai I would suggest you read the entire thread if you really want to dig deep into this, but this might take a while. Even Guido contributed so that might count for something.
> Also, since some people do want mutating methods to return a copy of the collection (i.e. s.add(1).add(2).add(3)), those folks will find your suggestion to be counter-intuitive.
 
OK then that does makes sense. So if they actually changed the return type of set.add() it would conflict with other methods return type like list.insert() etc.. so it cause a confusion
 
I think this one basically nailed it - if it returns nothing there's nothing to disambiguate.
but yeah, when dealing with fundamental language decisions searching the language specific mailing list might yield better answers than SO
 
@metatoaster Yes it did :-) thanks for the last link it makes sense now :)
 
5:50 AM
still neat, never thought about it myself but now I know!
 
 
1 hour later…
Was on phone so couldn't tidy up
You're a good egg. A good egg that should go to sleep.
 
8:13 AM
Cbg :)
 
8:44 AM
cbg
 
cabbage
 
Well - my connection seems a bit more reliable today... gave up yesterday afternoon and read a book instead
 
 
3 hours later…
11:25 AM
Good morning all, I want to hang, but I can't, gotta get ready for a big day at work...
 
Anything particularly exciting?
 
11:48 AM
CBG all
 
cbg
 
cbg
 
You look gorgeous today @TigerhawkT3
 
You like the new avatar? :P
 
@VigneshKalai I think you need to clean your binoculars
 
11:49 AM
Hey...
 
Yeah I think it is pretty expressive stating you are happy with your python hammer
 
If I had a hammer, I would ring out dupes... and I do, so I do. A lot.
 
I should say you are doing a good job at hammering :)
 
12:06 PM
cabbage
 
cabbage all
 
cbg
 
@jonrsharpe if you look at this answer does it appear as censored?
 
@JonClements yep, "This answer was marked as spam or offensive and is therefore not shown - you can see the revision history for details."
 
ahhh
 
12:08 PM
Does your mod X-ray vision prevent you from seeing those notices?
 
@JonClements - it should (2 spam flags marked as helpful). Though employees and moderators never see the censorship notice. — Oded ♦ 2 mins ago
no wonder I've been getting confused :(
 
Unhammered
But maybe it's now opinion-based - is there an existing enums-vs-module-level-constants?
 
(or maybe one with a SimpleNamespace?)
 
Hey @VigneshKalai: I was reading the Chat transcript a little while ago & noticed you talking about how it would be nice if set.add had a boolean return to indicate if the added element was already present in the set. I understand why set.add doesn't do that, but I agree it'd be nice if there were an additional method that provided that functionality. Of course, it's easy enough to create your own function that does it, but that's not as efficient as a built-in method would be.
FWIW, here's a one-liner:
def set_add(s, x):
    return False if x in s else s.add(x) or True

s = set([5])
a = (3, 1, 4, 1, 5, 9)
print [set_add(s, x) for x in a], s
output
[True, True, True, False, False, True] set([1, 3, 4, 5, 9])
 
12:16 PM
@PM2Ring or return x in s or not s.add(x)
 
@jonrsharpe was just going to say that dammit!
 
@JonClements as long as a Jon says it, we're fine
 
I concur :)
 
@jonrsharpe Fair enough, although mine returns True if x is added, rather than True if x is already in the set.
 
Why not just check x in s before adding it? Seems cleaner than your function (which I think is not readable at all).
 
12:21 PM
@ThiefMaster you're alive!? :p
 
@PM2Ring ah, good point
 
@ThiefMaster That's what I'd normally do - I was just responding to Vignesh's wish for such a function. As for readability, I guess you're not very happy with s.add(x) or True, and I don't blame you. :)
 
friday cbg :)
 
@PM2Ring I just felt that our implementation would be slower then python inbuilt implementation but that is a new way of doing things :-)
 
Actually, that always returns True, since `not None` is True. However,
`return x in s or s.add(x) is not None`
is just as ugly as my suggestion. :)
 
12:29 PM
I may be wrong there
 
@VigneshKalai Yes, it would be slower, and if my function has to add the element it ends up doing two set accesses: one to see if the element's already present and one to actually add the element, whereas a builtin could do it all with one set access, at C speed.
 
Since we are dealing with sets your normal method itself would be fast :-)
 
"At C speed" == "at the speed of light"?
 
Yes, set access is pretty fast, unless you're unlucky enough to get lots of hash collisions.
@TigerhawkT3 Only when implemented on an optical processor. :)
 
But it says "C" right on the tin.
 
12:37 PM
Lightspeed is small "c", not big "C", which in this case is a reference to the programing language in which standard Python (aka CPython) is implemented. But you knew that. :)
 
@PM 2Ring, destroyer of lame physics jokes.
 
Cbg
This post stackoverflow.com/a/33436255/4099593 was spam before they edited
Damn, will my flag be rejected?
:'(
 
What's with you and flag mate :)
 
Lol, the first answer was "test test test" some 10 times
 
@BhargavRao That's unusual. How bad was the spam content? Maybe they didn't intend to post spam...
 
12:51 PM
@Pm had a lot of test in it :D
 
A few mins earlier I misflagged a NAA as offensive :D It was declined obviously..
 
That's not spam, that's just someone figuring out how answer posting works. :) Be very wary of posting spam flags - that's a rather serious offence, and actual spamming is punished with the severity it deserves.
 
Next time I gotta be damn careful
 
@BhargavRao Sorry :(
 
12:56 PM
Hehe @JonCle it was my mistake.
Traveling and flagging ;)
 
haha... )
 
But can't mods sew the grace period edits @Jon?
 
I have a doubt I created an exe and passed it on they said they were not able to run it their environment since it was redhat linux I just wanted to know if I cx_freeze in ubuntu will that run on redhat
 
@BhargavRao nope
 
Then tis sad :/
 
12:59 PM
Some cops, on making any traffic stop, will touch the driver's car on their way to talk to the driver. If something bad happens, that cop's fingerprint will be on the car.
In the same vein, leave a comment when you're worried about grace period edits. You can always delete your comment.
 
Wow nice idea.. Comments before flags :)
 
@BhargavRao Grace period edits leave no traces, since they're basically just a way to save space in the archives.
 
I believe there was also a feature request so that grace period edits were also ended by a flag on the post
 
That seems like a good idea.
 
@JonClements That sounds very sensible. I wonder if it'll ever happen...
 
1:06 PM
shrugs - who knows!
 
Hopefully it happens
Brief rbrb..
 
morning everyone
 
"If I'm ever on life support - unplug me... Then plug me back in again - see if that works" :p
16
 
1:22 PM
Time for me to rhubarb.
 
I'll miss you :(
 
Past Kevin wrote some ugly code and now I have to maintain it :-(
 
@Kevin my life recently has been brushing up an old project prior to leaving my current company - I am not a big fan of 2011 Jon right now...
 
@corvid I liked the episode where he gets beaten up with a shoe.
 
@jonrsharpe but - look at it this way - you wouldn't be here without 'em :)
 
1:27 PM
This is true!
 
Let's hope that 2019 Jon isn't as dismissive of 2015 Jon as he is of 2011 Jon!
 
That moon-dwelling billionaire can do what he likes
I suppose it's good to look back and realise you'd do something differently, otherwise how do you know you've learned anything in the meantime?
 
As long as he buys the other room regular Jon a few pints - I'm happy with that )
 
Cabbage!
 
cbg @poke
 
1:31 PM
cbg
 
cbg
 
@JonClements Brilliant.
 
@JonClements FWIW 2015 Jon would stand you a pint given an appropriate opportunity
Always good to keep mods on one's side ;o)
 
@FaheemMitha Richmond was best episode
 
@corvid you mean "The Red Door"?
I'm a fan of the Final Countdown, personally
 
1:43 PM
No, Past Kevin, stahp. Don't write that pdf rendering function under the assumption that the result should fit on A4 paper.
 
@jonrsharpe You London office based?
 
What do you think this is, France?
Here in America we use normal size paper.
 
Aka 'real paper'
 
@JonClements as of November 23rd I am; currently I'm Bracknell office based!
 
Freedom paper
 
1:44 PM
@Kevin yes, heaven forfend you adopt any international standards that make sense!
 
@jonrsharpe ahhh... well... Plenty of opportunity for a pint when you're settled in to the new job then... can't get out of having to visit London to meet people forever!
 
Incoming transmission from Future Kevin. "America is conquered by Belgium in 2032 so you may as well write the function to accept any kind of paper size, and save yourself some time"
 
@Kevin repeat after me: "Paperless office, paperless office, paperless office..." while clicking your heels together...
 
I have a small doubt if send a .pyc we could run it on any system right
 
It didn't work. I'm still looking at the 117 page reference copy of the document I'm supposed to be reverse-engineering.
You can run .pyc files?
 
Let's see what happens if I just change PageSize.A4 to PageSize.LETTER... Yep, everything is broken.
 
Thanks @jonrsharpe it is just that I don't have any other machine to test it as of now :-)
 
Kevin just look the other way... :D
 
@VigneshKalai that article contradicts me, so maybe read that first...
Or implies it's not as robust as I thought, at least
 
I have heard that byte code is not machine or OS specify
@Kevin yes can run .pyc file just like .py file as for as I know and tried that :)
 
1:55 PM
That's sometimes why people are confused by their code's behaviour, they're running an earlier .pyc instead of the actual code they're looking at.
 

« first day (1840 days earlier)      last day (3091 days later) »