« first day (3386 days earlier)      last day (1556 days later) » 
01:00 - 21:0021:00 - 00:00

9:06 PM
@AndrasDeak and?
 
and all the other (alternative) implementations try to keep up
Some better than others...jython less so.
 
whats the best?
 
haskell
 
lol
 
@SebastianNielsen No. The spam flag should only be used for actual commercial spam: stuff designed to make money. Valid spam flags cost the spammer 100 points of rep, and repeat offenders get their accounts deleted. Accounts created purely to post spam are nuked on sight.
 
9:09 PM
It also reads that you should use the spam flag whenever an answer only consists of a link.
 
I doubt that
link-only answers need the "not an answer" flag
 
@Permian because the gil isnt as big of a deal as people who dont know much about it think it is, and the upsides are never really mentioned much, but are there. Also, jython in particular is so far behind the curve its not even funny.
 
Yeah, that wasn't completely the case with that answer, I'll agree with you on that.
But it was close to being a "link-only" answer though
 
@ParitoshSingh i thought the gil slowed everything
 
@SebastianNielsen you are completely missing my point
 
9:10 PM
ruined concurrency
 
you thought wrong.
 
Uh, sorry, I got it now
You wanted me to flag it as something else then
 
very good
But since it's a 200k-rep user you might want to ask them to update their answer with an answer first. You know, assume good faith.
 
It's easy to throw around the term concurrency, but how often is your code even concurrent? And when it's concurrent, how often is gil a deciding factor in the speed of the code? There's a lot of scenarios where the gil is actually released too.
It really isn't as bad as people make it out to be. And the gain in single threaded code is often never even discussed
The main reason GIL exists is that doing without the GIL was proving too costly in terms of single threaded performance.
 
how do you write concurrent code in python?
truly concurrency
 
9:13 PM
Uh, you just write it. It's not anything special, there's multiprocessing and stuff
But see, that's the point. If we're talking about how do we even write concurrent code, why are we bashing on the GIL?
 
@ParitoshSingh the threading module in pyton isnt true concurrency
 
well it was bound to be a pointless debate from the start :P
@Permian nobody said that it is
 
@ParitoshSingh learning sake
 
Correct, regarding threading.
 
so what do you use?
 
9:15 PM
multiprocessing. processes
 
not true
 
@Permian numpy. It's all the concurrencies.
 
thats not cpu level
 
Alternatively, you go what python does best
 
you need a new cpu
 
9:15 PM
@Permian please stop right now, this is no longer entertaining
 
for every process
 
@Permian You are bringig here weirder notions each day, and won't even accept answers. Go ask elsewhere where you get the answers you expect.
 
I've been wondering about a codestyle for quite some time...
 
@paul23 what do you mean?
 
Hey, @paul23!!
 
9:17 PM
@AndrasDeak at me?
 
try:
    statementthatmighterror
    rest
except:
    test
is there ever a use for above versus:
 
@Permian yes; updated for clarity
 
im not being controversial
 
try:
    statementthatmighterror
except:
    test
else:
    rest
 
i have another one
 
9:18 PM
@Permian no, you're being pointlessly argumentative (with, frankly, missing domain knowledge)
 
or is the latter the actual "no default and only used if rest might give the same exception".
 
for python distributed systems what messaing protocols do you use?
@AndrasDeak im trying to learn
 
@paul23 so this is generally always considered a bad practice. you want to put the smallest amount of code possible in a try block
 
@Permian Those questions depend on the host. When trying to be as crossplatform as possible I'd use some form of tcp/ip. (http probably). On nix systems there's always the direct communication protocol etc.
 
And of course bare except: should very likely be except SomeException:, or at least except Exception:
 
9:21 PM
@paul23 this variant i'll admit i haven't seen much. But if the rest portion requires the try block to run without errors but mustn't run if the exception is raised, this would be your weapon of choice then.
If the rest part of code does not have such a restriction with regards to the error being raised, then you can just keep it un-indented after the try except block is finished.
 
or in the vastly common use case where the except block terminates execution
 
Isn't that quite common? When the former function returns a value/data that is used in rest. Without exceptions you'd have to test against the data being None or something.
 
@paul23 is that a message broker or rest?
 
what?
 
the form of tcp/ip
 
9:24 PM
Just to note: only catch exceptions that you can handle in that scope (or to re-raise with more info.)
 
I suppose it might be common in library code maybe, just personally haven't seen it much. Usually code i encounter tends to "skip to next iteration" if an error is raised and just dump whatever work was done for that particular file.
 
And I tend to isolate the scope of the try/except/else to be able to identify specifics but only where it matters...
 
I dont see much point in using an else clause with try, unless the try needs a finally clause, so you can have the else stuff before the finally stuff. Otherwise, just put the stuff that's in the else after the whole try block. See stackoverflow.com/q/855759/4014959
 
hmm that's in direct contrast to "so this is generally always considered a bad practice. you want to put the smallest amount of code possible in a try block"
 
note that the genex is superfluous there, if it worked it would be equivalent to f'{*body}'
What do you want the result to be? ' '.join(body)?
 
9:30 PM
could use a join and construct your string if you wanted to
 
:48413207 You'd do things like ''.join(...)
 
Kevin'd. :P
 
I guess a join could do it yea
I don't know why I didn't think of that
that was stupid
 
lst = [1]
txt = 'testing'

try:
    return txt.index('z') + lst[1]
except IndexError as e:
    # I don't know if this is because of the list or string...
    # (but in this case I probably don't care - I just can't work with the input(s))

# If I did though...

try:
    idx_txt = txt.index('z')
except IndexError:
    # okay - something wrong with the string
    # can I do something here...?
    # if not re-raise or raise something more specific
try:
    value = lst[1]
except IndexError:
    # as above...
 
it's sometimes hard to recognize a screw when you have a hammer in your hand
 
9:31 PM
^^ slightly convoluted example
 
Meh I think the "infix" way is more expressive than join.
 
Now... return idx_txt + value could still raise further exceptions...
 
@JonClements yeah but working that way you'll get a very convoluted code: where, due to exception handling, you can no longer notice the actual business logic.
 
You use something bizarre like the above if you can do something to handle exceptions for the specific task you're performing... you don't have to care about the overall business logic - if you can't handle it - let it propagate to the caller that should know more about that... and it should let it propagate to its caller if it can't handle it etc...
 
Remember folks, errors are a good thing!
 
9:42 PM
errors that are caught handled are good - ones that cause a system exit aren't :)
although exiting is generally better than carrying on in a completely yammed up state :)
 
@JonClements not fun though :P
Errors that cause the famous pacman level made some legendary programs.
 
sys.exit(int.from_bytes(b'catch this', 'little'))
 
hehe... I remember the hours (and hours and hours) I spent playing Duke 3D with a mate on dial-up and some things were made amusing as we knew all the secret areas but not everyone knew the "wall glitches"... so someone would think there's safe, but if you knew the glitches, you could crouch down in the right place, angled correctly and then effectively skip through a wall right behind 'em while they were looking for you in the only route into the room :)
Anyway - what's @Kevin thinking he's doing not being about recently... I need someone to review some deck lists I've been playing with! :)
 
(un)related question, the return code in subprocess.CompletedProcess, is that of integer or string type?
 
9:57 PM
success codes for every OS I know of is always a signed integer
 
10:08 PM
Hmm should I delete this question? At the time I though the issue had something to do with tkinter running in a thread, but turned out I just forgot to start the actual thread lol.
It is seriously so sad. ;_;
 
wim
@paul23 integer
@SebastianNielsen yes.
 
 
1 hour later…
11:40 PM
@JonClements That's something I've not been totally clear on with web servers. For example, if I get a 500 in gunicorn serving a Flask app, does the process/thread (depending on setup) just dump the error to the client and move on as though nothing happened or is there something that should be cleaned up?
My practical experience suggests the former in every case, but the traffic is probably too low on an intranet site to see some accumulating mess that bites back later on
 
01:00 - 21:0021:00 - 00:00

« first day (3386 days earlier)      last day (1556 days later) »