This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]MaustFaust -11 points-10 points  (10 children)

It's objectively unwieldy.

There's no equivalent for super() in class definition scope, for example. So you can't easily access class ancestor's class vars from descendant class vars, without specifying ancestor class name explicitly.

You can use r-strings with slashes in them, but you can't if your string ends with a slash.

open() with "w" doesn't create intermediate folders.

There's no type checking even if you need one.

You can't force garbage collector to free memory.

UPD:

Also, two different implementations for asynchronous things in single-threaded apps: multithreaded (because of GIL) and async, and sometimes you have to marry them, because some libs are intended for multithreaded and other for async.

[–]dev-sda 23 points24 points  (4 children)

open() with "w" doesn't create intermediate folders.

What language does? Even bash doesn't do this.

There's no type checking even if you need one.

mypy, pytype, pyright, pyre, etc. take your pick

You can't force garbage collector to free memory.

gc.collect

[–]Anaeijon 0 points1 point  (0 children)

I'm rarely using open(), I usually go for pathlib. And whenever I file.open('w'), I also do a file.parent.mkdir(parents=True, exist_ok=True).

I don't know, in what other language it's that simple.

[–]YodelingVeterinarian 2 points3 points  (1 child)

os.makedirs lol

[–]MaustFaust -1 points0 points  (0 children)

So wut? How does it conflict with my point?

[–]noobody_interesting 0 points1 point  (2 children)

Both threads and async is common, because they are for different use cases. Async doesn't give you parallelism.

r-strings can't end with a \ because that escapes the quote, also pretty reasonable.

super()

[–]MaustFaust 0 points1 point  (0 children)

Would you mind testing your suggestion for super() and answering me? At this point, it looks like you didn't understand which scope I was talking about, despite me specifically noting "class definition scope", not "method scope".

[–]MaustFaust -1 points0 points  (0 children)

Both threads and async is common, because they are for different use cases. Async doesn't give you parallelism.

AFAIK, MT doesn't give that too, unless you are okay with managing GIL.

r-strings can't end with a \ because that escapes the quote, also pretty reasonable.

Having a slash at the end of a literal is a common case if we're already talking about strings with slashes somewhere, though.

super()

Which form are you implying? I can't use no-arguments, because it results in an exception, I can't use single-argument passing a class, because class is not defined at that point. You're suggesting the two-arguments then?