473,573 Members | 4,503 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

array, a better shell

For array.array "B" means unsigned char, and such arrays accept to be
initialized from (str) strings too, this is quite useful:
>>from array import array
a = array("B", "hello")
But it seems such capability isn't shared with the append:
>>a.extend("hel lo")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: an integer is required

------------------------

I like a lot the Python shell, it helps me in many different
situations. I have tried some Python shells:
- the vanilla one from DOS
- the one from ActivePython IDE
- the one from SPE
- ipython from a DOS shell

But none of them has what I'd like.
ipython tries to be a better shell, but I don't want more complexity
and more commands/tricks to remember, I want something more
interactive, that's simpler and more powerful to use, and not something
(much) more complex. Much less things, but the important ones.
Beside the vanilla one, I end using the SPE one (because it has colours
on Windows too, and it allows you to paste a piece of interactive shell
with the leading >>>, SPE removes them automatically. This is very
handy).

I have also used the shell of Mathematica. It's quite powerful and it
can show graphics too inlined, but globally I don't like it fully
because it makes editing small programs a pain (for me). Even if I
globally don't like the Mathematica shell, it has a capability that I'd
like to have in a basic Python shell too.
(NOTE: often when dealing with GUI subtle details make a *big*
difference, and it's not easy to use words to describe such interaction
details.)
This Mathematica shell allows you to edit small programs (like 1-15
lines of code) as input blocks, and later you can click on them and
edit them. When you press shift-enter inside a block, that small
program runs and its output goes just below it (and not at the end of
the current shell log). All the Input Blocks can be edited and run
again like that (an Input/Output number tag helps to keep things sorted
enough). So it's a cross between a normal stupid shell that's
essentially an I/O + visual log, and a bare-bone text editor that
allows you to edit one script and run it too.
Such capability probably needs a Tk/Wx/Gtk window...

-------

(Such interactive sessions can be saved too, and loaded again (they
become complex documents), but such ability isn't necessary into a
bare-bone shell that I am describing now. I am describing something as
simple as possible).

Beside that (new) basic shell capability I think I can appreciate two
other capabilities:
- Automatically saves the last 20 MBytes of textual input/output log
inside a "queue" file. Material older than the last 20 MB is removed
from the top.
- Ability to break the computation (or the printing of VERY long
things!) without exiting the shell and the kernel (this is from
Mathematica too).

Bye,
bearophile

Dec 20 '06 #1
5 1877
On Wed, 20 Dec 2006 03:44:25 -0800, bearophileHUGS wrote:
For array.array "B" means unsigned char, and such arrays accept to be
initialized from (str) strings too, this is quite useful:
>>>from array import array
a = array("B", "hello")

But it seems such capability isn't shared with the append:
[snip]
I like a lot the Python shell, it helps me in many different
situations. I have tried some Python shells:
- the vanilla one from DOS
- the one from ActivePython IDE
- the one from SPE
- ipython from a DOS shell

But none of them has what I'd like.

Is there a shortage of bytes, that Usenet posts about completely different
topics have to message-pool?

Did you have any questions, or were you just talking to yourself?

[snip]

(Such interactive sessions can be saved too, and loaded again (they
become complex documents), but such ability isn't necessary into a
bare-bone shell that I am describing now. I am describing something as
simple as possible).
No you're not. You're describing a quite complicated shell. You're
describing a hypothetical shell with features other actual shells don't
have, so therefore it can't possibly be as simple as possible. Perhaps
what you meant to say was "the bare-minimum I consider worth using"?

--
Steven.

Dec 20 '06 #2
Steven D'Aprano:
No you're not. You're describing a quite complicated shell. You're
describing a hypothetical shell with features other actual shells don't
have, so therefore it can't possibly be as simple as possible.
You are right, it's not really simple, but:
- It has just the basic functionality that I think is important. Many
more features can be added, I too can list some of them, but I don't
think they are much important.
- It's very simple from the user point of view, because its usage
requires no new commands to remember :-) (beside shift-enter or
something similar to run a block).

Thank you for listening,
bye,
bearophile

Dec 20 '06 #3
be************@ lycos.com wrote:
This Mathematica shell allows you to edit small programs (like 1-15
lines of code) as input blocks, and later you can click on them and
edit them. When you press shift-enter inside a block, that small
program runs and its output goes just below it (and not at the end of
the current shell log). All the Input Blocks can be edited and run
again like that (an Input/Output number tag helps to keep things sorted
enough).
Sounds pretty close to what Idle does:

The Idle shell allows you to enter small programs as input blocks, and edit
them while entering them. Later you can click on them and bring them back
to the bottom of the input buffer for further editing (so no confusing
output appearing out of order), and you can always look back at all earlier
versions of the block. All the Input Blocks can be edited and run again
like that.

Your point was?
Dec 20 '06 #4
Duncan Booth:
Later you can click on them and bring them back
to the bottom of the input buffer for further editing (so no confusing
output appearing out of order),
I think that's worse, not better. You end with a messy final "document"
(log), so finding things into it (during the editing too) is much more
difficult.

Your point was?
My point is to suggest things that can improve the Python user
experience, and productivity too. I try to help, with the hope to have
something that I like more too.

It's very difficult to describe subtle GUI functionalities using a
texual description (expecially when you aren't using your native
language). If you try the Mathematica shell you may find some
differences I am talking about (even if I don't globally like the
Mathematica shell).
Editing an input block into idle feels different from editing a small
script inside an editor, there are differences that make the user
experience less good.
(And beside that it seems I often have problems running IDLE on Win PCs
with a firewall).

Bye,
bearophile

Dec 20 '06 #5
On 2006-12-20, be************@ lycos.com <be************ @lycos.comwrote :
For array.array "B" means unsigned char, and such arrays accept to be
initialized from (str) strings too, this is quite useful:
>>>from array import array
a = array("B", "hello")

But it seems such capability isn't shared with the append:
>>>a.extend("he llo")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: an integer is required
Try:
>>a.fromstring( "hello")
--
Neil Cerutti
I have opinions of my own -- strong opinions -- but I don't always agree with
them. --George W. Bush
Dec 20 '06 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

21
4152
by: Jeff Thies | last post by:
I'd like to randomly sort an array. A good method?
3
12257
by: Lee Crabtree | last post by:
I have a managed DLL that I've used to expose a C++ class. One of the functions in this class reads a line out of a file into a buffer of type "unsigned char*". Since all the data is just straight byte data (that is, I'm concerned with individual bits packed into the bytes), I'd like to put that data into a byte array that's passed from the...
10
2085
by: dfetrow410 | last post by:
Is there an example of how to store and access an array in a Property Dave
0
2817
by: Andrea | last post by:
My C# application is a drop target for the drop format Shell IDList Array I have some problems actually getting the data. I was using the same code used for the FileDrop data target but I'm getting an exception. What's the correct way to handle this type of data? I receive an invalid cast exception. Here's my non working code Array...
2
2534
by: James L Szatkowski, PE | last post by:
I'm using (successfully in VB Express) this routine: Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Call Shell("C:\Program Files\Internet Explorer\IEXPLORE.EXE http://www.microsoft.com", AppWinStyle.MinimizedNoFocus, True) Call Shell("C:\Program Files\Internet...
13
1950
by: David Golightly | last post by:
I'm getting my feet wet with JavaScript 1.7 (Firefox 2.0 only) and messing around with it in the console, working through some of the exercises given at http://developer.mozilla.org/en/docs/New_in_JavaScript_1.7 Looks like the "version" function isn't supported, at least not in the Firefox console. So many of the new features - especially...
14
12409
by: dan | last post by:
I would like to have the preprocessor automatically generate the number of array elements requested. Each element is zero. The elements get pasted into a larger array. The other elements may be non-zero. ***** Here is an example of what I need to do: #define YEAR_1 2005 #define YEAR_2 2007 #define YEARS (YEAR_2 - YEAR_1 + 1)
2
3241
by: Tom P. | last post by:
I am writing a file manager and I currently support simple, filename- based, drag-drop. I'd like to create the appropriate Shell IDList Array so that when a user drags a file into Paint or Photoshop or word it will open correctly. The research I've done points to "Shell IDList Array" but most of it is determining how to accept and parse the...
9
4484
by: Slain | last post by:
I need to convert a an array to a multidimensional one. Since I need to wrok with existing code, I need to modify a declaration which looks like this In the .h file int *x; in a initialize function: x = new int;
0
7741
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7661
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7977
Oralloy
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
1
7730
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
6347
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5550
isladogs
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5252
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3686
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1256
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.