I have been using python shell to test small parts of the big program.
What other ways can I use the shell effectively. My mentor told me
that you can virtually do anything from testing your program to
anything in the shell. Any incite would be useful. 12 2447
* Krypto (16 May 2007 10:38:27 -0700)
I have been using python shell to test small parts of the big program.
What other ways can I use the shell effectively. My mentor told me
that you can virtually do anything from testing your program to
anything in the shell. Any incite would be useful.
use IPython
On May 16, 12:38 pm, Krypto <krypto.wiz...@gmail.comwrote:
I have been using python shell to test small parts of the big program.
What other ways can I use the shell effectively. My mentor told me
that you can virtually do anything from testing your program to
anything in the shell. Any incite would be useful.
Yeah? Well tell your mentor he can take his programs and
his literal interpretaions to the other side of the river!!
Oh...wait. Did you mean "insight"?
One thing that covers a LOT of ground is you can run other
programs from the shell and capture their output (assuming
the output is text to stdout).
For example, I can run the program factor!.exe from the
command line:
C:\python25\user>factor!.exe 27
PRIME_FACTOR 3
PRIME_FACTOR 3
PRIME_FACTOR 3
But I can also run it from the Python shell:
>>import os f = os.popen("factor! 27").readlines()
>>f
['PRIME_FACTOR 3\n', 'PRIME_FACTOR 3\n', 'PRIME_FACTOR
3\n']
>>q = [int(i.split()[1]) for i in f] q
[3, 3, 3]
Now, you've got the factors without having to write your own
factoring program and you never had to leave the shell.
What more could you ask for? me********@aol.com <me********@aol.comwrote:
On May 16, 12:38 pm, Krypto <krypto.wiz...@gmail.comwrote:
>I have been using python shell to test small parts of the big program. What other ways can I use the shell effectively. My mentor told me that you can virtually do anything from testing your program to anything in the shell. Any incite would be useful.
Yeah? Well tell your mentor he can take his programs and
his literal interpretaions to the other side of the river!!
Oh...wait. Did you mean "insight"?
One thing that covers a LOT of ground is you can run other
programs from the shell and capture their output (assuming
the output is text to stdout).
For example, I can run the program factor!.exe from the
command line:
C:\python25\user>factor!.exe 27
PRIME_FACTOR 3
PRIME_FACTOR 3
PRIME_FACTOR 3
But I can also run it from the Python shell:
>>>import os f = os.popen("factor! 27").readlines()
>>>f
['PRIME_FACTOR 3\n', 'PRIME_FACTOR 3\n', 'PRIME_FACTOR
3\n']
>>>q = [int(i.split()[1]) for i in f] q
[3, 3, 3]
Now, you've got the factors without having to write your own
factoring program and you never had to leave the shell.
What more could you ask for?
I could ask for some tricks that would let me do things like:
* os.fork() --- but have that spawned in it's own xterm/shell
so I can no interact with each of the children separately
* Use the curses library --- with the interpreter reading from
one shell/xterm and the curses display controlling another
one.
I'm sure they're out there ... and I've love to see pointers to them.
--
Jim Dennis,
Starshine: Signed, Sealed, Delivered
In article <11**********************@u30g2000hsc.googlegroups .com>,
Paddy <pa*******@googlemail.comwrote:
>On May 16, 6:38 pm, Krypto <krypto.wiz...@gmail.comwrote:
>I have been using python shell to test small parts of the big program. What other ways can I use the shell effectively. My mentor told me that you can virtually do anything from testing your program to anything in the shell. Any incite would be useful.
Doctest! http://en.wikipedia.org/wiki/Doctest
Cameron Laird wrote:
In article <11**********************@u30g2000hsc.googlegroups .com>,
Paddy <pa*******@googlemail.comwrote:
>On May 16, 6:38 pm, Krypto <krypto.wiz...@gmail.comwrote:
>>I have been using python shell to test small parts of the big program. What other ways can I use the shell effectively. My mentor told me that you can virtually do anything from testing your program to anything in the shell. Any incite would be useful.
Doctest! http://en.wikipedia.org/wiki/Doctest
.
.
.
<URL: http://en.wikipedia.org/wiki/DocTest will probably prove more fruitful.
While I don't like follow-ups which consist of trivial corrections, I *very*
much want to encourage readers to explore Doctest more deeply; it deserves the
attention, even at the cost of appearing pedantic.
Is there some mistake in this post? I find that there *is* an article at http://en.wikipedia.org/wiki/Doctest
but that http://en.wikipedia.org/wiki/DocTest
doesn't refer to an extant article. Since you claim to be exercising
your pedantry, I wonder why I get the results I do. Since we *are* being
pedantic, by the way, surely the name is actually "doctest", not "Doctest".
regards
Steve
--
Steve Holden +1 571 484 6266 +1 800 494 3119
Holden Web LLC/Ltd http://www.holdenweb.com
Skype: holdenweb http://del.icio.us/steve.holden
------------------ Asciimercial ---------------------
Get on the web: Blog, lens and tag your way to fame!!
holdenweb.blogspot.com squidoo.com/pythonology
tagged items: del.icio.us/steve.holden/python
All these services currently offer free registration!
-------------- Thank You for Reading ----------------
Krypto wrote:
I have been using python shell to test small parts of the big program.
What other ways can I use the shell effectively. My mentor told me
that you can virtually do anything from testing your program to
anything in the shell. Any incite would be useful.
I'm not sure this will help - but!
I use a text editor (EditPlus under Windows) as a mini IDE. Some text
editors have a concept of "tools" where you can run the "tool" from
within the editor and it calls an external program to run the source
code in the editor. With EditPlus the tool looks something like:
Menu text: Python
Command: C:\Python25\python.exe
Argument: "$(FileName)"
Initial directory: $(FileDir)
Capture output: [X]
Output from the program run is captured in an "output window". A full
blown IDE it ain't but handy it is.
Regards,
Peter
--
Peter Anderson
There is nothing more difficult to take in hand, more perilous to
conduct, or more uncertain in its success, than to take the lead in the
introduction of a new order of things — Niccolo Machiavelli, "The
Prince", ch. 6
On Sat, 19 May 2007 21:42:27, Steve Holden <st***@holdenweb.comwrote http://en.wikipedia.org/wiki/Doctest
>Since you claim to be exercising your pedantry, I wonder why I get the results I do. Since we *are* being pedantic, by the way, surely the name is actually "doctest", not "Doctest".
Yes, as the page you are referring to mentions right at the top:
,----------------
| Doctest
| From Wikipedia, the free encyclopedia
|
| The correct title of this article is doctest. The initial letter
is shown
| capitalized due to technical restrictions.
`----------------
--
Doug Woodrow
On May 20, 1:56 am, cla...@lairds.us (Cameron Laird) wrote:
In article <1179552984.466321.137...@u30g2000hsc.googlegroups .com>,Paddy <paddy3...@googlemail.comwrote:
On May 16, 6:38 pm, Krypto <krypto.wiz...@gmail.comwrote:
I have been using python shell to test small parts of the big program.
What other ways can I use the shell effectively. My mentor told me
that you can virtually do anything from testing your program to
anything in the shell. Any incite would be useful.
Doctest! http://en.wikipedia.org/wiki/Doctest
.
.
.
<URL:http://en.wikipedia.org/wiki/DocTestwill probably prove more fruitful.
While I don't like follow-ups which consist of trivial corrections, I *very*
much want to encourage readers to explore Doctest more deeply; it deserves the
attention, even at the cost of appearing pedantic.
Sometimes you have to mess with the case of letters in wiki pages
which is the case here, but I did actually cut-n-paste the address
from Wikipedia as I like to look at the page from time to time as,
like yourself, I think doctest shows the true spirit of what is
Pythonic, and created the page when I found Wikipedia did not have it.
Gets me thinking along the lines of "What else should the intermediate
Python programmer know about"?
The other Python tool I am apt to carp on about is Kodos http://kodos.sourceforge.net/ .
Kodos is a great tool for those new to reguar expressions. It allows
you to test your regular expressions on snippets of text and gives
great visual feedback on the results. After over a decade of writing
regexps I still use Kodos occasionally, and wish I had such a tool a
decade ago.
- Paddy.
Douglas Woodrow wrote:
On Sat, 19 May 2007 21:42:27, Steve Holden <st***@holdenweb.comwrote
> http://en.wikipedia.org/wiki/Doctest
>Since you claim to be exercising your pedantry, I wonder why I get the results I do. Since we *are* being pedantic, by the way, surely the name is actually "doctest", not "Doctest".
Yes, as the page you are referring to mentions right at the top:
,----------------
| Doctest
| From Wikipedia, the free encyclopedia
|
| The correct title of this article is doctest. The initial letter
is shown
| capitalized due to technical restrictions.
`----------------
Whereas Cameron wrote
... to explore Doctest more deeply ...
regards
Steve
--
Steve Holden +1 571 484 6266 +1 800 494 3119
Holden Web LLC/Ltd http://www.holdenweb.com
Skype: holdenweb http://del.icio.us/steve.holden
------------------ Asciimercial ---------------------
Get on the web: Blog, lens and tag your way to fame!!
holdenweb.blogspot.com squidoo.com/pythonology
tagged items: del.icio.us/steve.holden/python
All these services currently offer free registration!
-------------- Thank You for Reading ----------------
On May 17, 3:38 am, Krypto <krypto.wiz...@gmail.comwrote:
My mentor told me that you can virtually do anything from
testing your program to anything in the shell. Any incite
would be useful.
Using something like tee you can run the Python script in
the shell and also capture it's output: http://unxutils.sourceforge.net/
For example, here are details on how to use tee within
the Zeus IDE: http://www.zeusedit.com/forum/viewtopic.php?t=74
Jussi Jumppanen
Author: Zeus for Windows IDE http://www.zeusedit.com - Zeus for Windows Programmer's IDE
In article <11**********************@y80g2000hsf.googlegroups .com>,
Paddy <pa*******@googlemail.comwrote: This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Brandon J. Van Every |
last post by:
I'm realizing I didn't frame my question well.
What's ***TOTALLY COMPELLING*** about Ruby over Python? What makes you jump
up in your chair and scream "Wow! Ruby has *that*? That is SO...
|
by: Logan |
last post by:
Several people asked me for the following HOWTO, so I decided to
post it here (though it is still very 'alpha' and might contain
many (?) mistakes; didn't test what I wrote, but wrote it - more
or...
|
by: Matthew Thorley |
last post by:
My friend sent me an email asking this:
> I'm attemtping to decide which scripting language I should master and
> was wondering if it's possible to do
> these unixy awkish commands in python:...
|
by: Xah Lee |
last post by:
Python Doc Problem Example: os.system
Xah Lee, 2005-09
today i'm trying to use Python to call shell commands. e.g. in Perl
something like
output=qx(ls)
in Python i quickly located the...
|
by: bblais |
last post by:
Hello,
Let me start by saying that I am coming from a background using Matlab
(or Octave), and C++. I am going to outline the basic nuts-and-bolts
of how I work in these languages, and ask for...
| |
by: John Salerno |
last post by:
Hi all. I just installed Ubuntu and I'm learning how to use the bash
shell. Aside from the normal commands you can use, I was wondering if
it's possible to use Python from the terminal instead of...
|
by: TP |
last post by:
Hi everybody,
I am new to Python, I try to understand how Python treats special
characters. For example, if I execute the following line in a shell
console, I obtain a colored string:
$...
|
by: Cameron Simpson |
last post by:
On 17Aug2008 21:25, John Nagle <nagle@animats.comwrote:
Because $HOSTNAME is a bash specific variable, set by bash but NOT
EXPORTED! Like $0 and a bunch of other "private" variables, subprocesses...
|
by: mmm |
last post by:
I am looking for advice on Python Editors and IDEs
I have read other posts and threads on the subject and my two
questions at this time are mainly about the IDLE-like F5-run
facilities. While I...
|
by: james.kirin39 |
last post by:
Hi everyone,
After having used Python on Linux for some time, I now have to do
Python coding on Windows. I am big fan of the interactive Python shell
to test, eg, regexps.
Is there an...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...
| |