Skip to main content

Pure Python, relatively-efficient reading of null-terminated lines

Project description

Read lines of data with an arbitrary delimiter, like a null, newline or even an x.

It passes pylint, passes pycodestyle, passes pydocstyle, is thoroughly unit tested, and runs on CPython 2.7, CPython 3.x, Pypy 7.3.1, and Pypy3 7.3.1.

It gains a lot of speed by eschewing single-character reads.

Usage looks like:
import readline0
file_ = open('/etc/shells', 'r')
for line in readline0.readline0(file_=file_, separator=b'\n'):
...     print(line)
...
b'# /etc/shells: valid login shells'
b'/bin/sh'
b'/bin/dash'
b'/bin/bash'
b'/bin/rbash'

Of course separator need not be a newline; it defaults to a null byte. Also file_ defaults to sys.stdin. And there’s a blocksize argument as well, which defaults to 64K.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

readline0-1.7.tar.gz (4.1 kB view details)

Uploaded Source

File details

Details for the file readline0-1.7.tar.gz.

File metadata

  • Download URL: readline0-1.7.tar.gz
  • Upload date:
  • Size: 4.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.7.3

File hashes

Hashes for readline0-1.7.tar.gz
Algorithm Hash digest
SHA256 505774f90826237f1228f6f0118b11bdb66824c8610322ced836a76247326791
MD5 1760f467fbbbd6a2356e7faadf9fd6fd
BLAKE2b-256 cdc3eb05bfc67e2a77bb38656a7e5dd56811019033d54aed3d19c50ea108e4a6

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page