Critic my module
Devyn Collier Johnson
devyncjohnson at gmail.com
Sat Jul 27 16:53:16 CEST 2013
On 07/27/2013 10:33 AM, Dave Angel wrote:
> On 07/27/2013 08:56 AM, Devyn Collier Johnson wrote:
> Somehow during this thread, you have changed your purpose for this
> library. It used to be a library that Python programmers could import
> and use. And now, it's a shell replacement? The user runs the Python
> interpreter, and types the line import boash to get started.
>> Yeah, I have a VERY BAD habit of treating bash and the Linux shell (or
>> any/all shells) as the same thing. I know they are all very different,
>> but for some reason I still keep calling all shells in general BASH.
> I seem to recall that BASH is an acronym, for Bourne Again SHell.
>> I will be sure to create aliases. I make alias commands so that it is
>> easier to guess or remember a command. For instance, a Python user my
>> want to clear the shell's history, but can only remember one form of the
>> command or must guess. On my Ubuntu system, I have set up numerous shell
>> aliases. I am addicted to aliases.
> Nothing wrong with aliases. But how does your user create his own
> aliases? That's much more important than having yours available.
> Remember that any new globals he defines are lost when he exits the
> interpreter (or crashes).
>> I still need to add the other browsers. Do very many people use
>> I did not notice that I have "print(subprocess.Popen('(xterm &)'))"
>> instead of "subprocess.Popen('(xterm &)')". The worst computer errors
>> are ID-10-T errors.
>> True, the user my have Xterm open, but what if they use Guake (like me)
>> or Pterm, EvilVTE, Valaterm, Gnome-Terminal, Konsole, etc.?
> Exactly. If they're using a terminal with tabs, they might want to
> create a new tab, not a new instance of the terminal. Or if they're
> running screen or the equivalent, they want the new terminal to show
> up on their (remote) console.
>> How could I add security and convenience? Okay, I will try to add wget.
>> Are there any other shell commands that anyone feels I should add?
> How about tab? The command-completion and filename-completion and
> parameter-completion logic of a good shell is extremely complex, and
> very useful.
>> The point of this module is to allow Linux shell users to use Python3 as
>> a regular shell. Instead of using CSH, Bash, Tcsh, FISH, etc., users
>> could use Python3 and import this module. Python is more powerful than
>> any shell, so I want to make it easier for anyone to use Python as the
>> default shell. For instance, instead of typing "print(os.getcwd())" to
>> get the current working directory, users could type "boash.ls()". I hope
>> that is easier to remember than "print(os.getcwd())".
> It's easier, but doesn't begin to do the same thing.
> As for using this INSTEAD of csh, bash, etc., that might be likely
> once it gets beyond 10% of the usefulness. Right now, it's at about
> 0.01% And any habits a user gets within this environment have to be
> unlearned when he returns to a standard shell.
> Back in the early days of MSDOS, the FORMAT command didn't require you
> to specify a drive letter. So people could intend to format their
> floppy, and actually trash their hard disk. So I had colleagues who
> put a FORMAT.BAt command on their path which hard-wired the A:
> parameter. Now what happens to one of those folks when he goes to
> another machine which doesn't have that batch file? Ouch! Instead I
> wrote a batch file that checked to make sure you had the A:
> parameter. Rapidly, my fingers learned that FORMAT A: was the valid
> syntax, and pretty soon the batch file was unnecessary (for me).
> If I were going to define a dozen aliases for other people to use, I'd
> make them something like:
> def clear_hist():
> print "The function you want is probably clear_history()"
>> As for the print()
>> command, I do not like how os.getcwd() has single quotes around the
> Those quotes come from the Python interpreter, not from getcwd().
>> Plus, Linux shell do not print output with quotes.
>> I want to make this a very useful and popular module, so I will use the
>> suggestions and add more useful wrappers. Would it help if I made a
>> Youtube video showing how this module can be used?
>> I will post the next version on this mailing list for another review.
>> Thanks everyone, and thanks a lot Steven D'Aprano!
> Have you figured out how you're going to do things like cd (os.chdir),
> which have to remember state? And how to pass the new current
> directory to the shell that launched Python?
> Have you looked at ipython (ipython.org) ? At least from there, you
> can get command completion with tab, one-third of the bash
> functionality. So if you type boash.cle then <tab> it'll fill in
> the rest.
Thanks! I will look into IPython. I am familiar with it already. Yes, I
have two purposes for the module, but after reading these suggestions I
have modified my goal and purpose to achieve the goal of making a useful
and popular Python3 module. The whole point of my boash project is to
make a useful module. How can I make this module useful? I am fixing the
problems and implementing suggestions.
Would a Python3 game module be more useful? I plan to make a function
that rolls a die and prints the output (You got a 5) and other similar
More information about the Python-list