Skip to main content

Print current file and line number

Project description

There

Print the current filename and line.

Example, where.py

import there
import there as here

print(here)
print('and')
print(there)

Then python where.py will print:

where.py:4
and
where.py:6

replace print function

There provide a replacement for the print function, that prepend the filename and line.

Example, where.py

from there import print

print('hi')
print('there')

Then python where.py will print:

where.py:3 hi
where.py:4 there

that's it

That's it (for now), non more, no less. I have plan – the usually never get realised – to also have a there.indent that return the indentation of the current line.

Gotchas

Returns the line where the __str__, or __repr__ of there is computed. Usually by print. So it might be wrong. If you want to be sure (like when using log) wrap it in str()

Runs only on CPython likely. But anyway don't run it in production.

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

there-0.0.9.tar.gz (42.3 kB view details)

Uploaded Source

Built Distribution

there-0.0.9-py2.py3-none-any.whl (4.8 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file there-0.0.9.tar.gz.

File metadata

  • Download URL: there-0.0.9.tar.gz
  • Upload date:
  • Size: 42.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-requests/2.19.1

File hashes

Hashes for there-0.0.9.tar.gz
Algorithm Hash digest
SHA256 a65e4b050b14a57ede8bb852c36eb61f0e9d9e1352039d2f9723f8d0601e146a
MD5 1353a3af8ba7c770cc11ed152610865e
BLAKE2b-256 48904ea2ce86280f87c291ca09e89a1562994a5b3857a67342c7365396a46c0f

See more details on using hashes here.

File details

Details for the file there-0.0.9-py2.py3-none-any.whl.

File metadata

  • Download URL: there-0.0.9-py2.py3-none-any.whl
  • Upload date:
  • Size: 4.8 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-requests/2.19.1

File hashes

Hashes for there-0.0.9-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 812638ab3683286bf677f273dd6658de93ebbc99fb74ef2548dc8c045d34e8a6
MD5 43caf5180b1b30052910e83a298b20b2
BLAKE2b-256 c9358b3e419d06e88d01800ce065b45ceaf1c81de68ca063eb9611bf559c82bb

See more details on using hashes here.

Supported by

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