Skip to main content
This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (pypi.python.org).
Help us improve Python packaging - Donate today!

Python with braces for easy one-liners

Project Description

As an old Perl-hack I really miss the convenience of one-line programs where I can easily add block structure. This script emulates the behaviors of perl -e, perl -n and perl -p using braces ({ and }) to generate Pythonesque indentation. There may be other ways to get around this but the goal is to make one-liners as easy as we expect.

Examples:

` >./pb 'for j in range(1,10) { for k in range(0,j) { sys.stdout.write(".") } sys.stdout.write("\n") }' . .. ... .... ..... ...... ....... ........ ......... `

PS. I know this one is very easy as a true Python one-liner:

` >python -c 'print "\n".join("."*j for j in range (1,10))' . .. ... .... ..... ...... ....... ........ ......... `

Release History

Release History

This version
History Node

0.0.1

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting