Skip to main content

Python 'f' Codec

Project description

Python f Codec

Wrap lonesome f-strings in print().

How to install

> python3 -m pip install f-codec

Why?

# -*- coding: f -*-

import sys

f'''
Python
'''
if sys.version_info > (3, 0):
    f''' {sys.version}
'''
else:
    f'''
The sunset for Python 2 has passed.
'''

f''''''

def dictionary(inst, depth=0):
    ಠ_ಠ = '    ' * depth

    f''' {{
'''

    for name, val in inst.items():
        if isinstance(val, dict):
            f'''
    {name} =
''' > ಠ_ಠ
            dictionary(val, depth + 1)
        else:
            f'''
    {name} = {val},
''' > ಠ_ಠ

    f'''
}}
''' > ಠ_ಠ

decl = {
    'a': 1,
    'b': 2,
    'c': { 'a': 3, 'b': 4 },
    'd': { 'a': 5, 'b': { 'a': 6, 'b': 7 }, 'c': 8 },
    'e': 9
}

f'''
decl =
'''
dictionary(decl)
> python3 test.py

Python 3.7.7 (default, Mar 10 2020, 15:43:33)
[Clang 11.0.0 (clang-1100.0.33.17)]

decl = {
    a = 1,
    b = 2,
    c = {
        a = 3,
        b = 4,
    }
    d = {
        a = 5,
        b = {
            a = 6,
            b = 7,
        }
        c = 8,
    }
    e = 9,
}

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

f-codec-0.0.8.tar.gz (3.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

f_codec-0.0.8-py3-none-any.whl (4.7 kB view details)

Uploaded Python 3

File details

Details for the file f-codec-0.0.8.tar.gz.

File metadata

  • Download URL: f-codec-0.0.8.tar.gz
  • Upload date:
  • Size: 3.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/47.3.1 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.7.7

File hashes

Hashes for f-codec-0.0.8.tar.gz
Algorithm Hash digest
SHA256 3530690e363e84d80cb807ebe255d3b64d4fe8a7575fd8ad2b7524cf0afcb959
MD5 3228d185693e746bfaa3dc4756588e29
BLAKE2b-256 333d960b3a5c482a8ce67ff9b17b6a3b5ad63028c8cb1e5ee1374b9f9e2cb850

See more details on using hashes here.

File details

Details for the file f_codec-0.0.8-py3-none-any.whl.

File metadata

  • Download URL: f_codec-0.0.8-py3-none-any.whl
  • Upload date:
  • Size: 4.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/47.3.1 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.7.7

File hashes

Hashes for f_codec-0.0.8-py3-none-any.whl
Algorithm Hash digest
SHA256 0f1823238bab7b6fdaa3489c256a3659f445efaf91e72a78339e228ef721dee5
MD5 0875068d152045c4304f41c8c2ca29f9
BLAKE2b-256 09016e1bd857953fb3da64c4ccd6a1a83a325e397fcaba75c798c598be084131

See more details on using hashes here.

Supported by

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