Post #2273810
2026-05-07 08:30 UTC
@jimgar@hachyderm.io @eliocamp@mastodon.social
That is true.
Personal opinion: I don't like list comprehensions. Mostly because they allow the constructions of foot guns and people then saying "see, python is so complicated".
The (imo) correct solution is to:
def get_cwd_files():
my_files = []
for filename in os.listdir():
my_files.append(f"{os.get_pwd()}/{filename}")
return my_files
And then just use that function.
get_cwd_files()
But... (1/2)
Replies (1)
-
@bmaxv@noc.social 2026-05-07 08:36
@jimgar@hachyderm.io @eliocamp@mastodon.social ...what are we doing here? I feel silly if I'm telling someone in a university teaching position that functions and encapsulation exist. That's a five line function. Not being able to find a better solution than a list comprehension doesn't show me a willingness to experiment I would expect. It's not a serious argument. It's fine to not like something. I don't care. What irks me is implying scientific authority and then showing a lack of... openness for the thing.