« first day (2355 days earlier)      last day (2592 days later) » 

6:00 PM
@Kevin can't I just mock that instead?
 
The gazebo ignores your mockery.
 
6:11 PM
I should find myself a DnD group again
 
I"ve never been able to get into DnD... now other games? :x
 
DoNotDisturb group
 
Historically, tabletop rpgs have not meshed well with my "spend thirty minutes composing something interesting to say" style of communication
I have a stirring speech to deliver to the kobolds, but oops, diplomacy failed eight rounds ago and now we're fighting them to the death instead
 
https://www.pastiebin.com/58daa8ebf1d56#&togetherjs=BBv6cGVEMR
I am playing around with some logging and decoraters, but for some reason I got this error:
in wrapper
logging.INFO('doing some logging here in {}'.format(function.__name__))
TypeError: 'int' object is not callable
 
are you sure that's where the error is coming from?
pastiebin?
 
6:22 PM
@AndrasDeak I wonder how many sites there are that do nearly the same thing
 
>>> import logging
>>> logging.INFO
20
Yep, logging.INFO is an integer.
 
@enderland whenever I would have to enable javascript on the given pastiebin, I just close the tab instead
 
How is logging.INFO an integer?
That doesn't make sense.
 
how so?
 
Maybe it's supposed to be an enum-like thing. Like, whatever function actually does logging, you're supposed to pass logging.INFO to that to indicate the logging level.
 
6:23 PM
>>> print logging.__dict__['info']
<function info at 0x102c540c8>
>>> print logging.__dict__['INFO']
20
 
try LOGGING.info
 
For instance, logging.log takes a level parameter. Maybe you're supposed to do logging.log(logging.INFO, "message goes here")
 
I don't understand, how is it logging 20?
 
Note: I have never used the logging module so I'm only guessing
 
6:25 PM
I can't figure out where that actual source is to get a nice link
but look at the line that is:
> INFO = 20
 
if you ask me it should just be called logging.20 for clarity
 
@AndrasDeak nah, they probably use it internally to do checks at the different levels
to determine what to print when
 
if i apply_async on a pool, but all workers are busy will apply_async block until a worker finished?
 
@SebastianNielsen I skipped to 25:22 on that video and I don't see logging.INFO anywhere on the screen. Are you sure that's the right time?
 
27:16
Looks better
oh, maybe it was because I wrote it with uppercase letters.
omg
That's the reason
I wrote logging.INFO(something)
instead of "logging.info(something)"
 
6:28 PM
Ew, that tutorial uses import inside a function definition. I can't condone that behavior.
 
@SebastianNielsen as enderland told you already
 
4 mins ago, by enderland
>>> print logging.__dict__['info']
<function info at 0x102c540c8>
>>> print logging.__dict__['INFO']
20
 
there ^
 
Take everything in that video with a heaping grain of salt
 
it's easy to miss with that direct reply and everything
 
6:28 PM
Sorry, I missed that.
Yeah it makes sense now.
 
@MarioDekena did you look at the manual?
the point of async is exactly so it doesn't block
 
@AndrasDeak i did
i know it doesnt block
 
I continue to fail to see the appeal of Youtube tutorials.
 
but you can specifiy workers, so what does it do if all are occupied
 
@Kevin you and Sebastian might have a different approach to problems
@MarioDekena seen this?
    # evaluate "f(20)" asynchronously
    res = pool.apply_async(f, (20,))      # runs in *only* one process
    print(res.get(timeout=1))             # prints "400"
at which point would you expect it to block?
 
6:31 PM
I have learned a lot from Corey Schafer on youtube.
 
oh, you don't expect it to block
 
@AndrasDeak i read this code allready. It wont block in this circumstance.
yeah
` with Pool(processes=4) as pool:`
 
well, what I expect to happen is that res.get won't return anything within timeout
 
@Kevin as long as there is a transcript... :D
 
@AndrasDeak yes, either that, or apply_async waits for a worker to become available... Cant find anything in the docs...
 
6:32 PM
do you guys like using syntaxes like this?
> self.foo = get_foo() or 'default_foo'
 
@MarioDekena I don't understand...do you mean that 4 workers are already working, and then you call apply_async again?
 
I don't know anything about the behavior of async but this seems like something worth testing empirically. Make a pool of N processes and hand it M tasks, where M >>> N, and see what happens.
Admittedly it's a little harder to write minimal test cases for nondeterministic functionality, but we don't need it to be super rigorous
 
@AndrasDeak yes exactly. I have a Pool with 4 workers and i call apply_async 5 times, before the first worker finished.
 
in case the answer to my question is "yes", then I misunderstood and I have no idea and do what Kevin said
the obvious expectation would be that if res1 = apply_async(...); res2 = apply_async(...) then res2.get() will simply not return any results until res1 is done and perhaps even depleted
 
Based on my very limited experience, I agree. I'd expect apply_async itself to not block, but trying to get the results would block.
 
6:37 PM
of course if you do this in a loop then you need to keep the earlier async result whatevers so that you don't lose the results to your earlier calls
@Kevin your limited experience can only be more than my nonexisting experience:D
I've literally never used async stuff, ever
 
I'm getting flashbacks to the C# room where it slowly dawned on me that I knew more about the question I was asking than the sum total of everyone else reading it
Not to slam the people contributing, bless their hearts
 
DSM
Must be what it's like for Martijn every moment..
 
nope, pretty sure you know a ton more than me
 
Of course you can easily end up in a state where "you know more about the question you're asking than the sum total of everyone else" if you just hold back relevant information and refuse to give a complete description of your problem
much like most of the noobies
 
6:42 PM
Alas, every question I take to the C# room is based on my zillion line work project, which I can almost never pare down to a comprehensible MCVE
 
You see? All your fault.
 
So usually the question comes out as "when you have ten years of accumulated cargo cult cruft, what might cause [strange behavior X] to occur?"
 
"Don't forget to walk around the island counter-clockwise, rookie mistake"
 
It's the opposite of survivorship bias. Everything that can be reduced to an MCVE, I can fix on my own. So the room only sees the unsolvable dreck left over.
 
@Kevin this actually happens to me in the tags I'm more confident in too, which kind of is annoying (but also nice?)
I mean I'm pretty ok at python, you guys are way better though :P
 
6:46 PM
I'm here to raise everyone's python self-confidence;D
and some Exceptions too, har har
 
heh I just commented on a PR that was doing something like except Exception, e: and told them not to do that, speaking of exceptions
and I ended up down the rabbit hole of reading the PEP on the subject
 
DSM
I've noticed that I no longer handle any Python 2 question, just note the fact and move along.
 
I hate that I have to work in python2
a lot of stuff at least
I mean seriously python2 was supposed to be end of lifed already
 
Ok, tested it. apply_async doesn't block. Even if no workers are available. Calling get on a result that is not executed yet will block until the function was assigned to a free worker and finished it's execution.
 
Seems reasonable.
 
6:51 PM
@Kevin wins ^
 
DSM
It's not enough that he has all the stars, now he gets all the wins? :-|
 
Kewin
not to be read as K-you-in
 
Hey I am not sure, but in one version of python 3, isn't it possible to assign numbers to a value in a way like this: value = 3_000_000
To make the number more clear. And the number being assigned still being the value of 3000000
 
@MooingRawr how far are you in Automata?
@SebastianNielsen 3.6
 
6:54 PM
whaat?
that's silly
 
@davidism Met A2, which is making me question the whole game, and I'm getting scared..... :\ I keep getting distracted by little things. Example: running to story, oh side quest, but it's under ground.... hmm -spends the next hour looking for said side quest, can't find it.... sigh... Oh a new fishing spot, I wonder if there's special fish in here.... There goes another hour.
 
wow
 
@SebastianNielsen docs.python.org/3/whatsnew/… tl;dr David's answer
 
2.7 users will have to make do with value = int("3,000,000".replace(',',''))
 
I'd suggest '3 000 000' instead, since , vs . is a locale confusing thing
 
6:56 PM
What is the easiest way to upgrade from python 3.5 to 3.6?
 
@davidism how much more is there to the main story before my first run ends ? (Oh I think I'm at the flood city)
@SebastianNielsen download 3.6 ? .... I don't understand that question are you asking how to make sure all your module works in 3.6 ? or are you asking how to uninstall 3.5 and install 3.6 or if there's a magical exe that does it for u
 
I thought There was a command in the cmd
Some --update command
 
Perhaps you're thinking of pip, which is something different.
 
upgrade
 
ahh so your asking for the third option... :\
 
6:57 PM
do you guys use coverage types of things? have you ever experienced issues with coverage reporting different lines covered on different machines for the same tox environments?
 
I don't know what a tox environment is, so... No to both questions.
 
you've not used tox before? that surprises me, though, you probably tell your teams "get rid of non-python3+" :)
 
lol if you imagine me in a position where I can tell a team what to do
 
you can't spell team without "me"?
 
To imagine the leadership and direction of my work team, picture a derelict pirate ship drifting through the Bermuda Triangle for 100 years
 
7:08 PM
so all those zillion lines of C# code are just instances of Jack Sparrow
 
7:18 PM
@MooingRawr the mission at the flooded city basically starts the end sequence. Don't worry about missing quests though.
Anemone basically says "do anything you wanted to do if that's important" when giving you the quest, so it's not like the game doesn't tell you.
 
Shout out to all the game devs that clearly indicate the point of no return before you actually get to the point of no return
 
Guessing Anemone is someone I will meet.
 
She's the resistance leader.
 
Oh so I'm close to the end... no I feel like something bad will happen to 2b or 6O :(
Oh I didnt pay attention to her lol
 
It would be weird if you got this far into the game without meeting an enemy.
... That joke would work better in a sound-based medium.
 
7:21 PM
Something bad already happened to 6O: her crush turned her down. ;_;
 
DSM
@Kevin: :-|
 
but then 2b cheers her up with a tsundere answer :D and it filled my heart with joy
God I love 6O, I wanted to find that flower so I can put it on 2B's head so 6O will be happy :D gotta protect her ...
 
I googled the term now. Tsundere enlightening.
 
Only '16 kids will remember this gem:
Sep 19 '16 at 17:37, by Kevin
And if those sea animals enjoyed Japanese cartoons in flagrant violation of ocean law, they'd be eminem enemy anime anomie anemonies.
 
I was mildly surprised you didn't squeeze an enema in there
it might improve still
although the users that don't even look at the preview usually don't improve later
they might be typing out all the errors that are in their original non-included images as we speak
 
wim
7:25 PM
@AndrasDeak can me amended
 
DSM
We're being a little quick-on-the-draw lately.. I know we have the irredeemable exception, but it's not like most of these are going to survive long anyhow..
 
Oops, forgot about the timestamp.
 
is there even an irredeemable exception?
 
Nah, that was my bad.
 
DSM
@AndrasDeak: yeah, there's Rule 5.
 
7:26 PM
I voted anyway because even if they edit, it'll be 3 images with code/output
> 5. Cute fluffy animals (especially kittens and puppies) are cool, okay!?
right
(I found your rule 5 too, thanks)
 
wim
suppose I have match and inverse_match in a mutually exclusive argparse group
 
I'd love to see "blatant effortless homework dump" on that list, but I asked about a specific instance earlier and davidism asked me to wait 10 minutes anyway
 
wim
then in the library code, I have an assertion like
assert args.inverse_match is None, "argparse mutually exclusive group failed"
is that a good use of the message? or should it be like a description of why the assertion should always be true
assert args.inverse_match is None, "argparse prevents specifying both match and inverse_match"
 
DSM
I've never liked that syntax. Feels like it should be asserting the tuple, which is nonempty so will always be truelike. :-P
 
wim
I know, but assert statement is a statement even in python 3
and there are good reasons for that (they can be removed by compiler)
my question is more about whether the message should be phrased in the positive sense or the negated sense
 
7:30 PM
I think an assert message is good enough if you can use it to determine why the program is in an invalid state. Sort of a broad classification, I know, but I know it when I see it.
 
DSM
Oh, I wasn't addressing your question, just griping. Not uncommon.
 
wim
argument for the first way: because it's used as the message for the AssertionError exception in a failure mode
 
@davidism time to repost that methinks.......
 
wim
argument for the second way: because assert statements are used like a loaded comment in the source code, the message should just comment what's asserted in plain english ..
 
My answer to "Should I make my assert message say what the expected state is, or what the actual state is?" is "both"
assert x == 23, "Got {}, expected 23".format(x)"
 
7:32 PM
it still has broken formatting, and way too much code in my opinion
then again it already has 4 close votes
3
 
DSM
@Kevin: join the py.test world and just write assert x == 23. ;-)
 
unless that's as much as a flask mcve has to be
 
wim
I am not talking about tests. I'm talking about asserts in library code.
 
@DSM I think the last time this conversation happened, I expressed jealousy about that more concise syntax.
I'm still jealous. Hooray consistency
 
assert x is 23 # determine whether we're using cpython
 
wim
7:34 PM
for the tests, bare assert statements work perfectly - and the test runner provides all the context you could possibly ask for
 
DSM
Since an assert IMO should only be used for programmer error, I guess I want the message to tell me specifically what fact I assumed would be true is actually wrong.
 
I guess these days I can do assert x == 23, f"Got {x}, expected 23"
On second thought I like f"expected 23, got {x} instead"' better
 
wim
@DSM so you're in support of the first way?
 
If x happens to be an object with a long and ugly repr, this makes it easier to pick out the expected value
 
yup
 
DSM
7:38 PM
@wim: the second seems more specific (it mentions match which the first doesn't).
 
wim
the first way better serves the developer reading a crash traceback, the second way better serves the developer reading the source code
I guess I'm on the fence about whether library asserts should be written for people reading the source code or for people reading a traceback
 
DSM
I guess I don't see them as quite as distinct as you do. An AssertionError should only be fixable by modifying the code anyhow, so the one guy is going to be the next guy in two minutes.
 
wim
two minutes or two months ... depending on your manager !
:D
 
On average there are slightly more developers reading crash tracebacks than developers fixing the crash, if you account for developers that have an epiphany between those two tasks and abandon their urban lifestyle to go live in the woods
Compare to the fact "the average human has slightly fewer than two arms"
 
wim
thank you @Kevin for always thinking of the insane edge cases
 
DSM
7:45 PM
But the traceback readers are considerably less important to the process.
 
@Kevin I'm imagining someone storing that as an integer and ending up with all sorts of weird int math off by one errors LOL
 
There's a Far Side comic like that where the man says to his friend, "... And these are my 1.5 kids" and there's a complete kid and the left half of a kid in the foreground placidly watching tv
 
wim
above average boy (chinese kid born with 3 arms)
it's a safe assumption that 1-armed people are far more common though ..
 
I considered the possibility of >2 armed people, but I assume that their contribution gets drowned out by amputees by a couple of orders of magnitude
 
wim
It only takes one person born with very many arms to put the average wherever you choose, though. A person can't have less than 0 arms, so it can't work the other way, even accounting for hypothetical evil geneticists
 
7:50 PM
Obligatory:
> “average person eats 3 spiders a year" factoid actualy (sic) just statistical error. average person eats 0 spiders per year. Spiders Georg, who lives in cave & eats over 10,000 each day, is an outlier adn should not have been counted”
Arms Georg should not be counted for similar reasons.
 
wim
outliers should be counted. if you don't want them counted you use median, not mean
there was something in the constitution about the right to bear arms , iirc
 
wim
oh, that's what it was about. disregard.
 
gatherer.wizards.com/Pages/Card/Details.aspx?multiverseid=29785 from 2001 demonstrates that this joke is an antique
Who am I kidding they probably had wordplay about this the day after the thing was ratified
 
wim
headline of the century
> GOP Makes Good On 2009 Promise To Block President’s Healthcare Bill
 
8:00 PM
stackoverflow.com/q/43078273 duplicate of stackoverflow.com/questions/3007253/…, plus the other half of the question is a typo
plus they didn't actually include a mcve, just a bunch of unrelated code
I used my vote already so can't hammer it.
 
wim
speaking of pytest, does anyone have a solution for this? stackoverflow.com/q/43009452/674039
it seems like it should be there already, but I couldn't find it ...
I could just use the one in contextlib , I suppose.
 
Is it safe to only read from a dictionary across multiple threads? Someone asked this in a group I'm in and I wasn't sure
 
wim
yes
it's safe to write, too (GIL)
 
Oh troooo
 
8:22 PM
hey guys, can somebody walk me through creating a bitmap header?
im tryna create a script that automatically generates bmp files
only in monochrome
so I have a 200x200 list of just values between 0-255
but im not sure how to write the header
 
there are python modules that can help with saving an array as bmp
 
what if i dont wish to use the module?
 
then you may ask the bmp room :P
 
that came out in the wrong way
theres a room for that?
ah no
 
No, I was kidding:) You can wait and see if others can help, but what you need doesn't sound trivial, most people usually don't write bmp files by hand
 
8:25 PM
ah okay
 
have you tried locating a specification for the bmp format?
 
yes
 
Obvious follow-up: did you find one?
 
yes#
tho im getting confused when reading it
 
Is this a Python question or not? The answer to all "I don't want to use a module" statements is "then do exactly what the module is doing, it's open source".
If you're getting confused, then ask a specific question about what you're confused about.
 
8:28 PM
eh, ill try it myself
 
that should always be the default
 
This is what is wrong with the Python community. Obviously he wants to know how it works. Just downloading some random module and using that will not help at all. And if you are not well-versed in Python, trying to read the source code is unlikely to help either.
 
He didn't ask a question.
 
You wanted to say "python 3 community"
 
@AndrasDeak lmao, ive been trying it myself for the past day
 
8:29 PM
@SylentNyte then I don't understand your attitude:)
 
"hey guys, can somebody walk me through creating a bitmap header?" - that doesn't suffice as a question?
 
8
Q: How do I create a BMP file with pure python?

Taras BilynskyiI need to create a black and white bmp file with pure python. I read an article on wikipedia about bmp file format, but I am not good at low level programming and want to fill this gap. So the question is how do I create a black and white bmp file having a matrix of pixels? I need to do this wit...

 
I converted to Python 3 today when I wanted to use nonlocal. It's not in Python 2. Yay. But still, there is legacy stuff that needs Python 2, so alas.
 
@SylentNyte yeah, it does, but not one we could answer here
 
@SylentNyte you need to ask a specific, Python-related question, to get help in the Python room. Stating that you already understand specific parts, and what, specifically, you're having trouble with, is also helpful.
Otherwise you get the conversation we just had, where we ask obvious questions and you get frustrated that we're not answering your "actual" question.
See the help center for more resources on asking good questions.
 
8:32 PM
beep beep How to Ask
 
wim
@davidism that's too kind.
 
(for what it's worth, I'm spending probably 20 minutes writing up my soon-to-be-posted SO question and I'm going to be sad when it's done because it's still not going to be a superduper question)
 
DSM
The world will survive some excess kindness.
 
Wow, the Wikipedia article on the BMP file format is actually pretty detailed about how the header is constructed.
 
wim
better answer is usually "just use the @%^$* module"
 
8:34 PM
@enderland any question that is not a pile of dung warms my heart
 
wim
....or "no, I will not do your homework for you" :)
hmmm I love these new f-string but you have to be more careful in your coding until the IDE catches up now
if you have a bad name in your .format(....) it's obvious with red squiggly underlines
in the f-string , you find out at run time :(
 
golang is like that for some reason, which is confusing since it's basically a strongly typed language yet they didn't bother to enforce compile time validity of their format strings
 
@wim pycharm highlights unresolved references in f-strings
 
wim
it does, but not the same way I'm used to
it's less noticeable somehow.
might be I just have to get used to it
 
You can probably adjust the inspection to get it to stand out more.
 
wim
8:40 PM
ok I'll try.
the red squigglies are better
 
@AnttiHaapala The wording of the error is stupid (but not for the reason you suggested; 'should' is perfectly fine) A better wording is: __init__() should not have a return statement . But feel free to join the comments in that answer to say you disagree, especially as a couple of people keep deleting them.
 
wim
omfg
I just spent about 2 hours trying to figure out a bug
and when the breakpoint in the method didn't fire
I realised it was because i had def the same name later in the module
stoooooopid rookie mistake
 
Hi, I got an answer to my question. But I don't know any Java to translate some of it to python. Could anyone please take a look at it and see if they can translate it? stackoverflow.com/questions/43057681/…
 
@wim I'm hoping my battle of the day is something that easy to fix..
 
wim
easy fix but demoralizing
 
8:55 PM
probably less demoralizing than investigating "quirks" with coverage
 
wim
is that what you're investigating?
 
:( yeah
 
wim
I know a few of those
 
I just posted a lengthy question that will go unanswered probably since no one will know the answer, lol
 
wim
will have a look
 
8:57 PM
@Link hello, please read our chat room rules: sopython.com/chatroom specifically the section about not posting >2-3 day questions.
 
wim
the last time this happened to me, it was because the line was being blown away by cpython peephole optimizer
turning off wifi changes your coverage results? LMAO
 
I'm not even joking
like... I read that after I posted that and was like "WTF this guy is insane"
but nope.
 
wim
I think I know your problem
but I won't comment it until you fix the indentation error in the code sample
 
o.o ?
 
9:12 PM
@wim oops. copy/paste fail... fixed :P
 
9:39 PM
cbg
 
cbg
 
wim
welp, the coverage in new pycharm release is still slow as heck .. :(
 
it's 40x faster as something that's (1/0.6)x slower though
or something
your numbers may vary
 
You don't have to wait for python to compile, so they thought they'd give you a chance for a break with the coverage tool.
 
@AndrasDeak that's the debugger, not coverage ;)
 
9:50 PM
oh, right
 

« first day (2355 days earlier)      last day (2592 days later) »