Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

mapjoin: the OBSCENE string generation one-liner

The purpose of the mapjoin function is to have an alternative to str.join that looks more like os.path.join (which takes *args).

Usage:

from mapjoin import mapjoin

mapjoin('foo', 2)           # return 'foo 2'
mapjoin('foo', 2, sep='_')  # return 'foo_2'

# you can also make mapjoin use your own callback with the key kwarg:
your_formatter = lambda key: str(key) if key else 'Nothin!'
mapjoin('foo', obj, 2, None, sep='\n', key=your_formatter)

But … why ?

Initially, because I make to many mistakes when I write an os.path.join call and then a str.join call in a row:

>>> os.path.join('a', 'b')
'a/b'

# and 2 seconds later i'm doing this:

>>> ' '.join('a', 'b')
TypeError: join() takes exactly one argument (2 given)

# and instead of "just fixit and move on", i decided have a take on join

But also because I can’t get no satisfaction with my code when it looks like:

readable = ' '.join(map(str, [
    'hello',
    f'__{name}__',
    something,
]))

# or:

def foo():
    readable = textwrap.dedent(f'''
    hello
    __{name}__
    ''').strip()

Participate to the story

Metadata

Release files for mapjoin 0.1.1.dev1

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

Source distribution (sdist)

Source distribution for mapjoin 0.1.1.dev1
File Size Uploaded Provenance Actions
mapjoin-0.1.1.dev1.tar.gz 1.7 kB Without provenance Details for mapjoin-0.1.1.dev1.tar.gz

Release files / mapjoin-0.1.1.dev1.tar.gz

Download URL mapjoin-0.1.1.dev1.tar.gz
Size 1.7 kB
Tags Source
SHA-256 checksum
How to use checksums
f9ca6a213ea75cb0031d02d75bb4b54bdfcf33d496ceb2c7c1245cfa1f5e0463
BLAKE2b-256 checksum
How to use checksums
73e2c069573fe03724107ad52a2b7e8df1146ead4d8a4068aa4e83226f0a3115
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.12.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/39.0.1 requests-toolbelt/0.9.1 tqdm/4.30.0 CPython/3.6.6

Security for mapjoin 0.1.1.dev1

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.

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