[Python-ideas] Add __main__ for uuid, random and urandom
ncoghlan at gmail.com
Mon Apr 18 03:12:52 EDT 2016
On 18 April 2016 at 05:28, Koos Zevenhoven <k7hoven at gmail.com> wrote:
> So here's oneline.py:
Neat, although you'll want to use importlib.import_module() rather than
calling __import__ directly (the latter won't behave the way you want when
importing submodules, as it returns the top level module for the import
statement to bind in the current namespace, rather than the imported
> I suppose this could be on pypi, and one could do things like
> oneline.py "random.randint(0,10)"
> python -m oneline "random.randint(0,10)"
> Any thoughts?
There are certainly plenty of opportunities to make Python easier to invoke
for one-off commands. Another interesting example is pyp:
A completely undocumented hack I put together while playing one day was a
utility to do json -> json transformations via command line pipes:
The challenge with these kinds of things is getting them from "Hey, look at
this cool thing you can do" to "This will materially improve your
day-to-day programming experience". The former can still be fun to work on
as a hobby, but it's the latter that people need to get over the initial
>  https://pypi.python.org/pypi/np
> Python-ideas mailing list
> Python-ideas at python.org
> Code of Conduct: http://python.org/psf/codeofconduct/
Nick Coghlan | ncoghlan at gmail.com | Brisbane, Australia
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Python-ideas