« first day (2460 days earlier)      last day (2471 days later) » 
00:00 - 16:0016:00 - 23:00

4:07 PM
Cabbage, all
Currently lost in Kubernetes land, but slowly finding my way around. Man, is there a lot to go wrong
 
yeah you really need to be careful with that stuff
it's heavy
We are toying with swarm now
 
"Not enough Minerals!" ?
 
Yeah. I'm being real nitpicky about our backend install documentation, because I want ultimately to allow for white-badging it on private and public clouds
 
Cabbages. As you may be aware, there is presently a somewhat heated debate on meta about an old python answer. I've been told my inexperience with python, specifically imports if I can understand correctly, prevents me from seeing the correct way this should be handled. Could anyone aware of the context try and explain to me how replacing the imports in this answer actually doesn't, in any way, change the answer?
... I'm well aware there is no replacement for actual experience, but imports are not something so specifically related to python, are present in lots of other languages, and I still fail to see how this should be handled specifically with python in mind..
 
cbg all
 
4:20 PM
how would I go about writing a class decorator that emulates old-style MRO? Can I use some metaclass magic here or do I need to override __getattribute__?
if I understand correctly, a decorator runs too late to forcibly push a metaclass onto the class
 
@FélixGagnon-Grenier any chance you can link the meta post in question too
@Marcus \o cbg
 
@FélixGagnon-Grenier per the docs, pylab is a convenience module that bulk imports matplotlib.pyplot (for plotting) and numpy (for mathematics and working with arrays) in a single name space. Although many examples use pylab, it is no longer recommended.
so the argument is that it's a different way of calling the same thing, and this is the now recommended way
 
well from what I glanced over, the meta topic has 3 different question. 1/ Is it alright to update an answer to reflect the current time. 2/ Is there a better solution to do question 1. 3/ Does the import change anything. Frankly I find question 3 kinda irrelevent to the topic. Sure it "loads" less but at the end of the day, the question isn't about optimizing imports or what not, therefore I find number 3 incorrect ... But I could be wrong on all 3 points, since I'm hungry and I only skimmed.
@Rawing a very interesting question. Is there a specific reason on doing this or is it just a question for knowledge? Either way I know what I'm going to do at lunch today. If you do find an answer I would love it if you could point me to it when you find it.
@FélixGagnon-Grenier To answer your question about import. import x will bring the whole module into your destination. from x import y will only bring y into the destination. I think you might know this but still worth reiterating it.
 
4:36 PM
@MooingRawr Half of the reason is fun, the other half is my hate of newstyle MRO in combination with super. Some unexpected things can happen in specific circumstances.
Jul 5 at 21:53, by Rawing
class A:
    def f(self):
        print("I'm doing something useful")

class B(A):
    def f(self):
        super().f()

class C(A):
    def f(self):
        raise Oops

class D(B,C):pass

B().f() # works
D().f() # doesn't work
 
@Rawing by new and old do you refer to the changes that happened in 2.3 as per python.org/download/releases/2.3/mro ?
or has it changed again?
 
yes that's what I'm talking about and no, it hasn't changed again. I wish it would though.
 
I do like the newer style but that's just me I suppose....
> NameError: name 'Oops' is not defined
 
That definitely violates the principle of least astonishment. I'm pretty surprised at python for that.
 
yep. Would you have expected that to happen when you called D().f()?
 
4:43 PM
So you like the MRO D->B->A->C->A rather than D->B->C->A ?
 
It would work perfectly if D didn't inherit from C or if C didn't inherit from A. The fact that the implementation of your parent classes affects your MRO is, frankly, ridiculous
I would prefer that, yes. It guarantees that B will always work as expected. Inserting another class between B and its parent is a terrible idea IMO
 
I don't think the MRO itself is the problem as much as super() is lying about what it does
 
but the mindset of I coded something in D that needs to look for it in it's parents class and if it doesnt find it there go to it's grandparents makes more sense to me than I coded D which needs something from it's parents but then the parent doesn't ask it's "partner" and goes straight to the grandparent seems rather silly to me
but we are talking about ideology here which I apologize for, I am still interested in a solution to your question.
 
I'm thinking about giving up on the decorator and just using a metaclass instead
probably the cleanest solution
 
I think that would be the better solution
 
4:48 PM
@KevinMGranger I think I agree with you here... so if B had its own print statement instead of calling super, would D().f() work?
 
@KevinMGranger I think super actually works exactly as advertised. It gives you the next class in the MRO. The problem is that C magically got inserted between B and A
 
ahh it's because super can't rely on just giving you the parent, it has to climb the MRO hierarchy
 
@Rawing don't think it was magic, more of a queue system. D was added, it's parents were next in queue which was B and C then B's parents will be added to the queue and then C because C was next in queue
 
you pythonistas have taught this java native something today!
 
Yeah, I have to admit that the new-style MRO does make a certain degree of sense. And the truth is, I've never had a problem with it in real code.
I still don't like it though :/
 
4:53 PM
That's fine, we all have our likes and dislikes, that's why we should find a solution for something you like :D
 
so how does super combine with old-style MRO?
 
that's a good question
apparently it doesn't
>>> super(B)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: super() argument 1 must be type, not classobj
so in python2 you have to inherit from object if you want to use super
 
@FélixGagnon-Grenier For completeness, the meta issue was also discussed in a separate chatroom, with my involvement starting here. I believe this helps complete the picture.
 
@Rawing super had you call a function that was not a superclass. It is misleadingly named at best
 
(sorry for multiple pings, I'm trying to be optimally informative)
 
4:59 PM
no problem ;)
 
@KevinMGranger I don't disagree. But I think you're making the wrong assumption that super operates on the MRO of the class it's used in. In truth it operates on the MRO of type(self). If you think of it that way, it works exactly as advertised.
 
I get that part-- but if that's how it works, it has the wrong name. super() gave you something that was not "above". If it were super(self), that might make sense. Explicit is better than implicit, after all.
 
Well, super() is a shorthand for super(cls, self)...
 
is it?
 
5:07 PM
pretty sure. let me dig up the docs.
 
nah, I'll take your word for it
 
Yes, I think that's how the old style is supposed to work. But then you even have the current class in there! Why wouldn't it be above it!
 
the only thing I know is that super() is magic
 
@KevinMGranger Well, D's MRO is D, B, C, A, so that means C is above B. It's just that python has a slightly different definition of "above" than you...
But I 100% agree with you that the way super works is counterintuitive
 
To be fair, I don't know of a more concise way to say "self's MRO but without this current class"
 
5:16 PM
I couldn't find an explicit "super() is equivalent to super(cls, self)" in the docs by the way, but I did find this:
class C(B):
    def method(self, arg):
        super().method(arg)    # This does the same thing as:
                               # super(C, self).method(arg)
 
It would be in the release notes when zero-arg super was introduced, unless that's where that's from
 
too lazy to google any more. that's good enough for me.
 
With how lazy we are, you'd think this is the Haskell room! crappy sitcom laugh track
 
5:30 PM
24
Q: Introducing: Channels - Q&A For Engineering Teams

Tim PostWhen you use Stack Overflow to solve some of your problems, you begin wanting to use it for everything. We've often said that Stack Overflow isn't a place for everything that programmers want to do and talk about, but we've always wished that we could make it easier for teams of engineers to bet...

 
oh come on
(I didn't read any of it yet)
 
It sounds pretty reasonable to me
 
Why not call it Teams? Heh.
 
It would allow us to finally answer "what if we created a community for all the newb questions?" I'm sure plenty of channels for that will spring up and die.
 
DSM
So a "channel" could be devoted to sub-SO-quality questions?
 
5:35 PM
are these virtualenv SO sites?
 
can anyone recommend a good web host? just looking for something cheap to throw a portfolio type site on, so low-traffic, etc.
 
that sounds like a very weird model
but at least it's unlikely to affect the real world (i.e. SO main)
 
I think a company pays for a 'channel' and adds their devs to it, I don't think people will be able to make newb channels that anyone can join and use?
 
> We eventually plan to charge for some tiers of channels, but we're not yet sure how much that's going to be or when we're going to begin
 
A Q&A site for internal, domain-specific projects that wouldn't be good enough / valuable to SO main? I love the idea! Especially if you're working with an un/under-documented mess.
 
5:37 PM
> (Who's going to ask a their twelve teammates a question when they can ask the full Stack Overflow community?)
 
Yeah, that part makes me hesitant to become dependent on it, though.
 
... is Stack Overflow aiming to overthrow Slack?
 
DSM
As an aside, whether this works or not, it at least seems a reasonable goal, building on SO tech. There's some stuff we do on NumberFirm using a (frankly) terrible tool, which would work much better on an SO clone.
 
yeah, I'm not against this, I'm just surprised by the need for it (lacking personal experience)
 
user3657941
@Jfach: I use a2hosting
 
5:39 PM
Thinking about it, I wonder if the docs here could be improved by SOD...
 
@DavidCullen looks good, thank you sir
 
0
A: Introducing: Channels - Q&A For Engineering Teams

davidismHow automatic is the process for creating a channel? How on-topic will these channels have to be in relation to SO? Will channels be shut down if they don't get a certain amount of activity, similar to chat? For example, can someone create a channel for discussing programming books (or any books...

OK, I made it an answer, an answer that's entirely questions.
 
just to be sure we're on the same page: channels are more like SO and less like SO chat...right?
it has Q&A, rep, etc., you name it
 
user3657941
lol @davidism
 
user3657941
@AndrasDeak: From what I read, yes. Channels are mini-SO
 
user3657941
5:44 PM
However, if I wanted to have a separate Q&A I think I would use Redmine
 
user3657941
Redmine has per-project forums
 
@davidism Well, to a question that's entirely answers, that sounds about right
 
user3657941
Does a small company really need the ability to have multiple people answer a question and then vote on the best answer?
 
Sure, plenty of companies deploy those open source clones of Stack.
 
user3657941
Orly? Jeepers. Didn't even know there were open source clones. Wow.
 
5:48 PM
Can confirm. There's plenty! Mattermost, Rocket Chat, Zulip, and I guess you could set up matrix / riot
 
user3657941
Okay, what's the definition of "small company" here?
 
don't know how I feel about what I just saw. Have you seen this yet? In order to avoid the `` to split long lines, I saw someone doing:
(stuff(things)
  .foo(other)
  .bar(other_other))
outer parentheses wrap
something smells yucky about that
 
@MooingRawr the final code:
class OldstyleMROMeta(type):
    def mro(cls):
        return _calc_oldstyle_mro(cls)

def _calc_oldstyle_mro(cls):
    mro= [cls]
    for base in cls.__bases__:
        mro+= _calc_oldstyle_mro(base)
    return mro
 
looks like it didn't show up...avoid the "\"
 
user3657941
@idjaw: Do you have a real-world example we can look at?
 
5:55 PM
that's exactly what it looks like. The names are changed that's it.
the idea is that in order to avoid doing something like this:
stuff(things)\
 .foo(other)
wrapping the whole thing in parentheses avoids using the \
I feel like it is an ugly hack to avoid that
 
user3657941
I hate the backslash look. And I don't like the parenthesis solution. So I usually refactor my code in such cases.
 
user3657941
btw, what was the trick to get a backslash to show up?
 
I know that the backslashes are a valid solution, but I could never bring myself to actually use them
 
@Jfach webfaction are always worth a look, and are pretty low-cost with most tjhings available through a Python API
 
I prefer parens. Get ye some lisp in yer python.
 
6:00 PM
That sounds nice. I will check it out, thanks for the suggestion.
 
The reason why the line is broken up is because it is a long chain of calls that go over the line limit
@KevinMGranger dammit....you were the one I was hoping to tell me not to use parentheses! :P
 
"Line limits". Here's a nickel, kid, get a wider monitor
 
haha
 
user3657941
Yeah, I don't like the endless call chain approach either
 
unfortunately due to the test framework being used, it's usage requires it
 
user3657941
6:01 PM
result = func()
result = result.method()
result = result.property
 
dont().you().just().love().fluent().interfaces()
 
yeah I see where you're coming from with that
 
@Rawing interesting. sadly I don't have time to look at it or work on it this week and next week. Being pulled into a project I know nothing about :\
 
this().makes().me().love().the().decisions().I().made().please().sir().can().I()‌​.have().some().more()
7
 
solution: rename all functions to be one letter
a().b().c().d().e().f.().g()
;)
 
user3657941
6:02 PM
this.always().seems().to().get().abused()
 
user3657941
Probably the biggest reason I hate function chaining is that is difficult to step through in a debugger.
 
Given /It could be worse, it could be a "(.*)" dsl/ do
 
I don't know how I feel about Channels. Guess it doesn't affect me at all since my company has a similar thing set up on a private wiki-like page...
 
@idjaw then Haskell happened
 
Yeah you just need to make a list of those functions, and then use the >==][]< infix operator with the mapfrobn2 function
I was going to try to type that out but I thought it too ugly. Plus I think I found a bug with sed?
echo "this().makes().me().love().the().decisions().I().made().please().sir().can().I()‌​.have().some().more()" | sed 's/()\.\?/,/g'
this,makes,me,love,the,decisions,I,made,please,sir,can,I,‌​.have,some,more,
 
6:14 PM
who needs python when you can write code like that
 
why did the . before have come into play ?
 
Just do it in F# let ``this makes me love the decisions I made please sir can I have some more`` decisions more = decisions + more
 
I think it has something to do with the repeated I() but that shouldn't affect it
 
DSM
I know nothing about F#. Worth learning?
@DavidCullen: that's always been an argument of mine. Ideally I shouldn't have to modify code much to debug it..
 
@KevinMGranger not the I()
 
6:19 PM
this code I'm looking at is the flexmock package, which is "designed" to be used in this way to make it easier to read the tests
so it will actually look like this
 
@DSM It seems really interesting to do unit testing in C#.
 
flexmock(some_class).should_receive('a_method').with_args(1, 2).once().and_return('chicken goes bock')
 
$ python3 -c 'print(repr("this().makes().me().love().the().decisions().i().made().please().sir().can().ja()‌​.k().have().some().more()"))'
'this().makes().me().love().the().decisions().i().made().please().sir().can().ja()\u200c\u200b.k().have().some().more()'
very funny
 
DSM
@idjaw: some pandas answerers use chaining to try to show off how one-liney they can be. I think it's silly.
 
good god....
 
6:20 PM
I suspected the dots first, but those didn't help
 
The ticked method names are nice and descriptive and it allows you to do enough pattern matching/functional stuff where you don't need the normal boilerplate.
 
You trynna play me idjaw
 
@DSM yeah...in real code I hate it....but this is test code, so it is dummy code that is meant to be "read" to understand the test
 
No I mean the \u200c\u200b that snuck in there
 
6:22 PM
oh haha
 
user3657941
So what's less readable about

result = flexmock(some_class)
result = result.should_receive('a_method')
result = result.with_args(1, 2)
 
user3657941
Also, when you have 10 functions on a line, how do you know which one failed in the traceback?
 
user3657941
Hey, whyn't format me code?
 
DSM
@DavidCullen: look on the starboard at the right, the top starred message.
 
user3657941
I did. I indented 4 spaces. Shouldn't it be fixed font?
 
DSM
6:26 PM
"you can’t mix plaintext and code in a multi-line message"
 
user3657941
Oh, well. I can't edit it again, but I guess you can understand my question.
 
@DavidCullen have you used flexmock before? You are over thinking this. It's part of the test framework. And sure, you can argue that splitting it down like that can still be readable. But I think the argument of 'not debuggable' is moot considering what it is.
 
user3657941
I know the "result =" is more typing, but I'm a 60 wpm touch typist.
 
Plus, the function that threw would be in the traceback
 
user3657941
No, I have not used flexmock before. Sorry.
 
6:29 PM
You don't have to apologize. You're better for not using it. :) I don't like it.
 
DSM
As for the readability, saying "result" five times is kind of visually distracting. I don't mind binding temporaries in my real code because I usually don't have exactly the same object being replaced that many times, IYKWIM.
 
TIL - IYKWIM
 
user3657941
Oh, they have an example on their pypi page: pypi.python.org/pypi/flexmock
 
user3657941
I'll never use it
 
COOL_LINGO_DICT['IYKWIM'] = 'If you know what I mean'
@DavidCullen Makes sure you stick by that. You'll thank past you for it.
 
user3657941
6:31 PM
Well, usually the "result =" thing is when I'm doing multi-stage parsing of text.
 
@DSM the "k for /noʊ/" part makes it pretty hard to guess
 
user3657941
It saves me a lot of time to be able to break the parsing into separate steps that can easily be stepped through in a debugger when I get unexpected input.
 
user3657941
Usually, I'm testing my parsing on good input and debugging it on some thing I would never have expected. Text is console output from embedded devices.
 
DSM
We were using IYKWIM back in usenet days, so I can't remember not immediately recognizing it..
 
user3657941
So flexmock is modern COBOL: "flexmock declarations are structured to read more like English sentences than API calls, and it is possible to chain them together in any order to achieve high degree of expressiveness in a single line of code."
 
user3657941
6:37 PM
Okay, so does anyone here think flexmock is worthwhile? I want to hear the other side.
 
user3657941
People wouldn't go to the trouble to get it into pypi if someone wasn't happy with it.
 
that's...unreasonably optimistic
 
DSM
Apr 29 '16 at 20:12, by DSM
Let a thousand flowers bloom.
 
user3657941
lol @ your unreasonable pessimism
 
user3657941
That was funny. Do it again.
 
6:39 PM
not assuming that every single person is behaving in a socially optimal, rational way is barely pessimism :P
 
user3657941
Sorry. I spend too much time with my kids.
 
user3657941
No, you're right. It's still funny though. Remember, humor is anything bad that happens to somebody else.
 
at least it's easy to explain Schadenfreude to kids
 
6:54 PM
1
A: Introducing: Channels - Q&A For Engineering Teams

enderlandAnother benefit (concern, depending on perspective), what would prevent a community from say, making a channel and keeping it "invite only" and using it to effectively block or ban all low-quality question askers? For example, I like looking into good questions but loathe the trolling of SO to f...

Channels might be the holy grail of resolving bad questions on SO!
 
Is there a way to make scrapy start_requests() return Deferreds, or something to that effect?
Or really anything yield iterable of deferreds, before sending any requests?
 
7:34 PM
@enderland I wish
 
7:52 PM
watching some advanced python training. seems like you could be massively evil by monkey-patching __new__...
 
wait is my understanding of channels correct: It's a pay to set up your own little SO for your company where you can invite certain people in and only those people can see the questions and answers? IE the questions will be private?
 
8:36 PM
@MooingRawr yes
that's my read at least
 
user3657941
8:51 PM
I think they are going to make it free at first and later pay.
 
that's explained pretty clearly
I think Mooing mistyped "way" as "pay"
 
i meant as can we pay to set up a private channel but way also works lol
 
lol :D
 
Basically I had a talk with one of the lead manager, and they are interested in this service if we can keep an offline version on our company servers so we can handle the security
 
user3657941
lol, pay to ask Python questions, nice
 
8:53 PM
or if that's not able, is there a way for us to secure our own channel.
 
@MooingRawr the whole point seems to be to have it hosted by SO
otherwise you can use any of the aforementioned open-source alternatives
 
is what I'm getting, either way I posted my question in that meta thread lol, so i can report back to my manager
 
that's my take, I mean
@MooingRawr yeah that's fine :)
"you see, I told you I wasn't just wasting my time on SO"
 
:D
My manager knows I browse Python's SO A LOT (based on what IT reports back, some 90% of my web traffic is on SO). so glad they don't know my user name :D
 
@DavidCullen that's the concern right, if people get excited about free stuff and then have to pay $500/year for a "private SO" it'll really make a lot of people upset
 
user3657941
8:56 PM
Nah, SO would never do anything that might upset people
 
I'm pretty sure if they wanted to find out, they would sit in this chat room and listen to my type things and maybe hope to catch my msg when my typing ends; but if they have that much time on their hands. they should do some other projects.
@enderland all I'm saying is, my company wish to have control over the sensitive(?) data we put on that service. And if the only way to gain that control is by paying a fee, so be it.
 
user3657941
I have to admit, I'm still trying to wrap my head around the idea of how a private SO would be used. Would love to tour a company that had such a thing. Would love to read the questions, "How much coffee do I put in the paper thing?"
 
My company currently uses an offline wiki style site for questions an answer. So we welcome a better software version that handles it.
 
user3657941
What would be a sample question (without giving out sensitive information)?
 
My company uses a mix between C# and two other proprietary language which I'm not allow to disclose
 
user3657941
9:01 PM
D'oh!
 
asking questions about those proprietary language is one of the main reason we have a Wiki
 
atlassian has a version of SO too in case people use that, not sure what it costs
 
user3657941
Gotcha
 
:D @enderland, I can tell you that we looked into that option and it was too expensive for what it did, is all I can say, among other reasons
 
user3657941
Atlastian, how do I love thee? Let me count the ways? Done.
 
DSM
9:03 PM
askbot isn't bad. Some projects I've worked with use it.
Okay, time to flee. Rhubarb for all!
 
ugh nvm, have a good one DSM \o
 
rbrb
 
9:52 PM
I need your help quickly, is it possible to write print with parentheses in python 2.7.9?
Isn't that only supported in python 3 and above
 
quickly?
are you doing a test?
 
No, but I won't go into detail.
 
oh, me neither :)
 
from __future__ import print_function?
 
9:54 PM
or maybe just print(whatever_but_only_one_value_with_no_commas)?
 
import sys; import subprocress;
if sys.version < (3,0,0):
    subprocess.Popen(['python3', sys.argv[0]])
 
Now that's problem solving ability.
 
ImportError: No module named 'subprocress'
 
KMG cleverly hid a few small bugs as an exercise for the reader
 
hmm, right
I didn't read the rest
 
10:00 PM
This is very strange, I am running python 3.5 and when I type the following:
import os
x = os.urandom(8)
print(type(x)) # <class 'bytes'>
print(x) # b'\x85\x8dTi\\\xa3\xa6\xf9'

But another dude is running the exact same script, with python 2.7.9
And gets this as output:

<type 'str'>
Ú÷áÐX§Ôi
What is happening?!
 
perhaps the output is random D:
 
python 2 is bad and doesn't have bytes
 
No it will always output a byte for me
uhhh
 
always?
have you tried running it at least 10 times?
 
so urandom in python 2 will always output a str
yes I have andras
More than 10 times
 
10:01 PM
OK, just checking
you can never know if it will start popping out tuples every once in a while
 
I repeat all the test cases I have ran, it has spitted out a byte
 
good job
you can start figuring this out by reading up on the differences between 2 and 3
but quick because you're in a hurry
 
haha lol
 
I won't go into detail
 
I like your humor
 
10:04 PM
you haven't seen my humor
 
They might have an x-ray machine, you never know
 
00:00 - 16:0016:00 - 23:00

« first day (2460 days earlier)      last day (2471 days later) »