« first day (2174 days earlier)      last day (2999 days later) » 

20:00
@Augusta finally happens always*
I think it's come up once for me, in a map editor I made, to save my progress when my shitty code invariably explodes on me.
Quite handy for cleanup operations when there isn't an appropriate with clause, I suppose
with is basically just a shorthand for finally
@WayneWerner I thought so (I mean, hence the name, right?). But the thing is, my generator never really leaves its for loop.
So it would never leave the try block.
@Augusta at some point your program quits, right? The finally is going to happen there
20:01
Bug report: my python program failed to execute a finally block when it was struck by lightning. Steps to reproduce: wait for a rainstorm...
import sys

try:
    sys.exit(0)
finally:
    print('yay')
@Kevin I know this guy, Nicola, says he can get you lightning from anywhere. Good guy; I'll put you in touch.
for example. That will print yay
I haven't heard from him in a bit, though.
Well yeah, but the thing is that, by the time the program quits, it'll be too late.
I'm worried that it'll spend its entire time running accumulating inexhaustible but inaccessible generators.
Which is not a thing I expect is liable to happen, or someone'd have caught it by now.
@WayneWerner os._exit(1)
20:04
Realized I used the same example twice in my comment. I'll justify it with "it's to check if the op can remain internally consistent".
@AnttiHaapala Yeah, my * on the other post linked chat.stackoverflow.com/transcript/message/33152980#33152980 ;)
@Augusta I don't suppose you could do self.gen = None; return?
If a generator is running, and but there are no attributes that reference it, does it get collected?
@Kevin I was going to use break and then deal with the StopIteration.
But this got me wondering, so.. <_<;
(Generators can't return, can they? Only yield and stop.)
20:05
I haven't looked at the specs but I think the rule is "no return statements with arguments"
@Augusta the running generator is its frame.
return 23; bad, return; good
@AnttiHaapala ooooh shit I think I'm about to learn a new term! :0
Be. Right. Back.
>>> def foo():
...     yield 5
...     return 42
...
>>> foo()
<generator object foo at 0x7f01c5766f10>
>>> x = foo()
>>> next(x)
5
>>> next(x)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
StopIteration: 42
fun fact: if I have a program with 2 constants, they are almost invariably 5 and 42. 42 is self-evident as being my age less almost a decade; but the 5 I do not know where it comes from.
Five is 3 (a universally obvious number, like-- but less than-- 42) plus two (the number of constants).
20:09
to prove my point, the above excerpt was exactly the 2nd time in this chat that I used 5 and 42 together!
@Augusta try this
import gc

def mygen():
    print('hi')
    try:
        while True:
            yield 42
    finally:
        print('collected')

m = mygen()
next(m)
m = None
print('collecting')
gc.collect()
print('done')
as an exception to the rule I've once used 42 with 666.
(mine actually collects before I have to tell it to)
Without the call to next(m), though, it never collects
@Augusta remember, there is no guaranteed collection behaviour
but it also never prints('hi')
20:10
also, __del__ is not guaranteed to be called
@AnttiHaapala Is this Py2 or 3?
always 3 for Antti
Thought so.
>>> def gen():
	yield 10
	return 20
SyntaxError: 'return' with argument inside generator (<pyshell#269>, line 4)
>>>
@Augusta ObsoletePythonException, line 3, in Augusta's chat msg
Shareef didn't like it.
v( o_o )v
20:13
shareef?
who's that
Aw, you don't know The Clash? :0
What exception is thrown when a coroutine is collected?
GeneratorExit
@Augusta I wonder if I would like that song nearly as much without TFC
Also just learned that I've been thinking Crossover2 was called Casbah for the longest time :P
@WayneWerner huehue :y
20:31
@MorganThrapp there's stackoverflow.com/jobs/123612/… if you want to work for braintree and you like docker and devops
DSM
DSM
Aww, I missed a chance to show my reference-getting skillz. Because I knew who Shareef was. :-(
@DSM that's what happens when you do actual work.
DSM
DSM
PSA to all API writers: please take the extra few hours so that if you offer different versions of an API, they all have the same functionality to the degree that makes sense.
@WayneWerner: I'll try not to make that mistake going forward.
TIL (because my daughters are crazy, or susceptible to mind control) that My Little Pony has something called the Friendship Games, which is a parody of the Hunger Games
I assume there's less killing each other though.
@WayneWerner Yeah, I applied to one of their other jobs.
20:39
Good luck :)
Thanks. :) Seattle is still on the top of my list of places to relocate, but CA would be cool too.
Also, Canadians, this movie title makes me very happy, so thanks for that.
Aw, no one boxing for IMDB?
@JonClements watch this if you haven't already! (brillint imo)
21:10
hey guys, is there any way for another program to detect the difference between this:

import win32api, win32con
win32api.mouse_event(win32con.MOUSEEVENTF_LEFTDOWN,x,y,0,0)

and a real click?
Maybe. But it would be hard to do
hard meaning NSA level?
@Pigman
rbrb all
I tried making a bot for a game with an anti-cheat program and I could not use win32api calls
21:12
rbrb
so they can detect the difference
which game was that if i may ask?
because ive got the same issue
@doublefelix
hmm, the program they used was I think called gameguard... somehow I'm forgetting the game's name
I will find it now
ah ok
oh! Blade and Soul was the game.
21:14
oh ok thanks :)
runescape for me :P
np
I'm having a problem with this scenario: functionA assigns variable a=something. Inside functionA, functionB is called with no parameters. functionB creates a new variable b=a. I get a NameError because a was only defined within functionA. I had been hoping/thinking that nested functions keep the namespace of their "parents".

Do I really have to make 'a' a parameter of functionB in order to read (not write) its value?
I'm not sure if interrupts work at a lower level than win32api
but if they do, then they're probably reading the mouse/keyboard themselves that way, rather than letting Windows report the mouse
functionB is called or defined ?
@doublefelix yes
DSM
DSM
It might be easier to discuss with a concrete example. Show, don't tell.
(For example, the phrase "nested functions" has a particular meaning, and it doesn't sound like your functions are actually nested.)
21:23
indeed
>>> def fa():
...     a = 1
...     def fb():
...         b = a
...     fb()
...
>>> fa()
>>>
no NameError here
maybe he meant this though:
def fa():
    a = 1
    fb()

def fb():
    b = a
I dislike the fact that you can access a in fb
DSM
DSM
@TomasZubiri: I don't mind it. It makes certain kinds of thing very convenient, and if you don't want it, you can always just not nest the function in the first place.
(which is "nested", and I guess some new developer could be confused by not being able to access a.)
I meant the second example you wrote, @FlorianMargaine
so in that example, the easiest solution is to just change the signature to fb(a)?
yes, and to call fb(a)
21:26
I ask because my innermost-functions will start to get really wordy, with lots of arguments
DSM
DSM
Then if it worked the way you wanted, @doublefelix, that sounds like a recipe for disaster. If you write a lot of small functions, you could have dozens of names bound along the call tree, none of which are easily inspected.
the correct solution
ok, got it. Thank you :)
DSM
DSM
End-of-day rhubarb for all!
@doublefelix that's usually a sign you're doing something wrong, but go with that for now
21:29
It sounds like you should make a class
Where did you hear that sound?
@KevinMGranger if he's having this kind of trouble, let's not confuse him with more concepts
Is daily reporting (like stand up meetings, or daily status reports) considered harmful?
As unarguably as gotos are considered harmful?
gotos are not unarguably considered harmful
21:54
@AndrasDeak and Shog also did a mammoth job on rescuing that question from certain defeat by downvotes.
:)
I only saw his comment and the black-and-green revision history:D
bah, I meant red-and-green, of course
"Since we can't take it out until Go 2" ...which, as everyone knows, will never happen because Go 2 is considered harmful. — Mason Wheeler 6 hours ago
(relevant...)
what's go 2?
oh, Go language
Have I mentioned how much I hate the close grace period?
22:18
@AndrasDeak removed the tell-tale voting hint you left there ;-)
Thank you....although I could've cropped that if I gave a poo:P
and the answer is deleted now:)
22:35
users are the worst
wim
wim
23:06
stackoverflow.com/q/39758921/674039 user uses enumerate to get an index while iterating a sequence, then uses it to index the sequence inside the iteration .. facepalm
dailymail.co.uk/news/peoplesdaily/article-3803748/… Looks exactly like the police bot in fallout! It's happening!
wim
wim
I could not imagine anything less sophisticated than,

for i in range(len(thing)):
thing[i]

but, there it is ..
indentation error
yeah but you have to make that more pythonic now. More pythonic means to cram it one line right?
for i in range(len(thing)): thing[i]
there you go, @idjaw ^
23:10
So sexy
And what is your question? — Andras Deak 17 mins ago
And what is your question? — Andras Deak 2 mins ago
wonder when OP will catch on
you ruined it, Canadian
I'll keep my snark campaigns to myself next time:P
Captain Canuck to the rescue
Swarming in with politeness sprinkles everywhere
23:33
did you guys see this one: stackoverflow.com/q/39753082/541038
speaking of pythonic
Bwahaha turns out the bug I've been scratching my head about for two weeks is due to a bug that's been around for probably 10 years, and not recently broken by me. Hahaha. Ha. Ha. *curls up and cries*
DSM
DSM
That'll learn you to blame appropriately..
For once I display some humility, and this is what I get.
I mean, surely I made a mistake somewhere, right?:P
DSM
DSM
23:49
You did. It was just in debugging procedure, not in coding. :-)
wait ... so what if its been around ... you should probably fix it no?
DSM
DSM
If a bug has lived that long I think it's earned its freedom.
5

« first day (2174 days earlier)      last day (2999 days later) »