Using __import__() for the same package multiple times within the same line of code?

This page summarizes the projects mentioned and recommended in the original post on /r/learnpython

InfluxDB - Power Real-Time Data Analytics at Scale
Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.
www.influxdata.com
featured
SaaSHub - Software Alternatives and Reviews
SaaSHub helps you find the best software and product alternatives
www.saashub.com
featured
  • advent-of-code-one-liners

    🐍📅 One-line Python solutions for Advent of Code 2022 and 2023.

  • I know that title is scary. But just like last year, I'm trying to solve as many days of Advent of Code in a single line of Python as I can. Because of this restriction, I'm using __import__('re') so I can use RegEx in my solutions rather than using the import statement (since that would add an additional line). But this means I have multiple instances that look like __import__('re').findall(r'\d', l) within a single line (as seen here). My question is: what is the impact of this? Is it importing the module every time it is called, or is it considered fully imported after the first call and just referenced in future calls? Is there any other/better way of doing this?

  • advent-of-code-jq

    Solving Advent of Code with jq

  • I know that title is scary. But just like last year, I'm trying to solve as many days of Advent of Code in a single line of Python as I can. Because of this restriction, I'm using __import__('re') so I can use RegEx in my solutions rather than using the import statement (since that would add an additional line). But this means I have multiple instances that look like __import__('re').findall(r'\d', l) within a single line (as seen here). My question is: what is the impact of this? Is it importing the module every time it is called, or is it considered fully imported after the first call and just referenced in future calls? Is there any other/better way of doing this?

  • InfluxDB

    Power Real-Time Data Analytics at Scale. Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.

    InfluxDB logo
NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts

  • Ask HN: How do I get better at programming as a hobbyist?

    1 project | news.ycombinator.com | 23 Apr 2024
  • What Happens After Agile Dies?

    1 project | dev.to | 11 Apr 2024
  • When was the last time you used this? - Part 2: Algorithms

    1 project | dev.to | 28 Mar 2024
  • 2023, a year in images

    1 project | dev.to | 8 Mar 2024
  • Having a Game I'm into Makes Every Day Enjoyable

    1 project | news.ycombinator.com | 24 Dec 2023