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 – Built for High-Performance Time Series Workloads
InfluxDB 3 OSS is now GA. Transform, enrich, and act on time series data directly in the database. Automate critical tasks and eliminate the need to move data externally. Download now.
www.influxdata.com
featured
Stream - Scalable APIs for Chat, Feeds, Moderation, & Video.
Stream helps developers build engaging apps that scale to millions with performant and flexible Chat, Feeds, Moderation, and Video APIs and SDKs powered by a global edge network and enterprise-grade infrastructure.
getstream.io
featured
  1. 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?

  2. InfluxDB

    InfluxDB – Built for High-Performance Time Series Workloads. InfluxDB 3 OSS is now GA. Transform, enrich, and act on time series data directly in the database. Automate critical tasks and eliminate the need to move data externally. Download now.

    InfluxDB logo
  3. 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?

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

  • Real time in no time

    1 project | dev.to | 9 Dec 2024
  • Advent of Docker: Day 0

    1 project | dev.to | 2 Dec 2024
  • My December Adventure (of code)

    1 project | dev.to | 1 Dec 2024
  • 2024 Developer Advent Calendars

    1 project | dev.to | 30 Nov 2024
  • Advent of Code 2024

    1 project | dev.to | 30 Nov 2024