Elektrine lite

← Feed

@eliocamp@mastodon.social

Post #2273820

2026-05-07 22:38 UTC

@pvanheus@mstdn.science the list.files() is the same as os.listdir() function in python. Except that can return full paths with an argument, obviating the need for using for loops or convoluted list comprehension expressions to join back the basedir.

Replies (1)

  • @pvanheus@mstdn.science 2026-05-08 19:40

    @eliocamp@mastodon.social this is exactly what I mean: there's a parameter to the function that changes its behaviour, meaning that I need to remember which functions have these special parameters. In Python I need to learn that there's a language construction (a loop or a list comprehension) that can take a list (or anything iterable) and filter it into another list. It is more verbose but more general.

    Open ##2273821