I just called for...else the "en passant of python"
Conversation
Notices
-
Embed this notice
Merc (merc@fanimations.club)'s status on Thursday, 20-Aug-2026 08:51:14 JST
Merc
-
Embed this notice
Merc (merc@fanimations.club)'s status on Thursday, 20-Aug-2026 08:51:07 JST
Merc
@kirby ```python3
def better_for_loop[T](it: Iterable[T], fin: Callable[[], None] = lambda: None) -> Generator[T, None, bool]:
Citation for subscriptable functions notation: https://discuss.python.org/t/pep-718-subscriptable-functions/28457
if not it:
return False
yield from it
fin()
return True -
Embed this notice
T man :sex: :puffgiga: :puffpowerroll: (theorytoe@ak.kyaruc.moe)'s status on Thursday, 20-Aug-2026 08:51:07 JST
T man :sex: :puffgiga: :puffpowerroll:
@Merc @kirby
is that a fucking python genericIn conversation permalink -
Embed this notice
Merc (merc@fanimations.club)'s status on Thursday, 20-Aug-2026 08:51:08 JST
Merc
@kirby "breaking change" so what nigga who the fuck uses this anyways.
from future import for_else_is_finally
In conversation permalink -
Embed this notice
Merc (merc@fanimations.club)'s status on Thursday, 20-Aug-2026 08:51:09 JST
Merc
@kirby This is stupid. Make for...else for if the iterable evaluates false (if there's a for _ in x...else, have that be syntactic sugar for if x for _ in x... else), then use finally. You'd need to decide if the finally would trigger even if the for loop returns (I would make it so), though.
In conversation permalink -
Embed this notice
Merc (merc@fanimations.club)'s status on Thursday, 20-Aug-2026 08:51:10 JST
Merc
@kirby I'm not retarded, that should be the intuitive understanding of it. Its iterable was empty, so it evaluates to false (unless you did something stupid), so the else triggers
In conversation permalink -
Embed this notice
Merc (merc@fanimations.club)'s status on Thursday, 20-Aug-2026 08:51:11 JST
Merc
@kirby I figure it's rare but if it's an option you gotta do it for the meme
In conversation permalink -
Embed this notice
Merc (merc@fanimations.club)'s status on Thursday, 20-Aug-2026 08:51:11 JST
Merc
@kirby fuck I looked it up, I thought the else only triggered if the for loop was empty
In conversation permalink -
Embed this notice
Kirby (kirby@fanimations.club)'s status on Thursday, 20-Aug-2026 08:51:13 JST
Kirby
@Merc not a terrible description. it probably is an afterthought
In conversation permalink -
Embed this notice
T man :sex: :puffgiga: :puffpowerroll: (theorytoe@ak.kyaruc.moe)'s status on Thursday, 20-Aug-2026 08:53:52 JST
T man :sex: :puffgiga: :puffpowerroll:
@Merc @kirby
>C[int]().method[str](0, "")
>char (*(*x())[5])()In conversation permalink -
Embed this notice
Merc (merc@fanimations.club)'s status on Thursday, 20-Aug-2026 08:53:53 JST
Merc
@theorytoe @kirby https://discuss.python.org/t/pep-718-subscriptable-functions/28457 I read the fucking forums this has Guido's blessing
In conversation permalink Attachments
-
Embed this notice
T man :sex: :puffgiga: :puffpowerroll: (theorytoe@ak.kyaruc.moe)'s status on Thursday, 20-Aug-2026 08:54:17 JST
T man :sex: :puffgiga: :puffpowerroll:
@pwm @Merc @kirby
py "five trillion morbillion features" thonIn conversation permalink -
Embed this notice
pwm (pwm@darkdork.dev)'s status on Thursday, 20-Aug-2026 08:54:18 JST
pwm
@theorytoe @Merc @kirby it's the type hint syntax for it yeah In conversation permalink -
Embed this notice
T man :sex: :puffgiga: :puffpowerroll: (theorytoe@ak.kyaruc.moe)'s status on Thursday, 20-Aug-2026 09:00:00 JST
T man :sex: :puffgiga: :puffpowerroll:
@pwm @Merc @kirby
NUTZIn conversation permalink -
Embed this notice
pwm (pwm@darkdork.dev)'s status on Thursday, 20-Aug-2026 09:00:01 JST
pwm
@Merc @theorytoe @kirby bolton these In conversation permalink -
Embed this notice
Merc (merc@fanimations.club)'s status on Thursday, 20-Aug-2026 09:00:02 JST
Merc
@pwm @theorytoe @kirby Not everything, sigh
https://boltons.readthedocs.io/en/latest/
https://grantjenks.com/docs/sortedcontainers/
uhhhhh I guess pandas and numpy too. And pyyaml. Maybe pillow.In conversation permalink Attachments
-
Embed this notice
pwm (pwm@darkdork.dev)'s status on Thursday, 20-Aug-2026 09:00:03 JST
pwm
@theorytoe @Merc @kirby batteries in fucking cluded In conversation permalink -
Embed this notice
Merc (merc@fanimations.club)'s status on Thursday, 20-Aug-2026 09:00:55 JST
Merc
@theorytoe @kirby You can do shit like l = list[T]() and I think that's pretty sexy but the people here hate it.
In conversation permalink T man :sex: :puffgiga: :puffpowerroll: likes this. -
Embed this notice
T man :sex: :puffgiga: :puffpowerroll: (theorytoe@ak.kyaruc.moe)'s status on Thursday, 20-Aug-2026 09:01:28 JST
T man :sex: :puffgiga: :puffpowerroll:
@Merc @kirby
I mean im the one to talk considering half of my pet project is fucking genericsIn conversation permalink Attachments
-
Embed this notice
Merc (merc@fanimations.club)'s status on Thursday, 20-Aug-2026 09:04:23 JST
Merc
@theorytoe @kirby I should just start writing in Cython and see if people tell me to fuck off
In conversation permalink -
Embed this notice
T man :sex: :puffgiga: :puffpowerroll: (theorytoe@ak.kyaruc.moe)'s status on Thursday, 20-Aug-2026 09:04:23 JST
T man :sex: :puffgiga: :puffpowerroll:
@Merc @kirby
idk man the concept of a generic in python seems way more stupid than in a statically typed languageIn conversation permalink -
Embed this notice
Merc (merc@fanimations.club)'s status on Thursday, 20-Aug-2026 09:07:16 JST
Merc
@theorytoe @kirby I think it's useful to say 'whatever type this is, if it occurs here, it will also occur here'
If you're getting to more complicated shit like 'whatever type this is, a subtype with __open__ defined on it will occur here', you are going to hell you are going to hell you are going to hell you are g
In conversation permalink T man :sex: :puffgiga: :puffpowerroll: likes this. -
Embed this notice
T man :sex: :puffgiga: :puffpowerroll: (theorytoe@ak.kyaruc.moe)'s status on Thursday, 20-Aug-2026 09:08:53 JST
T man :sex: :puffgiga: :puffpowerroll:
@Merc @kirby
fair, but even then considering you can just have shit happen if you dont specify types its like why have a generic when T is TIn conversation permalink Attachments
-
Embed this notice
T man :sex: :puffgiga: :puffpowerroll: (theorytoe@ak.kyaruc.moe)'s status on Thursday, 20-Aug-2026 09:09:52 JST
T man :sex: :puffgiga: :puffpowerroll:
@Merc @kirby also did not intend for the second case to be the way it is In conversation permalink -
Embed this notice
T man :sex: :puffgiga: :puffpowerroll: (theorytoe@ak.kyaruc.moe)'s status on Thursday, 20-Aug-2026 09:10:56 JST
T man :sex: :puffgiga: :puffpowerroll:
@Merc @kirby like who the fuck even cares anymore In conversation permalink Attachments
-
Embed this notice
T man :sex: :puffgiga: :puffpowerroll: (theorytoe@ak.kyaruc.moe)'s status on Thursday, 20-Aug-2026 09:12:14 JST
T man :sex: :puffgiga: :puffpowerroll:
@Merc @kirby turns out me being retarded didnt change anything In conversation permalink Attachments
-
Embed this notice
Merc (merc@fanimations.club)'s status on Thursday, 20-Aug-2026 09:24:48 JST
Merc
@theorytoe @kirby I do wish giving type annotations was syntax sugar for having asserts that it is that type :P
In conversation permalink T man :sex: :puffgiga: :puffpowerroll: likes this. -
Embed this notice
T man :sex: :puffgiga: :puffpowerroll: (theorytoe@ak.kyaruc.moe)'s status on Thursday, 20-Aug-2026 09:28:48 JST
T man :sex: :puffgiga: :puffpowerroll:
@Merc @kirby
i mean to be fair this is why I dont write production code in pythonIn conversation permalink
-
Embed this notice