Skip to main content

English description follows Japanese.

for i in range(∞):
	...

のようなことができるツール

使い方

import range_inf

# 2乗が10を超えるまで繰り返す
for i in range_inf:
	n = i ** 2
	if n > 10: break
	print(n)	# -> 0\n1\n4\n9

ツール概要

  • range(10)と同じような使用感で、無限に続くrange(無限大)を使いたいときのツール
  • 上記の使用例のようにfor文等で使ってください
  • いつ終了すべきかが予め分からないループを、whileではなくforで使えるため、簡単にインデックスが取得出来ます

詳細

  • itertoolsに同様のものがありますが、最短の記述でサクッと使いたいときに便利です
  • ネストして2重で使ったり、breakで中断した後再度使用しても、通常のgenerator等と異なり途中から始まることなく、リセットされて最初から始まるように作られています

Usage

import range_inf

# Repeat until the square exceeds 10
for i in range_inf:
	n = i ** 2
	if n > 10: break
	print(n)	# -> 0\n1\n4\n9

Overview

  • A tool that provides an infinite range(∞) with the same feel as range(10)
  • Use it in for loops as shown above
  • Ideal for loops where the exit condition isn't known in advance — allows index tracking using a for loop instead of while

Details

  • While itertools provides similar functionality, this tool is convenient when you want the shortest and cleanest syntax
  • It can be nested or reused after a break, and unlike typical generators, it always resets and starts from the beginning

Metadata

Release files for range-inf 0.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for range-inf 0.0.0
File Size Uploaded Provenance
range-inf-0.0.0.tar.gz 2.8 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for range-inf 0.0.0
File Interpreter ABI Platform
range_inf-0.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 6.0 kB

Release files / range-inf-0.0.0.tar.gz

Download URL range-inf-0.0.0.tar.gz
Size 2.8 kB
Tags Source
SHA-256 checksum
How to use checksums
c61c5e6b8a373a5132aa18b84321d2a33f54b85e2c41f23bf4428e87e60a3b01
BLAKE2b-256 checksum
How to use checksums
a4fc71db521cb0ff3bac6a53c60f7e18c999cc19e72be6cb92a570594b726612
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.11.3

Release files / range_inf-0.0.0-py3-none-any.whl

Download URL range_inf-0.0.0-py3-none-any.whl
Size 3.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5207b112c532b8146f7fd7206d5174e1ea96ef5da64d122f59ad6b157831a414
BLAKE2b-256 checksum
How to use checksums
0331c9d32b694a3c1d533b9cfc768862ddfeedfaa9789011b74e39ba2dee4629
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.11.3

Security for range-inf 0.0.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.0.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page