Full stack trace in pdb.post_mortem() ?

2019-11-01 Thread John W
I'm trying to understand pdb.post_mortem(), and why the backtrace
available in the debugger session seems limited.

I posted a similar question on stackoverflow[1], but figured I'd try
here as well.

Here's a simple program

import pdb

def inner():
raise Exception("bad stuff")

def outer():
try:
inner()
except Exception as ex:
pdb.post_mortem()
# using breakpoint() gives the full stack trace, of course

def main():
outer()

main()

When I run that, I get put in the debugger.
Then, if I run the `bt` command to get a backtrace, I see:

(Pdb) bt
  /path/to/script(10)outer()
-> inner()
> /path/to/script(6)inner()
-> raise Exception("bad stuff")

As you can see, the backtrace only has `outer()` and `inner()`.
What happened to `main()`? I want the full stack available, so I can
investigate variables, etc. at any point along the chain.
(in a real example, there might be quite a lot of additional call
frames of interest)

For this contrived example, I can put `breakpoint()` instead of
`post_mortem()`, and get what I want.

But I feel like I'm misunderstanding post-mortem debugging.
Is the full call stack simply not available?

Note: I am aware that I can *print* the full stack trace (including
`main()`), even if it takes some special effort. See these posts:

* https://stackoverflow.com/questions/13210436/get-full-traceback/
* 
https://stackoverflow.com/questions/6086976/how-to-get-a-complete-exception-stack-trace-in-python



[1] 
https://stackoverflow.com/questions/58653016/get-full-backtrace-with-pdb-post-mortem
-- 
https://mail.python.org/mailman/listinfo/python-list


How to add one month to datetime?

2005-10-21 Thread John W
Hello,

I have been trying to figure out how to easily add just one month to a datetime object?

For example if my datetime is: 1/31/2005
I want to get 2/28/2005 after adding one month.

The max I can specify in a timedelta object is days.  However, since months vary in length, I can't just add 30 days.

I have seen where mxDateTimes are being used to do this, but I was
wondering if there is simple way of doing this with built in datetime
object?

Thanks in advance.

John
-- 
http://mail.python.org/mailman/listinfo/python-list

Asyncore Loop Question

2005-10-31 Thread John W
Hello,

I have a gui application where I am trying to use the asyncore module
to gather data from other computers.  I am able to connect, but I
am getting constant handle_write_event method calls into my
application.  It is obviously slowing down the gui processing
significantly.

My understanding is that the handle_write_event and handle_read_event
are both edge notifications and I should just get the method call
essentially just once.

I think the problem is how I have my loop() call configured.  All
I am trying to do with the code below is to open the socket (that
works) and then receive a single handle_write_event method call. 
Instead, I am getting constantly barraged with them.

I have tried several different types of the loop() call (using poll,
timeout...) but with no luck.  If anyone can explain what I should
be doing to get a single handle_write_event call until I actually write
something to the socket (which my code is not presently doing yet), I
would appreciate 

Below is some code showing what I am doing:

--
class Connection(asyncore.dispatcher):
    def __init__ (self, server_name, port_num ):
    self.message_queue = []

    asyncore.dispatcher.__init__(self)
    self.create_socket( socket.AF_INET, socket.SOCK_STREAM )
    self.connect(( server_name, port_num ))


    def handle_read_event( self ):
    print "handle_read_event received"


    def handle_write_event( self ):
    print "Asking for a write"

    if len( self.message_queue ) > 0:
    # Pop the first message off the queue
    self.send_next_message()


class TestApp:
    def __init__( self, server_name, port_number ):

    self.nomad = Connection( server_name, port_number )
    asyncore.loop()


Output ends up being a constant stream of:
Asking for a write
Asking for a write
Asking for a write
Asking for a write
Asking for a write

...
...
-- 
http://mail.python.org/mailman/listinfo/python-list

Re: Asyncore Loop Question

2005-10-31 Thread John W
Steve,

Ar you saying that I should close the connection until I have data to
write?  Or should I be using the readable and writable methods to
turn it off?

Thanks for your help, unfortunatly, I have struggled with the
documentation and getting a clear understanding of everything. 
This is my first socket program as well.

Thanks,

JohnOn 10/31/05, Steve Holden <[EMAIL PROTECTED]> wrote:
John W wrote:> Hello,>> I have a gui application where I am trying to use the asyncore module to> gather data from other computers. I am able to connect, but I am getting> constant handle_write_event method calls into my application. It is
> obviously slowing down the gui processing significantly.>> My understanding is that the handle_write_event and handle_read_event are> both edge notifications and I should just get the method call essentially
> just once.>> I think the problem is how I have my loop() call configured. All I am trying> to do with the code below is to open the socket (that works) and then> receive a single handle_write_event method call. Instead, I am getting
> constantly barraged with them.>> I have tried several different types of the loop() call (using poll,> timeout...) but with no luck. If anyone can explain what I should be doing> to get a single handle_write_event call until I actually write something to
> the socket (which my code is not presently doing yet), I would appreciate>> Below is some code showing what I am doing:>> --
> class Connection(asyncore.dispatcher):> def __init__ (self, server_name, port_num ):> self.message_queue = []>> asyncore.dispatcher.__init__(self)> self.create_socket( socket.AF_INET
, socket.SOCK_STREAM )> self.connect(( server_name, port_num ))>>> def handle_read_event( self ):> print "handle_read_event received">>> def handle_write_event( self ):
> print "Asking for a write">> if len( self.message_queue ) > 0:> # Pop the first message off the queue> self.send_next_message()>>> class TestApp:> def __init__( self, server_name, port_number ):
>> self.nomad = Connection( server_name, port_number )> asyncore.loop()>>> Output ends up being a constant stream of:> Asking for a write> Asking for a write> Asking for a write
> Asking for a write> Asking for a write> > ...> ...>>Normally if a socket channel asks for a write and you have no data youshould respond by removing it from the list of write-enabled channels
for the asyncore loop until you *do* have some data for it. Otherwiseevery time the loop scans the channels expecting notification it willtell you again that you can write to that channel.regards  Steve
--Steve Holden   +44 150 684 7255  +1 800 494 3119Holden
Web
LLC
www.holdenweb.comPyCon TX
2006  www.python.org/pycon/--http://mail.python.org/mailman/listinfo/python-list

-- 
http://mail.python.org/mailman/listinfo/python-list

Does Asyncore Send require newline?

2005-10-31 Thread John W
Hello,

I have a test environment that consists of a server and an application that opens an asyncore socket and communicates with it.

In my application, on the handle_write call, if I do not append a "\n"
to my message the server never gets the message.  If I do append
it, the server can read the message and act accordingly.

So my call looks like this:
self.send( message] + "\n")

Is this how it was designed?  Do you have to send a '\n' to have
the data read?  I can't find a whole lot of documentation on the
send method. 

If you could offer some help, I would appreciate it.

Thanks,

John
-- 
http://mail.python.org/mailman/listinfo/python-list

Re: Does Asyncore Send require newline?

2005-10-31 Thread John W
Hi Steve,

Here is what I have for my server (This code is really not that pretty, I apologize):

import socket
import SocketServer

class CommonServer(SocketServer.ThreadingTCPServer):
    def server_bind(self):
    """Override server_bind to store the server name."""
    SocketServer.TCPServer.server_bind(self)
    host, port = self.socket.getsockname()
    if not host or host == '0.0.0.0':
    host = socket.gethostname()
    hostname, hostnames, hostaddrs = socket.gethostbyaddr(host)
    if '.' not in hostname:
    for host in hostnames:
    if '.' in host:
   
hostname = host
    break
    self.server_name = hostname
    self.server_port = port
    
    print self.server_name
    print port

class CommonRequestHandler(SocketServer.StreamRequestHandler):
    def handle(self):
    print "Handling request"
    
    self.wfile.write('000 Connected ')
    datastart = 0
    while 1:
    print "looping"
    s = self.rfile.readline()
    print "Message:" + s
    if s[-2:] == ' ': s = s[:-2]
    elif s[-1:] == ' ': s = s[:-1]
    
    s = s[0:4]
    if s == 'QUIT':
    print "Quit"
    self.wfile.write('000 Bye\n')
    break
    elif s == 'NAME':
    print "Name"
   
self.wfile.write('000 My name is Python\n')
    elif s == 'DATA':
    print "Data"
   
self.wfile.write('000 Data Message\n' )
    else:
    print "Unknown"
   
self.wfile.write('200 Unknown Command\n')

    def setup(self):
    SocketServer.StreamRequestHandler.setup(self)

def test():
    portnum = 8001
    comserver = CommonServer(('', portnum), CommonRequestHandler )
    comserver.handle_request()
    
    print "Running"

if __name__ == '__main__':
    test()

Here is what I have for my client:
ASYNC_POLL_LENGTH = 0.05

class Connection(asyncore.dispatcher):
    def __init__ (self, server, socket_num):
    self.server_name = str( server )
    self.port_num = socket_num
    self.message_queue = []
    self.current_message = 0

    self.rcv_data = ""

    asyncore.dispatcher.__init__(self)
    self.create_socket( socket.AF_INET, socket.SOCK_STREAM )
    self.connect(( self.server_name, self.port_num ))

    def handle_connect( self ):
    print "CONNNECTED"

    # collect some more finger server output.
    def handle_read_event( self ):
    print "handle_read_event received"
    
    self.rcv_data = ""
    
    more = self.recv(512)
    print "More Data: %s" % more
    self.rcv_data = self.rcv_data + more
    print "RCV Data: %s" % self.rcv_data
    
    if self.current_message:
   
print "Message: %s   Type: %s 
RCV Data: %s" % (self.current_message['data'],
self.current_message['type'], self.rcv_data )
   
self.current_message['callback']( self.current_message, self.rcv_data )


    # the other side closed, we're done.
    def handle_close( self ):
    print 'Handling Close Event'
    self.connected_callback( False )

    def handle_write( self ):
    # If there is a message in the queue
    if len( self.message_queue ) > 0:
    # Pop the first message off the queue
    self.current_message = self.message_queue.pop(0)
    print "Sending Message: %s" % self.current_message['data']
    self.send(self.current_message['data'] + "\n")

    def queue( self, message ):
    self.message_queue.append( message )
    print "Message Queued: %s" % message['data']

#
class TestAppClient:
    def __init__( self, server, socket ):
    self.server = server
    self.socket = socket
 
    self.nomad = Connection( server, socket )
    asyncore.loop(count=1)

Then I use a timer to call "asyncore.loop(count=1)" every 10ms or on the IDLE loop of my GUI.

The line in red is what I have to append the '\n' to in order for my server to get it.

Thanks in advance,

John

On 10/31/05, Steve Holden <[EMAIL PROTECTED]> wrote:
John W wrote:> Hello,>> I have a test environment that consists of a server and an application that> opens an asyncore socket and communicates with it.>> In my application, on the handle_write call, 

Re: Microsoft Hatred FAQ

2005-10-15 Thread John W. Kennedy
Rhino wrote:
> Everyone
> else was still using typewriters - which was IBM's bread and butter in those
> days - for their business needs.

Oh dear, no. Not quite. There were, going back decades, machines that 
used punched cards, relays, stepper wheels, and punched cards. It was 
/that/ that was the foundation of IBM's business, and IBM had an 
effective monopoly. This was not altogether due to evil; their one 
competitor, Remington Rand, made machines that were slightly better, but 
had to be factory-programmed, whereas IBM's machines used panels full of 
jumper wires, and the panels themselves could be swapped, so that you 
could have a "program library" of prewired panels. Which would /you/ buy?

Remington Rand made a similar mistake with computers. They wouldn't give 
you a programming manual until you contracted to buy the bloody thing. 
IBM pulled ahead of them during the year when Univac computers were real 
and IBM computers weren't, and they never looked back.

-- 
John W. Kennedy
"Those in the seat of power oft forget their failings and seek only the 
obeisance of others!  Thus is bad government born!  Hold in your heart 
that you and the people are one, human beings all, and good government 
shall arise of its own accord!  Such is the path of virtue!"
   -- Kazuo Koike.  "Lone Wolf and Cub:  Thirteen Strings" (tr. Dana Lewis)
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Microsoft Hatred FAQ

2005-10-15 Thread John W. Kennedy
Tim Roberts wrote:
> "Jeroen Wenting"  wrote:
> 
>>Microsoft isn't evil, they're not a monopoly either.
>>If they were a monopoly they'd have 100% of the market and there'd be no 
>>other software manufacturers at all.
> 
> 
> This is wrong.  The dictionary definition of a monopoly is when a
> manufacturer has all or nearly all of a market.  Microsoft DOES have a
> monopoly on PC operating systems.
> 
> That, in itself, is not necessarily illegal.  However, Microsoft then USED
> that monopoly power to stifle their competition, and that IS illegal.
> 
> Part of their behavior really escape me.  The whole thing about browser
> wars confuses me.  Web browsers represent a zero billion dollar a year
> market.  Why would you risk anything to own it?

So they can disrupt standards and make it extremely difficult to create 
websites that work both with IE and with any non-Windows browser. The 
most blatant example is that, a full five years after XHTML came out, IE 
doesn't render it at all.

A few years ago, they did the same thing with browser plugins. IE used 
to support the same plugins that Netscape did. Then MS arbitrarily 
designed a new way of doing plugins that can only work with Windows (and 
which, incidentally, opens security holes), and removed support for 
standard plugins. As a result, plugin makers have to support two 
different plugins, or else choose between compatibility with IE and 
compatibility with everybody else.

The message -- "co-operate with us, or be punished".

-- 
John W. Kennedy
"...if you had to fall in love with someone who was evil, I can see why 
it was her."
   -- "Alias"
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Microsoft Hatred FAQ

2005-10-18 Thread John W. Kennedy
Michael Heiming wrote:
> Let's not forget about the Internet, they invented together with
> Al Gore and of course the wheel!

No fair picking on Al Gore. All he ever claimed was that he was the 
Congressional point man for the "Information Superhighway", which he was.

-- 
John W. Kennedy
Read the remains of Shakespeare's lost play, now annotated!
http://pws.prserv.net/jwkennedy/Double%20Falshood/index.html
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Microsoft Hatred FAQ

2005-10-18 Thread John W. Kennedy
[EMAIL PROTECTED] wrote:
> "John W. Kennedy" <[EMAIL PROTECTED]> writes:
> 
> 
>>Michael Heiming wrote:
>>
>>>Let's not forget about the Internet, they invented together with
>>>Al Gore and of course the wheel!
>>
>>No fair picking on Al Gore. All he ever claimed was that he was the
>>Congressional point man for the "Information Superhighway", which he
>>was.
> 
> 
> Well, what he said was
> 
>   "During my service in the United States Congress, I took the
>initiative in creating the Internet."
> 
> What you say he did is what he actually did, but what he said gives a
> different impression. I don't think he's careless or stupid, so I
> think he said that in order to create the impression in the minds of
> the people listening to the interview that he's responsible for the
> internet. 

For "the Internet" as 99% of the American people comprehend it, he /was/ 
largely responsible, on the political end. The fact that the 
"Information Superhighway" turned out to be implemented as a massive 
explosion of the former ARPANet was an unforeseeable accident of 
history, resulting from the coincidental timing of the "Information 
Superhighway" initiative, the introduction of the Web, and (to some 
degree) the ARPANet worm.

-- 
John W. Kennedy
"The pathetic hope that the White House will turn a Caligula into a 
Marcus Aurelius is as naïve as the fear that ultimate power inevitably 
corrupts."
   -- James D. Barber (1930-2004)
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Microsoft Hatred FAQ

2005-10-18 Thread John W. Kennedy
Mike Meyer wrote:
> "David Schwartz" <[EMAIL PROTECTED]> writes:
> 
>>It is not Microsoft's obligation to be "fair". It is Microsoft's 
>>obligation to push their vision of the future of computing, one with 
>>Microsoft's products at the center, using anything short of force or fraud.
> 
> 
> Wrong. The only obligation Microsoft has is to their shareholders.

If you genuinely believe that, you are a psychopath.

-- 
John W. Kennedy
"The poor have sometimes objected to being governed badly; the rich have 
always objected to being governed at all."
   -- G. K. Chesterton.  "The Man Who Was Thursday"
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Microsoft Hatred FAQ

2005-10-18 Thread John W. Kennedy
Jeroen Wenting wrote:
> And were later forced to rescind. The judge who wrote that opinion is well 
> known for his anti-Microsoft activism.

That's an outright lie.

-- 
John W. Kennedy
Read the remains of Shakespeare's lost play, now annotated!
http://pws.prserv.net/jwkennedy/Double%20Falshood/index.html
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Microsoft Hatred FAQ

2005-10-18 Thread John W. Kennedy
Rhino wrote:
> "John W. Kennedy" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
> 
>>Rhino wrote:
>>
>>>Everyone
>>>else was still using typewriters - which was IBM's bread and butter in
> 
> those
> 
>>>days - for their business needs.
>>
>>Oh dear, no. Not quite. There were, going back decades, machines that
>>used punched cards, relays, stepper wheels, and punched cards. It was
>>/that/ that was the foundation of IBM's business, and IBM had an
>>effective monopoly. This was not altogether due to evil; their one
>>competitor, Remington Rand, made machines that were slightly better, but
>>had to be factory-programmed, whereas IBM's machines used panels full of
>>jumper wires, and the panels themselves could be swapped, so that you
>>could have a "program library" of prewired panels. Which would /you/ buy?
>>
>>Remington Rand made a similar mistake with computers. They wouldn't give
>>you a programming manual until you contracted to buy the bloody thing.
>>IBM pulled ahead of them during the year when Univac computers were real
>>and IBM computers weren't, and they never looked back.
>>
> 
> Sorry, my mistake. I knew that IBM had collators and such things back in
> those days but I didn't know what percentage of their business they
> comprised. I used to work with a long-time IBMer who had started out in
> marketing in the 60s or so and I got the impression from him that
> typewriters were still the bulk of IBM's business. Perhaps he was just in
> that division and didn't know the "big picture".

Typewriters may, for all I know to the contrary, have been their main 
source of profit. But it wasn't what IBM was /about/. They got into the 
typewriter business by buying up a failing company.

IBM also made master/slave clock systems for schools and factories, 
including tower clocks (the IBM website has some fascinating archive 
material). They made dictation systems. They even made scales for 
butchers. But the heart of the business was punched cards, and one of 
the main reasons they became the leaders in the computer field is that 
computers were a natural extension of what they were already doing.

-- 
John W. Kennedy
"...when you're trying to build a house of cards, the last thing you 
should do is blow hard and wave your hands like a madman."
   --  Rupert Goodwins
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Microsoft Hatred FAQ

2005-11-02 Thread John W. Kennedy
entropy wrote:
> [EMAIL PROTECTED] wrote...
> 
>>On Tue, 25 Oct 2005 16:54:13 +, John Wingate wrote:
>>
>>
>>>Steven D'Aprano <[EMAIL PROTECTED]> wrote:
>>>
>>>>That would be a good guess, except that Microsoft's predatory and illegal
>>>>behaviour began long before OS/2 was even planned. It began in the mid
>>>>1970s, with MS DOS.
>>>
>>>Nitpick: MS-DOS first appeared in 1981.
>>
>>[slaps head]
>>
>>Of course it did.
> 
> 
> The first thing I ever bought of Microsoft's, in 1982 or so, was a 
> CP/M board for my Apple IIe.
> 
> CP/M, whose programmers to this day defend sticking with 8-bit CPUs 
> because 'they can't find a 4-bit chip they like'.  Yeah, there's some 
> desktop innovation for you.
> 
> OS/2 1.0 was released in 1987, but the "selling" of it started in 
> 1985 or so by IBM and Microsoft.  It was a 286 OS.  

Only to the extent that IBM promised a protected-mode operating system 
in 1984, when the PC-AT came out.

> IBM seems to have had a history of squeezing out competition in the 
> same way Microsoft has, if I recall correctly.

IBM was genuinely innovative, and did their best to provide value for 
money. Microsoft hasn't been able to produce anything but me-too 
products since the 80's. (Multiplan, Word for DOS, the QBASIC engine, 
early sponsorship of mouses, and the gutsy decision to morph MS-DOS 1.0, 
a CP/M quasi-clone, into DOS 2.0, a Unix quasi-clone, are about all I 
can give them credit for.)


-- 
John W. Kennedy
"Those in the seat of power oft forget their failings and seek only the 
obeisance of others!  Thus is bad government born!  Hold in your heart 
that you and the people are one, human beings all, and good government 
shall arise of its own accord!  Such is the path of virtue!"
   -- Kazuo Koike.  "Lone Wolf and Cub:  Thirteen Strings" (tr. Dana Lewis)
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Jargons of Info Tech industry

2005-08-26 Thread John W. Kennedy
CBFalconer wrote:
> Chris Head wrote:
> 
>  snip ...
> 
>>Why can't we use the Web for what it was meant for: viewing
>>hypertext pages? Why must we turn it into a wrapper around every
>>application imaginable?
> 
> 
> Because the Lord High PoohBah (Bill) has so decreed.  He has
> replaced General bullMoose.

Not particularly his doing. SGI was using a Netscape plugin to 
distribute and install operating-system patches when Billionaire 
"Intelligent Design" Billy was still denying that TCP/IP had a future.

And there are places for web forums: public feedback pages, for example. 
(Add RSS and/or e-mail and/or NNTP feeds for more advanced users.)

-- 
John W. Kennedy
"The grand art mastered the thudding hammer of Thor
And the heart of our lord Taliessin determined the war."
   -- Charles Williams.  "Mount Badon"
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: [perl-python] Python documentation moronicities (continued)

2005-04-13 Thread John W. Kennedy
Xah Lee wrote:
http://python.org/doc/2.4.1/lib/module-re.html
http://python.org/doc/2.4.1/lib/node114.html
-
QUOTE
The module defines several functions, constants, and an exception. Some
of the functions are simplified versions of the full featured methods
for compiled regular expressions. Most non-trivial applications always
use the compiled form
UNQUOTE
What does a programer who wants to use regex gets out from this piece
of motherfucking irrevalent drivel?
Until now, I have regarded you as a mildly amusing moron.
But now I find you're simply illiterate.
Buh-bye.
--
John W. Kennedy
A proud member of the reality-based community.
--
http://mail.python.org/mailman/listinfo/python-list


Re: Xah's Edu Corner: Tech Geekers and their Style

2006-01-01 Thread John W. Kennedy
Xah Lee wrote:
> With all the whizbang of styles and features in CSS2, a basic,
> necessary, functional layout feature as multi-columns is not there yet.
> This is a indication of the fatuousness of the IT industry's
> technologies and its people.

No, this is an indication of what happens to an industry paralyzed by 
organized crime and a corrupt government.

Microsoft delendum est.

-- 
John W. Kennedy
"But now is a new thing which is very old--
that the rich make themselves richer and not poorer,
which is the true Gospel, for the poor's sake."
   -- Charles Williams.  "Judgement at Chelmsford"
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: What is Expressiveness in a Computer Language

2006-06-22 Thread John W. Kennedy
Rob Warnock wrote:
> Another language which has *neither* latent ("dynamic") nor
> manifest ("static") types is (was?) BLISS[1], in which, like
> assembler, variables are "just" addresses[2], and values are
> "just" a machine word of bits.

360-family assembler, yes. 8086-family assembler, not so much.

-- 
John W. Kennedy
"The blind rulers of Logres
Nourished the land on a fallacy of rational virtue."
   -- Charles Williams.  "Taliessin through Logres: Prelude"
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: What are OOP's Jargons and Complexities?

2005-05-23 Thread John W. Kennedy
Xah Lee wrote:
> So, a simple code like this in normal languages:
> a = "a string";
> b = "another one";
> c = join(a,b);
> print c;
> 
> or in lisp style
> (set a "a string")
> (set b "another one")
> (set c (join a b))
> (print c)
> 
> becomes in pure OOP languages:
> public class test {
>   public static void main(String[] args) {
> String a = new String("a string");
> String b = new String("another one");
> StringBuffer c = new StringBuffer(40);
> c.append(a); c.append(b);
> System.out.println(c.toString());
> }
> }

The actual Java parallel to what you have written above is:

 String a = "a string";
 String b = "another one";
 String c = a + b;
 System.out.println (c);

> In the same way, numbers in Java have become a formalization of many
> classes: Double, Float, Integer, Long... and each has a bunch of
> "methods" to operate or convert from one to the other.

Byte, Short, Integer, Long, Char, Float and Double are wrapper classes, 
which exist chiefly to allow primitive content to be stored in 
collection classes.

byte, short, int, long, char, float, and double are primitives.

> Instead of
> aNumber = 3;
> print aNumber^3;
> 
> In Java the programer needs to master the ins and outs of the several
> number classes, and decide which one to use. (and if a program later
> needs to change from one type of number to another, it is often
> cumbersome.)

This has nothing to do with object orientation or classes, but with 
strong typing, which is important for program verification, and an 
inescapable necessity for compiling to efficient object code. Strong 
typing has been a feature of mainstream programming languages since the 
late 1950's.

-- 
John W. Kennedy
"The bright critics assembled in this volume will doubtless show, in 
their sophisticated and ingenious new ways, that, just as /Pooh/ is 
suffused with humanism, our humanism itself, at this late date, has 
become full of /Pooh./"
   -- Frederick Crews.  "Postmodern Pooh", Preface
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: What are OOP's Jargons and Complexities?

2005-05-23 Thread John W. Kennedy
alex goldman wrote:
> John W. Kennedy wrote:
> 
> 
>>Strong
>>typing has been a feature of mainstream programming languages since the
>>late 1950's.
> 
> 
> I'm just curious, what do you mean by /strong/ typing, and which strongly
> typed languages do you know?

Unfortunately, I have seen the meaning shift with the context. In Ada 
'83, it means it is not possible to have the equivalent of a C 
unprototyped function, and that mixed-type expressions tend to need 
explicit casting. In other contexts (as here), I've seen it used to mean 
simply that variables have definite types, and it is not possible 
(except by the use of polymorphic classes) for a variable to change from 
an integer to a float to a character string in the course of execution. 
In this sense, compile-to-machine-code languages (ee.g., Fortran, COBOL, 
C, C++, or Pascal), are generally strongly typed and interpreted 
languages (ee.g., shell scripts, Perl, REXX, APL, or LISP) are generally 
not. (In pure OO languages, such as SmallTalk or Ruby, the distinction 
may not really apply, since all variables are of the single type 
reference-to-root-class.)

-- 
John W. Kennedy
"The bright critics assembled in this volume will doubtless show, in 
their sophisticated and ingenious new ways, that, just as /Pooh/ is 
suffused with humanism, our humanism itself, at this late date, has 
become full of /Pooh./"
   -- Frederick Crews.  "Postmodern Pooh", Preface
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: What are OOP's Jargons and Complexities?

2005-05-24 Thread John W. Kennedy
alex goldman wrote:
> John W. Kennedy wrote:
> 
> 
>>Strong
>>typing has been a feature of mainstream programming languages since the
>>late 1950's.
> 
> 
> Is Fortran a strongly typed language? I don't think so. Strong typing has
> been invented in the 70's, if I'm not mistaken, when ML was invented, but
> strong typing has never been mainstream.

I begin to believe that I have been reading naughty references, and that 
I should rather have said "statically typed".

I am not familiar with modern Fortran. Surely it at least has argument 
prototyping by now?

-- 
John W. Kennedy
"You can, if you wish, class all science-fiction together; but it is 
about as perceptive as classing the works of Ballantyne, Conrad and W. 
W. Jacobs together as the 'sea-story' and then criticizing _that_."
   -- C. S. Lewis.  "An Experiment in Criticism"
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: MI5 Persecution: Goldfish and Piranha 29/9/95 (5104)

2007-06-18 Thread John W. Kennedy
Mike wrote:
> And this is here because ???

He's a broadband-spamming mental case. Plonk him and move on.
-- 
John W. Kennedy
If Bill Gates believes in "intelligent design", why can't he apply it to 
Windows?
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Portable general timestamp format, not 2038-limited

2007-07-02 Thread John W. Kennedy
Martin Gregorie wrote:
> Roedy Green wrote:
>>
>> To add to the confusion you have GPS, Loran and Julian day also used
>> as scientific times.
>  >
> GPS time is UTC time

No it isn't. GPS has never introduced a leap second, and is still on 
uncorrected UTC-as-of-1980. However, the GPS signal also includes an 
occasional UTC correction figure, so it can be used to obtain UTC.
-- 
John W. Kennedy
"The first effect of not believing in God is to believe in anything"
   -- Emile Cammaerts, "The Laughing Prophet"
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Regular expression use

2007-08-25 Thread John W. Krahn
Nick Maclaren wrote:
> In article <[EMAIL PROTECTED]>,
> Mirco Wahab <[EMAIL PROTECTED]> writes:
> |> 
> |> Using complex regular expressions is like tank destruction
> |> with contact charges glued on them.  Only a few people
> |> will even survive the first "usage", but survivors will
> |> then eventually be able to destroy almost every tank with
> |> tremendous speed and precision.
> 
> I must remember that!  It is nicely put.

I couldn't understand it.  (An old Centurion trooper.)


John
-- 
Perl isn't a toolbox, but a small machine shop where you
can special-order certain sorts of tools at low cost and
in short order.-- Larry Wall
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: On Java's Interface (the meaning of interface in computer programing)

2007-03-23 Thread John W. Kennedy
Lew wrote:
> But if Xah were being trollish, why didn't they jump on my response and 
> call me names?

I'm not sure he's a proper troll. Unfortunately, he seems to be the kind 
of person who thinks that reading "Java for Dummies" makes one a 
self-sufficient expert on Java and philosopher of programming languages 
to boot, and who is very eager to bestow upon the world all his 
brilliant insights.

At least, that explanation is consistent with his historic behavior.

-- 
John W. Kennedy
"Only an idiot fights a war on two fronts.  Only the heir to the throne 
of the kingdom of idiots would fight a war on twelve fronts"
  -- J. Michael Straczynski.  "Babylon 5", "Ceremonies of Light and Dark"
* TagZilla 0.066 * http://tagzilla.mozdev.org
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: The meaning of a = b in object oriented languages

2007-09-20 Thread John W. Kennedy
Russell Wallace wrote:
> Summercool wrote:
>> so most or all object oriented language do assignment by reference?
>> is there any object oriented language actually do assignment by
>> value?  I kind of remember in C++, if you do
>>
>> Animal a, b;
>>
>> a = b will actually be assignment by value.
>> while in Java, Python, and Ruby, there are all assignment by
>> reference.  ("set by reference")
>>
>> Is that the case: if a is an object, then b = a is only copying the
>> reference?
> 
> Yes, your understanding is exactly correct; C++ will assign by value 
> unless you explicitly use pointers, but the other languages will assign 
> by reference (except for primitive types).

Ada also assigns by value absent explicit use of access variables 
(similar to pointers or references).

The question, in fact, is meaningless. Java has a certain defined 
behavior. C++ has a certain defined behavior. Smalltalk has a certain 
defined behavior. LISP has a certain defined behavior. Ada has a certain 
defined behavior. Object-oriented languages as a class do not.
-- 
John W. Kennedy
"The poor have sometimes objected to being governed badly; the rich have 
always objected to being governed at all."
   -- G. K. Chesterton.  "The Man Who Was Thursday"
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: which language allows you to change an argument's value?

2007-10-06 Thread John W. Kennedy
Roedy Green wrote:
> On Sun, 30 Sep 2007 10:47:13 -, Summercool
> <[EMAIL PROTECTED]> wrote, quoted or indirectly quoted someone
> who said :
>> and now n will be 3.  I think C++ and PHP can let you do that, using
>> their reference (alias) mechanism.  And C, Python, and Ruby probably
>> won't let you do that.  What about Java and Perl?

> Seem to me you could in FORTRAN and Pascal, and maybe even Algol. 

FORTRAN generally looked like call by reference, but was often actually 
implemented element variables as copy-in at call time and copy-out at 
return time. In standard older FORTRAN, the effective results were the 
same. I don't know how things stand with modern Fortran, where some new 
features have made the assumption that copy-in-copy-out is equivalent to 
reference more dangerous. Ada is /defined/ as using copy-in-copy-out for 
element variables.

ALGOL had a weird "by name" convention. The semantics were essentially 
that, for each argument, a closure (historically called a "thunk") was 
constructed, and every time the parameter was referenced, the 
corresponding closure was called. Theoretically elegant, but hideous to 
implement, and with bizarre side-effects in certain cases.
-- 
John W. Kennedy
Read the remains of Shakespeare's lost play, now annotated!
http://pws.prserv.net/jwkennedy/Double%20Falshood/index.html
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: The Modernization of Emacs: terminology buffer and keybinding

2007-10-11 Thread John W. Kennedy
[EMAIL PROTECTED] wrote:
> Do not bluntly contradict me in public.

You are in grave need of professional psychiatric help.

Seek it now, if you do not wish your life to be ended three or four 
years down the line by a police sniper.

-- 
John W. Kennedy
Read the remains of Shakespeare's lost play, now annotated!
http://pws.prserv.net/jwkennedy/Double%20Falshood/index.html
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Mathematica 7 compares to other languages

2008-12-10 Thread John W Kennedy

Xah Lee wrote:

In lisp, python, perl, etc, you'll have 10 or so lines. In C or Java,
you'll have 50 or hundreds lines.


C:

#include 
#include 

void normal(int dim, float* x, float* a) {
   float sum = 0.0f;
   int i;
   float divisor;
   for (i = 0; i < dim; ++i) sum += x[i] * x[i];
   divisor = sqrt(sum);
   for (i = 0; i < dim; ++i) a[i] = x[i]/divisor;
}

Java:

static float[] normal(final float[] x) {
   float sum = 0.0f;
   for (int i = 0; i < x.length; ++i) sum += x[i] * x[i];
   final float divisor = (float) Math.sqrt(sum);
   float[] a = new float[x.length];
   for (int i = 0; i < x.length; ++i) a[i] = x[i]/divisor;
   return a;
}


--
John W. Kennedy
 "Never try to take over the international economy based on a radical 
feminist agenda if you're not sure your leader isn't a transvestite."

  -- David Misch:  "She-Spies", "While You Were Out"
--
http://mail.python.org/mailman/listinfo/python-list


Re: The Importance of Terminology's Quality

2008-06-24 Thread John W Kennedy

David Combs wrote:

passing
*unnamed* functions as args (could Algol 60 also do something like that,
via something it maybe termed a "thunk")


No, the "thunks" were necessary at the machine-language level to 
/implement/ ALGOL 60, but they could not be expressed /in/ ALGOL.


--
John W. Kennedy
 "The first effect of not believing in God is to believe in anything"
  -- Emile Cammaerts, "The Laughing Prophet"
--
http://mail.python.org/mailman/listinfo/python-list


Problem found in tutorial

2008-06-24 Thread John W. Hamill
20JUN2008
By John W. Hamill


Errata found in Python tutorial
http://www.python.org
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - 

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - 
Error Found by John W. Hamill
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - 
C:\__jh\ftp\python\2_5_2\doc\tutorial\node11.html

>>> unique_words = set(word  for line in page  for word in line.split())

>>> valedictorian = max((student.gpa, student.name) for student in
graduates)

NOTE:  page and graduates are not defined and this won't run without them.
   I defined them like so to make this work:

page = ("The quick brown","fox jumped over","the lazy dog's","back 123
times." )

class Graduate:
def __init__(self, name, gpa):
self.name = name
self.gpa  = gpa
gpa = 0
name = ""

graduates = (Graduate("Charlie Brown",8.09), Graduate("Snoopy",3.7),
Graduate("Lucy Brown",3.5))


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


John W. Hamill
4503 Elmwood Avenue
Royal Oak, MI 48073-1548
(248)549-2406
elbarto99(AT)netzero.net


Be your own boss today! Easy Fitness Franchises. Click here.
http://thirdpartyoffers.netzero.net/TGL2241/fc/Ioyw6i4vFgOmNNBahnUR5DjpJH9D5T8G7gJ7ScC35A7uLIE47CuV8M/
--
http://mail.python.org/mailman/listinfo/python-list


Re: The Importance of Terminology's Quality

2008-07-01 Thread John W Kennedy

Robert Maas, http://tinyurl.com/uh3t wrote:

Why this response is so belated:
  <http://groups.google.com/group/misc.misc/msg/cea714440e591dd2>
= <news:[EMAIL PROTECTED]>

Date: Tue, 24 Jun 2008 18:42:15 -0400
From: John W Kennedy <[EMAIL PROTECTED]>
... the "thunks" were necessary at the machine-language level to
/implement/ ALGOL 60, but they could not be expressed /in/ ALGOL.


Ah, thanks for the clarification. Is that info in the appropriate
WikiPedia page? If not, maybe you would edit it in?


It is explained s.v. "thunk", which is referenced from "ALGOL 60". The 
ALGOL "pass-by-name" argument/parameter matching was perhaps the most 
extreme example ever of a language feature that was "elegant" but 
insane. What it meant, in effect, was that, unless otherwise marked, 
every argument was passed as two closures, one that returned a fresh 
evaluation of the expression given as the argument, which was called 
every time the parameter was read, and one that set the argument to a 
new value, which was called every time the parameter was set.


See http://www.cs.sfu.ca/~cameron/Teaching/383/PassByName.html>.

ALGOL 60 could not create generalized user-written closures, but could 
create one no more complex than a single expression with no arguments of 
its own simply by passing the expression as an argument. But it was not 
thought of as a closure; that was just how ALGOL 60 did arguments.

--
John W. Kennedy
 "Give up vows and dogmas, and fixed things, and you may grow like 
That. ...you may come to think a blow bad, because it hurts, and not 
because it humiliates.  You may come to think murder wrong, because it 
is violent, and not because it is unjust."

  -- G. K. Chesterton.  "The Ball and the Cross"
--
http://mail.python.org/mailman/listinfo/python-list


Re: The Importance of Terminology's Quality

2008-07-20 Thread John W Kennedy

Robert Maas, http://tinyurl.com/uh3t wrote:

... the "thunks" were necessary at the machine-language level to
/implement/ ALGOL 60, but they could not be expressed /in/ ALGOL.

Ah, thanks for the clarification. Is that info in the appropriate
WikiPedia page? If not, maybe you would edit it in?

From: John W Kennedy <[EMAIL PROTECTED]>
It is explained s.v. "thunk", which is referenced from "ALGOL
60". The ALGOL "pass-by-name" argument/parameter matching was
perhaps the most extreme example ever of a language feature that
was "elegant" but insane. What it meant, in effect, was that,
unless otherwise marked, every argument was passed as two closures,
one that returned a fresh evaluation of the expression given as the
argument, which was called every time the parameter was read, and
one that set the argument to a new value, which was called every
time the parameter was set.


Wow! All these years when I occasionally heard of a "thunk" I never
was told, until now, what it really meant. Thanks for the info!!

Followup question #1: I assume these are lexical closures in the
environment of the point of the call, right?


Yes. (Actually, subprogram calls are first described as working like 
macro expansions, but then the specification adds that there must be 
magic fixups so that variable names are resolved in point-of-call 
context anyway.)


At this point in the history of computing, the conceptual distinction 
between subprograms and macros was not at all clear. It was quite 
possible to have "macros" that generated an out-of-line subprogram once 
and then generated calling code the first time and every time thereafter 
(it was a way of life on systems without linkage editors or linking 
loaders), and it was also quite possible to refer to in-line macro 
expansions as "subprograms". I suspect that the triumph of FORTRAN may 
have had something to do with cleaning up the terminological mess by the 
mid-60s.


Into the 60s, indeed, there were still machines being made that had no 
instruction comparable to the mainframe BASx/BALx family, or to Intel's 
CALL. You had to do a subprogram call by first overwriting the last 
instruction of what you were calling with a branch instruction that 
would return back to you.



Followup question #2: For simple arithmetic expressions, I can
possibly understand how the UPDATE closure might be implemeted
(expressed in Lisp to make the intent clear):
  Call form:  MyFunction(X+2);
  GET closure:  (+ closedX 2)
  UPDATE closure:  (lambda (newval) (setf closedX (- newval 2))
Thus from inside MyFunction where formal parameter Arg1 is bound
to actual parameter X+2, after doing Arg1 := 7; X will have the
value 5 so that calling Arg1 will return 7 as expected, right?
But if the actual argument is something complicated, especially if
it makes a nested function call, how can that possibly be
implemented?


It was forbidden. In the formal definition of ALGOL 60, there was no 
such thing as an external subprogram (except for non-ALGOL code, which 
was treated as magic), so the whole program was supposed to be one 
compile. Therefore, a theoretical compiler could verify that any 
parameter used as an LHS was always matched with an argument that was a 
variable. (However, a "thunk" was still required to evaluate any array 
index and, possibly, to convert between REAL and INTEGER variables.) 
Many actual compilers /did/ support separate complication as a language 
extension -- I suppose they had to use run-time checking.


--
John W. Kennedy
 "Compact is becoming contract,
Man only earns and pays."
  -- Charles Williams.  "Bors to Elayne:  On the King's Coins"
--
http://mail.python.org/mailman/listinfo/python-list


Re: The Importance of Terminology's Quality

2008-07-22 Thread John W Kennedy

Martin Gregorie wrote:

I used Algol 60 on an Elliott 503 and the ICL 1900 series back when it was
a current language. The term "thunking" did not appear in either compiler
manual nor in any Algol 60 language definition I've seen.


It doesn't have to; Algol 60 thunks are not part of the language. 
However, practical implementation of Algol 60 call by name means that 
thunks are created by every Algol 60 compiler, and the word "thunk" was 
coined in 1961 to designate them.



A60 could pass
values by name or value and procedures by name. That was it. Call by name
is what is now referred to as reference passing.


Either you misunderstood (because in many simple cases the semantics of 
call-by-reference and call-by-name cannot be distinguished) or the 
compiler you used implemented non-standard Algol (which was fairly 
common in compilers meant for day-to-day practical work). Algol 
call-by-name was a unique form that subsequent language designers have 
recoiled from in horror.


(Historically, "call-by-name" has sometimes been used in non-Algol 
contexts to mean "call-by-reference".)



Algol 60 did not have 'functions'. It had procedures which could be
declared to return values or not. A procedure that returned a value was
equivalent to a function but the term 'function' was not used.


This is simply wrong. You are accurately describing the language syntax, 
 which used (as PL/I does) the keyword "procedure" for both functions 
and subroutines, but Algol documentation nevertheless referred to 
"functions".



Similarly
it did not have a mechanism for declaring anonymous procedures. That, like
the incorporation of machine code inserts, would have been a
compiler-specific extension, so it is a terminological mistake to refer to
it without specifying the implementing compiler.


Standards-conforming Algol compilers had a limited ability to create 
de-facto anonymous functions in the call-by-name implementation.


--
John W. Kennedy
 "Information is light. Information, in itself, about anything, is light."
  -- Tom Stoppard. "Night and Day"
--
http://mail.python.org/mailman/listinfo/python-list


Re: The Importance of Terminology's Quality

2008-07-22 Thread John W Kennedy

Rob Warnock wrote:

Thunks were something used by Algol 60
*compiler writers* in the code generated by their compilers to
implement the semantics of Algol 60 call-by-name, but were not
visible to users at all [except that they allowed call-by-name
to "work right"].


...unless you were a system programmer and had to write Algol-friendly 
assembler.




--
John W. Kennedy
 "Give up vows and dogmas, and fixed things, and you may grow like 
That. ...you may come to think a blow bad, because it hurts, and not 
because it humiliates.  You may come to think murder wrong, because it 
is violent, and not because it is unjust."

  -- G. K. Chesterton.  "The Ball and the Cross"
--
http://mail.python.org/mailman/listinfo/python-list


Re: The Importance of Terminology's Quality

2008-08-14 Thread John W Kennedy

Robert Maas, http://tinyurl.com/uh3t wrote:

John W Kennedy <[EMAIL PROTECTED]> wrote:
JWK> Into the 60s, indeed, there were still machines being made
JWK> that had no instruction comparable to the mainframe BASx/BALx
JWK> family, or to Intel's CALL. You had to do a subprogram call by
JWK> first overwriting the last instruction of what you were
JWK> calling with a branch instruction that would return back to
JWK> you.

That's not true, that you needed to do that, that there was no
other way available. The subroutine linkage I invented for S.P.S.
(Symbolic Programming System, i.e. IBM 1620 assembly language) was
to reserve a 5-digit space immediately before the subroutine entry
point for storing the return address. So the caller needed to know
only one address, the entry point, and do both store-return-address
and jump relative to that address, rather than needing to know both
the entry point and the last-instruction-JUMP-needs-patch address
as independent items of information. So calling a subroutine was
two instructions (pseudo-code here):
   literal[nextAdrOfSelf} -> memory[SubrEntryPoint-1]
   jump to SubrEntryPoint
and returning from a subroutine was two instructios:
   copy memory[SubrEntryPoint-1] -> memory[here + 11]
   jump to 0 ;These zeroes replaced by return address just above
Of course if you needed to pass parameters and/or return value,
that was handled separately, perhaps by reserving additional
storage just before the return address. Of course this methodology
didn't support recursion.

So my method required one extra instruction per return point, but
allowed multiple return points from a single subroutine, and
allowed "encapsulation" of the relation between entry point and
return point.

Note: On IBM 1620, instructions and forward-sweeping data records
were addressed by their *first* digit, whereas arithmetic fields
were addressed by their *last* digit, the low-order position, to
support natural add-and-carry operations. Storage was decimal
digits, with two extra bits, flag to indicate negative value (if in
low-order position) or high-order-end (if in any other position),
and parity. Values larger than nine were reserved for special
purposes, such as RECORD MARK used to terminate right-sweep data
records. Because of that, the low-order position of the return
address and the first digit of the machine instruction at the
subroutine entry point differed by only machine address, hence the
SubrEntryPoint-1 instead of SubrEntryPoint-5 you would otherwise
expect.

Hmm, I suppose if I had thought it out more at the time, I might have
done it slightly differently:

Entry point like this:
 jump 0 ;Patched by caller to contain return address
  Entry: ...(regular code)...
  ...

Each return point like this:
 jump Entry-12


I wonder if anybody ever implemented a stack on the IBM 1620?
Probably not, because it would take a lot more machine instructions
to push and pop, and if you weren't writing anything recursive then
extra work for no extra benefit except saving a few digits of
memory if your maximum stack depth is less than the total number of
subroutines you have loaded, except the extra instructions more
than kill off the storage savings.

Hmm, I suppose you could have a auxilary function that serves as
trampoline for stack-based call and return. To call, you move your
own return address and address of subroutine to fixed locations in
low memory then jump to the call trampoline, which pushes the
return address onto the stack and jumps at entry address. To
return, you just jump to the return trampoline, which pops the
return address off the stack and jumps at it. The trampoline,
occuping memory only *once*, could afford to have code to safely
check for stack over/under flow.


Actually, I was thinking of the 1401. But both the 1620 and the 1401 
(without the optional Advanced Programming Feature) share the basic 
omission of any instruction that could do call-and-return without 
hard-coding an adcon with the address of the point to be returned to. 
(The Advanced Programming Feature added a 1401 instruction, Store 
B-address Register, that, executed as the first instruction of a 
subroutine, could store the return-to address.)


The 1620, oddly enough, /did/ have call instructions (Branch and 
Transfer, and Branch and Transfer Immediate) and a return instruction 
(Branch Back), but with a hard-wired stack depth of 1.


--
John W. Kennedy
 "When a man contemplates forcing his own convictions down another 
man's throat, he is contemplating both an unchristian act and an act of 
treason to the United States."

  -- Joy Davidman, "Smoke on the Mountain"
--
http://mail.python.org/mailman/listinfo/python-list


Re: The Importance of Terminology's Quality

2008-08-16 Thread John W Kennedy

Martijn Lievaart wrote:

On Thu, 14 Aug 2008 18:33:30 -0400, John W Kennedy wrote:


Actually, I was thinking of the 1401. But both the 1620 and the 1401
(without the optional Advanced Programming Feature) share the basic
omission of any instruction that could do call-and-return without
hard-coding an adcon with the address of the point to be returned to.
(The Advanced Programming Feature added a 1401 instruction, Store
B-address Register, that, executed as the first instruction of a
subroutine, could store the return-to address.)


Rgh

Don't. Bring. Back. Those. Nightmares. Please.

The 1401 was a decent enough processor for many industrial tasks -- at 
that time -- but for general programming it was sheer horror.


But the easiest machine language /ever/.

--
John W. Kennedy
 "The grand art mastered the thudding hammer of Thor
And the heart of our lord Taliessin determined the war."
  -- Charles Williams.  "Mount Badon"
--
http://mail.python.org/mailman/listinfo/python-list


Re: The Importance of Terminology's Quality

2008-08-17 Thread John W Kennedy

Martin Gregorie wrote:

On Sat, 16 Aug 2008 21:46:18 -0400, John W Kennedy wrote:


Martijn Lievaart wrote:

On Thu, 14 Aug 2008 18:33:30 -0400, John W Kennedy wrote:


Actually, I was thinking of the 1401. But both the 1620 and the 1401
(without the optional Advanced Programming Feature) share the basic
omission of any instruction that could do call-and-return without
hard-coding an adcon with the address of the point to be returned to.
(The Advanced Programming Feature added a 1401 instruction, Store
B-address Register, that, executed as the first instruction of a
subroutine, could store the return-to address.)

Rgh

Don't. Bring. Back. Those. Nightmares. Please.

The 1401 was a decent enough processor for many industrial tasks -- at
that time -- but for general programming it was sheer horror.

But the easiest machine language /ever/.


What? Even easier than ICL 1900 PLAN or MC68000 assembler? That would be 
difficult to achieve.


I said "machine language" and I meant it. I haven't touched a 1401 since 
1966, and haven't dealt with a 1401 emulator since 1968, but I can 
/still/ write a self-booting program. In 1960, some people still looked 
on assemblers (to say nothing of compilers) as a useless waste of 
resources that could be better applied to end-user applications, and the 
1401 was designed to be programmable in raw machine language. Even shops 
that used assembler nevertheless frequently did bug fixes as 
machine-language patches, rather than take the time to run the assembler 
again. (SPS, the non-macro basic assembler, ran at about 70 lines a 
minute, tops.)


--
John W. Kennedy
 "The bright critics assembled in this volume will doubtless show, in 
their sophisticated and ingenious new ways, that, just as /Pooh/ is 
suffused with humanism, our humanism itself, at this late date, has 
become full of /Pooh./"

  -- Frederick Crews.  "Postmodern Pooh", Preface
--
http://mail.python.org/mailman/listinfo/python-list


Re: The Importance of Terminology's Quality

2008-08-22 Thread John W Kennedy

Martin Gregorie wrote:
Not necessarily. An awful lot of CPU cycles were used before microcode 
was introduced. Mainframes and minis designed before about 1970 didn't 
use or need it


No, most S/360s used microcode.

--
John W. Kennedy
 "There are those who argue that everything breaks even in this old 
dump of a world of ours. I suppose these ginks who argue that way hold 
that because the rich man gets ice in the summer and the poor man gets 
it in the winter things are breaking even for both. Maybe so, but I'll 
swear I can't see it that way."

  -- The last words of Bat Masterson
--
http://mail.python.org/mailman/listinfo/python-list


Re: The Importance of Terminology's Quality

2008-08-22 Thread John W Kennedy

Rob Warnock wrote:

What was the corresponding 1401 boot sequence?


The 1401 had a boot-from-tape-1 button on the console, and a 
boot-from-card button on the card reader. You couldn't truly boot from a 
disk; you loaded a little starter deck of about 20 cards on the card reader.


On the 1401, the typewriter was an optional luxury, mainly used in long 
batch jobs to do ad-hoc on-line queries. On the compatible 1460, the 
typewriter was somewhat more common, because the console the typewriter 
mounted on was a standard part of the system, so only the typewriter had 
to be added.


--
John W. Kennedy
 "You can, if you wish, class all science-fiction together; but it is 
about as perceptive as classing the works of Ballantyne, Conrad and W. 
W. Jacobs together as the 'sea-story' and then criticizing _that_."

  -- C. S. Lewis.  "An Experiment in Criticism"
--
http://mail.python.org/mailman/listinfo/python-list


Re: The Importance of Terminology's Quality

2008-08-23 Thread John W Kennedy

Martin Gregorie wrote:

On Sat, 23 Aug 2008 00:06:28 -0400, John W Kennedy wrote:


Martin Gregorie wrote:

Not necessarily. An awful lot of CPU cycles were used before microcode
was introduced. Mainframes and minis designed before about 1970 didn't
use or need it

No, most S/360s used microcode.


I never used an S/360.

I thought microcode came into the IBM world with S/370 and Future Series 
(which later reappeared as the AS/400, which I did use). Didn't the S/370 
load its microcode off an 8 inch floppy?


Some did, but not all. The 370/145 was the first, and made a big splash 
thereby.


As to the 360s:

 20  (Incompatible subset)  I don't know
 22  (Recycled end-of-life 30)  CROS
 25 Loaded from punched cards
 30 CROS
 40 TROS
 44  (Subset)   None
 50 CROS
 60, 62, 65 ROS
 64, 66, 67 ROS
 70, 75 None
 85 I don't know
 91, 95 I don't know -- probably none
 195I don't know

CROS used plastic-coated foil punched cards as the dielectrics of 960 
capacitors each.


TROS used little transformer coils that might or might not be severed.

ROS means it was there, but I don't know the technology.
--
John W. Kennedy
 "Those in the seat of power oft forget their failings and seek only 
the obeisance of others!  Thus is bad government born!  Hold in your 
heart that you and the people are one, human beings all, and good 
government shall arise of its own accord!  Such is the path of virtue!"

  -- Kazuo Koike.  "Lone Wolf and Cub:  Thirteen Strings" (tr. Dana Lewis)
--
http://mail.python.org/mailman/listinfo/python-list


Re: sed/awk/perl: How to replace all spaces each with an underscore that occur before a specific string ?

2009-08-22 Thread John W. Krahn

bolega wrote:

sed/awk/perl:

How to replace all spaces each with an underscore that occur before a
specific string ?

I really prefer a sed one liner.

Example
Input :  This is my book. It is too  thick to read. The author gets
little royalty but the publisher makes a lot.
Output: This_is_my_book._It_is_too__thick_to read. The author gets
little royalty but the publisher makes a lot.

We replaced all the spaces with underscores before the first occurence
of the string "to ".


$ perl -le'
$x = "This is my book. It is too  thick to read. The author gets little 
royalty but the publisher makes a lot.";

print $x;
$x =~ /to / && substr( $x, 0, $-[0] ) =~ tr/ /_/;
print $x;
'
This is my book. It is too  thick to read. The author gets little 
royalty but the publisher makes a lot.
This_is_my_book._It_is_too__thick_to read. The author gets little 
royalty but the publisher makes a lot.





John
--
Those people who think they know everything are a great
annoyance to those of us who do.-- Isaac Asimov
--
http://mail.python.org/mailman/listinfo/python-list