Skip to content
Minsing Log
Go back

English Edition

list comprehension in functional style

Programming & CS

Situation

Previously, I had only seen nested for loops in list comprehensions used to create two-dimensional lists.

However, I recently came across a nested for loop that passes the elements contained in a list to a function and stores the return values in a list. I thought list comprehensions were quite interesting.

exist_metrics = [modified_metric_name
                         for metric_name in ragas_metric_names
                         for modified_metric_name in text_modifier(metric_name)
                         if modified_metric_name in self.metrics]

공개 여정 구독

글이 올라오면 이메일로 보내드릴게요.

개발, 창업, 배움, 실패와 회고를 짧고 솔직하게 기록합니다. 검색으로 스쳐가는 독자가 아니라 여정을 따라오는 팬을 만들기 위한 뉴스레터입니다.

뉴스레터는 준비 중입니다. 그동안 RSS 로 구독하거나 이메일 로 알림을 요청해 주세요.


Share this post:

Comments

Sign in with GitHub to leave a comment.


Previous Post
What Are Synchronous and Asynchronous?
Next Post
When should you use static methods?