A command-line tool for displaying Python gotchas and unexpected behaviors
npx @tessl/cli install tessl/npm-wtfpython@1.2.0wtfpython is a command-line tool that displays a collection of interesting, subtle, and tricky Python examples to help developers understand Python's unexpected behaviors and internals. It provides an educational resource for learning about Python language quirks, interpreter optimizations, and common pitfalls through an interactive terminal interface.
wtfpython provides a curated collection of Python gotchas and unexpected behaviors designed to help developers understand Python's internals. The tool displays educational content about Python language quirks, interpreter optimizations, and common pitfalls through a paginated terminal interface with syntax highlighting and multi-language support.
Key Features:
npm install -g wtfpythonThis package provides a command-line executable only and does not expose any programmatic API for import. It is designed exclusively as a global command-line tool:
# Install globally to make wtfpython command available
npm install -g wtfpython
# No programmatic imports available - CLI usage only
# Not available: import * from 'wtfpython'
# Not available: const wtfpython = require('wtfpython')The package provides a single global command-line executable:
wtfpython [options]No programmatic API is available - this package is designed exclusively as a command-line tool.
# Display Python gotchas in default language (English)
wtfpython
# Display in Portuguese (Brazil)
wtfpython --lang pt-br
# Display help information
wtfpython --helpThe primary interface for accessing Python gotchas and examples.
wtfpython [options]
Options:
--lang, -l <language> Specify translation language code
--help, -h Display help information
Exit Codes:
0 Successful execution and content display
Non-zero Error (file not found, invalid language, etc.)
Note: The built-in help text displays "bash-handbook" instead of "wtfpython"
in usage examples due to the source code being based on a bash-handbook template.Usage Examples:
# Basic usage - displays content in system pager
wtfpython
# View available languages and help
wtfpython --help
# Display Portuguese translation
wtfpython --lang pt-br
# Display other supported languages (varies by available translations)
wtfpython -l es # Spanish (if available)
wtfpython -l fr # French (if available)Multi-language translation support for Python examples and explanations.
--lang <language_code>
-l <language_code>
Supported format: ISO language codes (e.g., pt-br, es, fr)
Translation files: README-{lang}.md format
Fallback: English (README.md) if translation not foundThe tool displays structured Python examples with consistent formatting:
# Language not found
wtfpython --lang invalid-lang
# Output: "The invalid-lang translation does not exist"
# Exit code: Non-zero
# Missing content files
# If README.md or translation files are missing, the tool will exit with errorThe package uses the following Node.js dependencies for functionality:
PAGER # System pager command (defaults to 'less' if not set)
LESS # Less pager options (defaults to 'FRX' if not set)The tool requires the following files in its installation directory:
README.md: Main content file with Python examples (English)README-{lang}.md: Translation files for other languages (optional)package.json: Package metadata for version checking and updates# Install globally for command-line access
npm install -g wtfpython
# Verify installation
wtfpython --help
# Use from anywhere in terminal
cd /any/directory
wtfpython