« first day (3809 days earlier)      last day (1143 days later) » 

12:05 AM
^^ A grim tale of numerocannibalism
 
 
4 hours later…
4:33 AM
thanks Arne and Andras (intentionally not @-ing you to avoid notification spam). I turned out to be able to pip install pipenv && pipenv install --system, which accomplished what I was after. pipenv shell being interactive and all, I was unable to pipenv's python in my on-push smoke tests via github actions
pip install <pipenv stuff> would have solved that. pipenv install --system ultimately did
 
 
3 hours later…
7:38 AM
@AnttiHaapala You mean it isn't currently finished (the listing does say "July 28, 2021"), or will likely never get finished?
 
8:07 AM
@roganjosh Do you have a link to DaBeaz' presentation? I know him for a "you don't need it unless you really need it" stance, and most people don't really need it.
 
8:20 AM
well it has been listed as "shall be released in 3 months"
om Amazon since 2008
 
If I had to sell async, I'd probably market it as "sane concurrency" – interactions between tasks are much better structured and easier to comprehend. That again is something that most people don't really need, since most desirable concurrency is trivially parallel; e.g. in the case of web frameworks, you usually do not want one request to interact with any other.
 
8:53 AM
@MisterMiyagi it isn't sane at all.
there is much that is known about concurrency before the async stuff was ever written into Python...
the reason why async exists at all is because of how CPython is written.
 
9:08 AM
I much prefer the explicit concurrency of async over the often inconspicuous primitives of threads. That is what I mean by sane.
@AnttiHaapala That is the part I don't get. greenlet seems to have little problem managed adding implicit coroutines (stackless, stackfull or whatever these are called) to CPython for ages.
 
9:22 AM
One of them was this but a quick jump through isn't showing any async def in his code. He's not critical of the async capabilities of python; he gives a totally objective overview but none of the numbers win out so it comes across somewhat deadpan that you don't win anything
It just feels odd as I go through the different presentations, almost like people are worried that someone important will flip their lid if you don't mention it but if it really was good, people would be singing praises from on-high normally, no?
The timings from Miguel were interesting with gunicorn though. I can't think why I wouldn't want to launch my server with gevent
 
TBH, I would have a hard time citing any unquestionably positive feature of async.
It's a tradeoff and for most tasks the gain isn't needed.
 
Ok, I think that settles it in my mind. You don't strike me as totally insane, so the fact that you do employ it and know so much about it, it must be giving you something in a very niche area. They've been working on getting Flask to support it and for a high-load application I've been weighing it up but I think the answer is "If you can't grok it, you most definitely don't need it"
 
9:40 AM
Agreed with everything but the insanity. :P
 
"strike me" does a lot of heavy lifting. :D
 
Well played, Sir. tips hat
 
10:31 AM
the whole async stuff is partly why I moved to rust
 
What have you swapped out from python into rust?
For example, I don't think I'd want to move my webapp out of Flask into rust for this since I think gunicorn and nginx can help me with the scale, and I think I'd lose a pretty big ecosystem of tools
I have been oggling rust for certain things, though. If I had the spare time I used to have, I want to weigh up cython vs rust properly but I currently have to get results out the door on daily deadlines so I can't spend time reviewing my options properly. I'm just being nosey over your usecase where you swapped-out and went to rust :)
 
Speaking of which, does anyone have experience using PyO3 for Rust+Python? How does it compare to Cython in terms of usability these days? I see they have added a few macros to simplify writing Python extensions.
 
10:55 AM
I am actually working out the basics with rust now, I find the whole type system to be much more robust, the error handling actually better, less worry about types blowing up my application.
My goal is definitely rebuild my webapp platform on top of rust, and since I've been given time I am taking advantage of that, and so far I am loving rust
and at some point I most certainly will be using PyO3 to bridge between my rust stuff with Python stuff that colleagues are working on, so when applicable I guess I can report back here
so in short, I've used sqlx to play with sqlite, and since that library already implemented using async, I can build on top of that. I especially like the compiler erroring on all the bad practices I picked up while doing async stuff on JavaScript, such as lack of proper closures on inside/outside values.
 
@MisterMiyagi no you're still wrong, you're limited in your mind by the horrendous thing that async is :D think about it if you needed to coordinate your breathing with your friends...
see any problems with that :D
@MisterMiyagi the reason why async exists is the same as why it exists in javascript, single-threadedness.
but even then the problem is that not only is async wrong, but also asyncio is wrong if you compare to trio or curio
people are so oblivious for really ugly hacks being employed and them thinking it is "nice".
142
A: What is the core difference between asyncio and trio?

Nathaniel J. SmithWhere I'm coming from: I'm the primary author of trio. I'm also one of the top contributors to curio (and wrote the article about it that you link to), and a Python core dev who's been heavily involved in discussions about how to improve asyncio. In trio (and curio), one of the core design princi...

> Trio's way of managing timeouts and cancellations is novel, and I think better than previous state-of-the-art systems like C# and Golang. I actually did write a whole essay on this, so I won't go into all the details here.
> But asyncio's cancellation system – or really, systems, it has two of them with slightly different semantics – are based on an older set of ideas than even C# and Golang, and are difficult to use correctly. (For example, it's easy for code to accidentally "escape" a cancellation by spawning a background task; see previous paragraph.)
people even don't know how to write asyncio code :D
@Ginko Unfortunately that's not really an implementation of Happy Eyeballs. You don't cancel other tasks when one completes successfully; you don't handle the parent task being cancelled; you don't expedite the next connection if the previous one finishes early... there's a happy eyeballs in asyncio here, and you'll see it's way more complicated than that: github.com/twisteroidambassador/async_stagger Or just watch the talk, it walks through the details :-) — Nathaniel J. Smith Sep 11 '19 at 5:54
 
11:21 AM
@AnttiHaapala Not sure if I am just missing a joke here. I do regularly need my code to coordinate very basic things.
@AnttiHaapala That seems like a reason to have coroutines, but not necessarily user-code level async. Inbuilt coroutines like greenlet seem to solve the problem just as well, with none of the usability cost.
FWIW, I very like trio's approach to structured concurrency, and it's the major thing were I will say an async API is lightyears ahead of sync/thread/process APIs.
 
11:49 AM
I haven't used Erlang myself, but those who have, say it it is beyond belief how superior Erlang VM is to any other concurrency mechanism...
like that usually in Python you'd need to debug why your system does not work...
 
The Erlang VM was certainly more pleasant than the language itself. :P
 
and their Erlang system behaved differently, it was so fault tolerant that it didn't crash even though they didn't know why :d
so they spent time debugging why it did work :D
 
If you put it like that, it does not sound like a selling point. :D
 
well, I'd rather figure out why my system works than
why it doesn't work :D
 
when you say it works, is it "working and giving the desired result, and you don't know why", or more along the lines of, "it works, but i dont think it should, but additionally, it may break and i wouldnt get to know immediately"
because as an outsider looking in, this, if latter, sounds like a really terrible thing, haha
 
12:07 PM
I'm just reading through the Erlang wiki and it's hard to tell whether the fault tolerance really is such a bad thing
 
Wait... that's not a sketch?
 
it is not a sketch.
 
"Hello Robert. I think you managed to fix a bug". "Yes, finally". I think Robert's expressionless response is the origin of <screaming internally>
I didn't think it could get any better until the tune at the end :)
 
Joe is Joe Armstrong, R.I.P.
 
12:58 PM
You Can't Believe it's Not a Sketch, now with added Omega 3
 
anyway that video was made in 1990. So what you get in 2021 is that someone has come up with a system that is harder to program than Erlang, where any bug can cause system to halt and you always need to restart the entire system to recover from anything...
and people are saying it is "really good" :D
mind you the async exists only to make solving those "problems" "possible" that are easier to solve with Erlang
 
1:50 PM
: (
 
 
2 hours later…
3:33 PM
pattern matching doesn't do anything like "match the beginning of string" right?
must do with guard :F
 
4:04 PM
i am not able to understand the irc module's documentation pypi.org/project/irc , so anyone knows how to print msgs from an irc channel to the console
 
@Praveen see the testbot example therein
 
i saw it, its cluttered
i am not able to understand it
 
it is not. it is the on_pubmsg
obviously this does "commands", so you'll remove do_command and call to it,
you won't support dcc so you'll remove the dcc methods
and since you just want messages from a channel, you'll remove the private chat option too.
so if you do those changes then there's lot less code to try to understand :P
 
ohhh i will try it
 
user13727121
4:51 PM
This is a silly question, but must I name my function with a verb?
 
It doesn't even have to be actual words. But naming it in such a way that its behavior is naturally implied will help maintain your understanding of what it does, and why you wrote it the way you did. Also, if you find that you name your function do_this_thing_and_that_thing_too_but_first_check_something_else, you may have packed too much in there.
Functions that return bools are good to name is_xxxx where "xxxx" is the thing that the function tested. (I believe in Ruby such functions are actually named with a trailing '?'.)
If your verbs are "get_xxx" and "set_xxx", you might want to consider defining them as an xxx property.
 
assuming there's a class involved (i.e. they are methods)
 
True - my OO-ishness is showing.
 
@CoreVisional since functions methods usually do something then they should often be verbs...
if they weren't verbs, they probably would be nominals, but why?
 
5:20 PM
I'd add that there are a bunch of idiom-like exceptions. If there were a function like def find_difference(source, target), I'd just call it def diff(source, target)and assume that any reader of my code is familiar with what a diff is, even if it's not a proper verb.
so what I'm trying to say is, that a function should always communicate clearly what it does. Usually that'll mean it's a verb, but there is no reason to get dogmatic about it as long as the intent is clear
 
@CoreVisional ^ those that do not have verbs usually calculate and return the nominal
that is because after all, functions in programming languages were originally modelled after those in maths and there functions are nouns.
 
user13727121
okay it took me a while to soak in all these, I was thinking it as function presents actions, that's why it's a good thing to use verb to name my function?
 
reminds me of one of my pet-peeves: functions with names like do_x or calculate_y. I bet there are cases where they can make sense, but as of now I've only ever seen it as a canary of bad modularization- and naming-decision.
 
user13727121
@PaulMcG I find myself using and, such as assigning multiple values to the variables inside my function and return them both, so I'd name my function something like set_x_and_y
 
user13727121
5:41 PM
@PaulMcG defining them as property? Not sure what you mean by that so I looked it up, it's about using it in Python class, which I haven't reach that lesson yet.
 
user13727121
@Arne is there like a word limit for the name, like less than 8 or 4 exactly?
 
> there is no reason to get dogmatic
that being said, if you ever happen to work with me you'll catch flak for anything with more than 12 characters
;-)
 
user13727121
@Arne lol that's like 2 words max. How about this example, I know I should not get dogmatic about it, just want some feedback about this kind of function name
 
user13727121
def set_user_attempt_and_limit():
    attempt = 0
    limit = 3
    return [attempt, limit]
 
sounds like a setup function for some kind of state to me, so user_setup sounds good
> 12 characters ought to be enough for anybody. -- Bill Gates
You shouldn't really listen to me though, curtness is a personal preference of mine due to working in a php shop where functions get really wordy most of the time
 
user13727121
5:57 PM
@Arne nah I was looking up the technical term of the word "state" because I sure as hell thought you meant the general definition of "state". Anyway, the user's not setting anything up, attempt refers to the number of times the user attempts the game, and limit, well, it refers to the number of times user can attempt the game.
 
user13727121
and so I thought naming it that way might somehow communicate clearly as to what the function does
 
@CoreVisional Is there any reason why these two value come from a function?
Seems more like these should be some global constants, or read from some configuration.
 
user13727121
@MisterMiyagi No reason really, I'm using it as a practice to return multiple values and unpack it in another function
 
user13727121
@MisterMiyagi is it still a constant if I increment one of the values in another function?
 
@CoreVisional Integers are immutable, so the value itself will always be a constant. Whether the name is a constant depends on whether you ever write to it – e.g. via +=.
 
user13727121
6:18 PM
@MisterMiyagi Okay, but I wrote it as attempt += 1 in another function, it's still immutable?
 
6:43 PM
@CoreVisional if you haven't done so already please read and understand nedbatchelder.com/text/names.html
 
 
3 hours later…
9:35 PM
@AnttiHaapala Ah, "T+4 months"
 
10:06 PM
@roganjosh Developers are just as prone to the sunk cost fallacy as anyone else.
 
That's unfortunate. If it's actually broken then people should be able to bang some drums about its failings, not sorta brush it off. I thought the community was a bit more vocal on these things. If it's just gonna get platitudes as a feature then something feels off
I hasten to add that I don't consider myself an expert in this field so maybe my reading is off. I've just seen multiple presentations where asyncio seems to get derailed and then the presentation ends on something else and it feels weird
 
@roganjosh dabeaz wrote curio because asyncio was b0rken
 
I've also since watched the presentation of trio which seemed a bit more direct about the issues with asyncio :)
 

« first day (3809 days earlier)      last day (1143 days later) »