Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #51361

Re: Critic my module

Path csiph.com!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <devyncjohnson@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.000
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'interpreter': 0.05; 'output': 0.05; 'true,': 0.05; 'modified': 0.07; 'python3': 0.07; 'alias': 0.09; 'aliases': 0.09; 'already.': 0.09; 'bash': 0.09; 'collier': 0.09; 'defines': 0.09; 'exits': 0.09; 'logic': 0.09; 'subject:module': 0.09; 'suggestions.': 0.09; 'yeah,': 0.09; 'runs': 0.10; 'python': 0.11; 'def': 0.12; 'wrote': 0.14; 'random': 0.14; '(remote)': 0.16; 'bash,': 0.16; 'browsers.': 0.16; 'command,': 0.16; 'command.': 0.16; 'different,': 0.16; 'globals': 0.16; 'guess.': 0.16; 'interpreter,': 0.16; 'os.getcwd()': 0.16; 'parameter.': 0.16; 'syntax,': 0.16; 'tab,': 0.16; 'thread,': 0.16; 'worst': 0.16; '(you': 0.16; 'folks': 0.16; 'wrote:': 0.18; 'library': 0.18; 'looked': 0.18; 'module': 0.19; 'everyone,': 0.19; 'implementing': 0.19; 'typing': 0.19; 'command': 0.22; 'machine': 0.22; 'import': 0.22; 'python?': 0.22; 'shell': 0.22; 'print': 0.22; 'header:User-Agent:1': 0.23; 'errors.': 0.24; 'instance,': 0.24; 'module,': 0.24; 'specify': 0.24; '(or': 0.24; 'environment': 0.24; 'define': 0.26; 'purposes': 0.26; 'skip:" 30': 0.26; 'pass': 0.26; 'post': 0.26; 'least': 0.26; '(for': 0.26; 'skip:" 20': 0.27; 'gets': 0.27; 'header:In-Reply-To:1': 0.27; 'point': 0.28; 'function': 0.29; 'am,': 0.29; "doesn't": 0.30; '(like': 0.30; 'errors': 0.30; 'easier': 0.31; 'received:10.0.0': 0.31; 'directory,': 0.31; 'fixing': 0.31; 'letter.': 0.31; 'prints': 0.31; 'quotes': 0.31; 'steven': 0.31; 'anyone': 0.31; 'file': 0.32; 'probably': 0.32; 'checked': 0.32; 'thanks!': 0.32; 'regular': 0.32; 'another': 0.32; 'linux': 0.33; 'running': 0.33; 'guess': 0.33; 'programmers': 0.33; 'screen': 0.34; '"the': 0.34; 'there,': 0.34; "i'd": 0.34; 'could': 0.34; 'something': 0.35; 'beyond': 0.35; 'johnson': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'add': 0.35; 'there': 0.35; 'version': 0.36; 'library.': 0.36; 'module.': 0.36; 'ubuntu': 0.36; 'next': 0.36; "didn't": 0.36; 'useful': 0.36; 'thanks': 0.36; 'received:10.0': 0.36; 'similar': 0.36; 'should': 0.36; 'wrong': 0.37; 'two': 0.37; 'list': 0.37; 'project': 0.37; 'received:10': 0.37; 'clear': 0.37; 'system,': 0.38; 'making': 0.63; 'show': 0.63; 'soon': 0.63; 'more': 0.64; 'youtube': 0.65; 'within': 0.65; 'started.': 0.68; 'useful.': 0.68; 'default': 0.69; '10%': 0.74; 'goal': 0.75; 'completion': 0.78; 'complex,': 0.84; 'easier,': 0.84; 'games.': 0.84; 'history,': 0.84; 'me).': 0.84; 'received:mail- ob0-x22d.google.com': 0.84; 'rolls': 0.84; 'treating': 0.84; 'yours': 0.88; 'angel': 0.91; 'dozen': 0.91; 'habit': 0.91; 'shell,': 0.91; 'numerous': 0.93; 'colleagues': 0.97
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:subject:references :in-reply-to:content-type:content-transfer-encoding; bh=IYxppD1FZHCjJy5HrvImzIwqpgxwTaL/WOsVSi2t/UU=; b=Ru1yXeXrxGCrMkikVMsGwiBAZQH0bJdp2LhYFZYS4Fg74BxjSBs5VnLC1YyQttSpP5 nFnkPozxRlz8/iGrDhEy9124dxxMptGDYA8O3sW6oqhDBARdaME/pPpp+sQPJo07s0tI jpleDcZCrxUmfaLtyZkZ3974K+IlSCHGV6ApH0h26Ivn6J1PnKb4tebcNswnUaeZufqN ndmw7IkkzMlrb9UA77WGO7KiyC34PPJv7ukc338/VLUZG7Y64SrF4Y6ZuXcTbzkFw3GZ 7FkDfbLrnWwaoce0vMU13+GXKEZ5h7R3AYfhl7I1xtpwtqAa3iTf6quG26g4Xdu5m3tf bu6g==
X-Received by 10.60.141.36 with SMTP id rl4mr12725990oeb.43.1374936809407; Sat, 27 Jul 2013 07:53:29 -0700 (PDT)
Date Sat, 27 Jul 2013 10:53:16 -0400
From Devyn Collier Johnson <devyncjohnson@gmail.com>
User-Agent Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130623 Thunderbird/17.0.7
MIME-Version 1.0
To Python Mailing List <python-list@python.org>
Subject Re: Critic my module
References <mailman.5092.1374758683.3114.python-list@python.org> <51f334eb$0$29971$c3e8da3$5496439d@news.astraweb.com> <51F3C36A.4020400@Gmail.com> <kt0lnn$3gl$1@ger.gmane.org>
In-Reply-To <kt0lnn$3gl$1@ger.gmane.org>
Content-Type text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding 7bit
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.5175.1374936812.3114.python-list@python.org> (permalink)
Lines 130
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1374936812 news.xs4all.nl 15940 [2001:888:2000:d::a6]:34257
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:51361

Show key headers only | View raw


On 07/27/2013 10:33 AM, Dave Angel wrote:
> On 07/27/2013 08:56 AM, Devyn Collier Johnson wrote:
>>
>
>     <SNIP>
>
> 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 
>> Iceweasel?
>>
>> 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
>> output.
>
> 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 
random games.


Mahalo,

DCJ

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Critic my module Devyn Collier Johnson <devyncjohnson@gmail.com> - 2013-07-25 09:24 -0400
  Re: Critic my module Alain Ketterlin <alain@dpt-info.u-strasbg.fr> - 2013-07-25 16:09 +0200
    Re: Critic my module Devyn Collier Johnson <devyncjohnson@gmail.com> - 2013-07-26 06:59 -0400
      Re: Critic my module Alister <alister.ware@ntlworld.com> - 2013-07-26 15:08 +0000
        Re: Critic my module Joshua Landau <joshua@landau.ws> - 2013-07-26 18:24 +0100
  Re: Critic my module Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-07-27 02:48 +0000
    Re: Critic my module Devyn Collier Johnson <devyncjohnson@gmail.com> - 2013-07-27 08:56 -0400
      Re: Critic my module Alister <alister.ware@ntlworld.com> - 2013-07-27 16:32 +0000
        Re: Critic my module Dave Angel <davea@davea.name> - 2013-07-27 12:58 -0400
    Re: Critic my module Devyn Collier Johnson <devyncjohnson@gmail.com> - 2013-07-27 09:19 -0400
    Re: Critic my module Dave Angel <davea@davea.name> - 2013-07-27 09:35 -0400
    Re: Critic my module Chris “Kwpolska” Warrick <kwpolska@gmail.com> - 2013-07-27 15:36 +0200
    Re: Critic my module Devyn Collier Johnson <devyncjohnson@gmail.com> - 2013-07-27 09:44 -0400
    Re: Critic my module Chris Angelico <rosuav@gmail.com> - 2013-07-27 14:37 +0100
    Re: Critic my module Dave Angel <davea@davea.name> - 2013-07-27 10:33 -0400
    Re: Critic my module Devyn Collier Johnson <devyncjohnson@gmail.com> - 2013-07-27 10:53 -0400
    Re: Critic my module Chris Angelico <rosuav@gmail.com> - 2013-07-27 16:15 +0100

csiph-web