From bowman@montana.com  Wed Sep  1 04:22:30 1999
From: bowman@montana.com (bowman)
Date: Tue, 31 Aug 1999 21:22:30 -0600
Subject: [Tutor] Simulating fileEvent
Message-ID: <37CC9BF6.A480E971@montana.com>

Evgeny Roubinchtein wrote:
>
> Well, I am sort of stumped on translating "fileevent": looking at its
> man page, it behaves just like the TK/Tkinter's "bind" method, except
> that "bind" calls a procedure when there's an X event, and "filevent"
> calls procedure when some input is waiting to be read, so the read
> won't 'block', so the application doesn't look "frozen" to the user.

I've been playing with that example, and haven't gotten a good solution.
popen() will work to capture the output (popen3() if you want the stderr
too), and select() allows you to test the output so it won't block on a
hung command, but it leaves a lot to be desired. Pssibly if the popen
and select were off in a thread it would come close?

-- 
Bear Technology  Making Montana safe for Grizzlies

http://people.montana.com/~bowman/


From Alexandre Passos" <atp@bahianet.com.br  Sat Sep  4 03:50:32 1999
From: Alexandre Passos" <atp@bahianet.com.br (Alexandre Passos)
Date: Fri, 3 Sep 1999 23:50:32 -0300
Subject: [Tutor] Tutorial python
Message-ID: <003701bef680$421260a0$115bdfc8@the-user>

This is a multi-part message in MIME format.

------=_NextPart_000_0034_01BEF667.1C2E18C0
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Has someone got a python tutorial to send me?
atp@bahianet.com.br


------=_NextPart_000_0034_01BEF667.1C2E18C0
Content-Type: text/html;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD W3 HTML//EN">
<HTML>
<HEAD>

<META content=3Dtext/html;charset=3Diso-8859-1 =
http-equiv=3DContent-Type>
<META content=3D'"MSHTML 4.72.3110.7"' name=3DGENERATOR>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT size=3D2>Has someone got a python tutorial to send =
me?</FONT></DIV>
<DIV><FONT size=3D2><A=20
href=3D"mailto:atp@bahianet.com.br">atp@bahianet.com.br</A></FONT></DIV>
<DIV><FONT size=3D2></FONT>&nbsp;</DIV></BODY></HTML>

------=_NextPart_000_0034_01BEF667.1C2E18C0--



From marquish@kos.net  Sun Sep  5 17:22:20 1999
From: marquish@kos.net (Hugh Marquis)
Date: Sun, 5 Sep 1999 12:22:20 -0400
Subject: [Tutor] python vs VB
Message-ID: <002101bef7ba$d4fa3e20$e528bace@chuck>

This is a multi-part message in MIME format.

------=_NextPart_000_001E_01BEF799.4CECD900
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

I want to begin programming and both Python and VB have been suggested =
as good first languages.  Although I realize you probably have some =
biases could you comment on which might be better.

Is Mark Lutz's book basic enough for a beginning programmer.

Thanks

Hugh Marquis=20

------=_NextPart_000_001E_01BEF799.4CECD900
Content-Type: text/html;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD W3 HTML//EN">
<HTML>
<HEAD>

<META content=3Dtext/html;charset=3Diso-8859-1 =
http-equiv=3DContent-Type>
<META content=3D'"MSHTML 4.72.3110.7"' name=3DGENERATOR>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT color=3D#000000 size=3D2>I want to begin programming and both =
Python and=20
VB have been suggested as good first languages.&nbsp; Although I realize =
you=20
probably have some biases could you comment on which might be=20
better.</FONT></DIV>
<DIV><FONT color=3D#000000 size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT color=3D#000000 size=3D2>Is Mark Lutz's book basic enough for =
a beginning=20
programmer.</FONT></DIV>
<DIV><FONT color=3D#000000 size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT color=3D#000000 size=3D2>Thanks</FONT></DIV>
<DIV><FONT color=3D#000000 size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT color=3D#000000 size=3D2>Hugh =
Marquis&nbsp;</FONT></DIV></BODY></HTML>

------=_NextPart_000_001E_01BEF799.4CECD900--



From deirdre@deirdre.net  Sun Sep  5 21:08:53 1999
From: deirdre@deirdre.net (Deirdre Saoirse)
Date: Sun, 5 Sep 1999 13:08:53 -0700 (PDT)
Subject: [Tutor] python vs VB
In-Reply-To: <002101bef7ba$d4fa3e20$e528bace@chuck>
Message-ID: <Pine.LNX.4.10.9909051308180.22539-100000@adelie.deirdre.org>

On Sun, 5 Sep 1999, Hugh Marquis wrote:

> I want to begin programming and both Python and VB have been suggested
> as good first languages.  Although I realize you probably have some
> biases could you comment on which might be better.

A good programming language is ALWAYS portable. VB isn't.

> Is Mark Lutz's book basic enough for a beginning programmer.

Perhaps not, though we're trying to get another book going.

-- 
_Deirdre   *   http://www.linuxcabal.net   *   http://www.deirdre.net
"I must say that I was really happy to see _Linux for Dummies_ -- that's 
when you know you've arrived." -- Linus Torvalds



From alan.gauld@bt.com  Mon Sep  6 10:51:23 1999
From: alan.gauld@bt.com (alan.gauld@bt.com)
Date: Mon, 6 Sep 1999 10:51:23 +0100
Subject: [Tutor] Tutorial python
Message-ID: <5104D4DBC598D211B5FE0000F8FE7EB202DF5DF4@mbtlipnt02.btlabs.bt.co.uk>

> Has someone got a python tutorial to send me?
> atp@bahianet.com.br

There's one in the download which is very good.

There are a couple of short beginners ones on 
the web site and I do a big beginners one at:

http://members.xoom.com/alan_gauld/tutor/tutindex.htm

There's a zip version to download too.

Alan G.


From jwiscav@hotmail.com  Mon Sep  6 15:52:32 1999
From: jwiscav@hotmail.com (Joshua Wiscaver)
Date: Mon, 06 Sep 1999 14:52:32 GMT
Subject: [Tutor] Re: Tutor digest, Vol 1 #117 - 2 msgs
Message-ID: <19990906145234.5822.qmail@hotmail.com>

First of all, as was mentioned, VB is not very portable.
Secondly, VB is not a real programming language, it's a platform.
Thirdly, what "language" you choose to learn depends upon what you want to 
do.  If you want to "program" in Windows, then VB is probably the way to go 
for a beginner.
Finally, whatever you do, be diligent.


~PEACE~


----Original Message Follows----
From: tutor-admin@python.org
Reply-To: tutor@python.org
To: tutor@python.org
Subject: Tutor digest, Vol 1 #117 - 2 msgs
Date: Mon, 6 Sep 1999 01:03:06 -0400 (EDT)
MIME-Version: 1.0
From a.mueller@icrf.icnet.uk  Mon Sep  6 16:03:53 1999
From: a.mueller@icrf.icnet.uk (Arne Mueller)
Date: Mon, 06 Sep 1999 16:03:53 +0100
Subject: [Tutor] filling in web forms
Message-ID: <37D3D7D9.8F515D97@icrf.icnet.uk>

Hi All,

is there a python module that helps automatically filling in web forms
like the 'LWP' module in perl? 

People say that python is a good alternative to perl when programming is
web related (cgi and stuff). Maybe the language itself is the right
thing for the web but at the moment it seems to be a major lack of
suitable modules for the web (yes, I know your answer will we: "write
your own modules"). However if you know a module to fill out web forms
I'd realy like to hear from you.

thanks alot,

	Arne


From m.faassen@vet.uu.nl  Mon Sep  6 17:33:53 1999
From: m.faassen@vet.uu.nl (Martijn Faassen)
Date: Mon, 06 Sep 1999 18:33:53 +0200
Subject: [Tutor] python vs VB
References: <Pine.LNX.4.10.9909051308180.22539-100000@adelie.deirdre.org>
Message-ID: <37D3ECF1.6D6EF784@vet.uu.nl>

Deirdre Saoirse wrote:
> 
> On Sun, 5 Sep 1999, Hugh Marquis wrote:
> 
> > I want to begin programming and both Python and VB have been suggested
> > as good first languages.  Although I realize you probably have some
> > biases could you comment on which might be better.
> 
> A good programming language is ALWAYS portable. VB isn't.

I haven't worked with VB a lot, but:

With VB it's really easy to do what VB is designed for; primarily user
interfaces and working with databases. However, it's not so good if you
want to learn programming. VB doesn't separate the user interface from
the things the program actually does, which isn't a good programming
style. My impression is that you can whip up some program quite quickly,
but then maintaining it later is not fun.

Anyway, language-wise Python is a cleaner language than VB -- Python is
one of the nicest and cleanest programming languages I know. As far as I
know you can't program object orientedly with VB, either. So, Python
will probably teach you better programming practices (which is very
important later on).

And, while you don't create a graphical user interface as easily in
Python, Python does allow you to create *many* types of graphical user
interfaces -- for windows, for unix, for whatever you can come up with.
This is the same for everything you want to do with Python -- there's
more do it yourself, but there's a sea of possibilities. It doesn't tie
you down to only a single platform and a single set of solutions, like
VB does. Python talks to just about anything you can think of, and
people are constantly interfacing it with new systems.

Another important point is that Python is free (as in no charge and as
in open source). With VB, don't expect to get personal email from the
main VB developers. With Python, I did get emails from Guido once in a
while. :) In general, open source brings you a lot of freedom you won't
have with VB. This is part of the reason why people are able to
interface Python with so many things in the first place. And the Python
community is also a lot of fun.

> > Is Mark Lutz's book basic enough for a beginning programmer.
> 
> Perhaps not, though we're trying to get another book going.

'Programming Python' isn't. 'Learning Python' (the new book by Mark Lutz
and David Ascher) isn't for people completely new to programming either
-- a friend of mine is trying to learn programming with it but she has
some difficulties (lots of terminology she isn't aware of is used
liberally in the book).

So, if you want to get some cool looking windows app (that may not
actually do much) going quickly, use VB. If you want to do anything
else, including making cool looking windows apps later on, use Python.
:)

Regards,

Martijn


From eroubinc@u.washington.edu  Mon Sep  6 18:07:22 1999
From: eroubinc@u.washington.edu (Evgeny Roubinchtein)
Date: Mon, 6 Sep 1999 10:07:22 -0700 (PDT)
Subject: [Tutor] filling in web forms
In-Reply-To: <37D3D7D9.8F515D97@icrf.icnet.uk>
Message-ID: <Pine.A41.4.10.9909061000210.60012-100000@dante30.u.washington.edu>

On Mon, 6 Sep 1999, Arne Mueller wrote:

>Hi All,
>
>is there a python module that helps automatically filling in web forms
>like the 'LWP' module in perl? 

Have you had a chance to look at the HTMLGen module?
http://starship.python.net/crew/friedrich/HTMLgen/html/main.html

Have you checked out the Web Programming  "Topic Guide"?

http://www.python.org/topics/web/

www.python.org is always a good start when looking for a Python module
:-).

[...snip...]

--
Evgeny Roubinchtein, eroubinc@u.washington.edu
...................
The value of a program is proportional to the weight of its output.



From denniston1@yahoo.com  Mon Sep  6 18:23:47 1999
From: denniston1@yahoo.com (Jason Denniston)
Date: Mon, 6 Sep 1999 10:23:47 -0700 (PDT)
Subject: [Tutor] (no subject)
Message-ID: <19990906172347.8279.rocketmail@web1105.mail.yahoo.com>

okay i understand that i don't know very much about
programming, but i do know a bit about basic
programming and html'ing, what i'm looking for is some
programming examples, and a list of reserved words and
things of that nature. 
__________________________________________________
Do You Yahoo!?
Bid and sell for free at http://auctions.yahoo.com


From a.mueller@icrf.icnet.uk  Mon Sep  6 19:16:30 1999
From: a.mueller@icrf.icnet.uk (Arne Mueller)
Date: Mon, 06 Sep 1999 19:16:30 +0100
Subject: [Tutor] filling in web forms
References: <Pine.A41.4.10.9909061000210.60012-100000@dante30.u.washington.edu>
Message-ID: <37D404FE.39C1CFF1@icrf.icnet.uk>

Evgeny Roubinchtein wrote:
> 
> On Mon, 6 Sep 1999, Arne Mueller wrote:
> 
> >Hi All,
> >
> >is there a python module that helps automatically filling in web forms
> >like the 'LWP' module in perl?
> 
> Have you had a chance to look at the HTMLGen module?
> http://starship.python.net/crew/friedrich/HTMLgen/html/main.html
> 
> Have you checked out the Web Programming  "Topic Guide"?
> 
> http://www.python.org/topics/web/
> 
> www.python.org is always a good start when looking for a Python module
> :-).
> 
> [...snip...]

Yes, I checked the above sites, and it may be possible to use HTMLgen 
to fill out forms previously retrieved by urllib . However I havn't foud
out how to do ... ;-(

	thanks alot,

	Arne


From gerrit.holl@pobox.com  Mon Sep  6 22:06:35 1999
From: gerrit.holl@pobox.com (Gerrit Holl)
Date: Mon, 6 Sep 1999 23:06:35 +0200
Subject: [Tutor] python vs VB
In-Reply-To: <Pine.LNX.4.10.9909051308180.22539-100000@adelie.deirdre.org>; from Deirdre Saoirse on Sun, Sep 05, 1999 at 01:08:53PM -0700
References: <002101bef7ba$d4fa3e20$e528bace@chuck> <Pine.LNX.4.10.9909051308180.22539-100000@adelie.deirdre.org>
Message-ID: <19990906230635.B25013@optiplex.palga.uucp>

On Sun, Sep 05, 1999 at 01:08:53PM -0700, Deirdre Saoirse wrote:
> On Sun, 5 Sep 1999, Hugh Marquis wrote:
> 
> > I want to begin programming and both Python and VB have been suggested
> > as good first languages.  Although I realize you probably have some
> > biases could you comment on which might be better.
> 
> A good programming language is ALWAYS portable. VB isn't.
> 

What I heard about VB is not good.
Note: I only heard about VB from Linux users (often: micro$oft bashers).

> > Is Mark Lutz's book basic enough for a beginning programmer.
> 
> Perhaps not, though we're trying to get another book going.
> 

Learning python sure is.
Programming python sure isn't.

regards,
Gerrit.
-- 
Unix is easy: type 'man man' and the rest comes of itself.


From gerrit.holl@pobox.com  Mon Sep  6 22:02:16 1999
From: gerrit.holl@pobox.com (Gerrit Holl)
Date: Mon, 6 Sep 1999 23:02:16 +0200
Subject: [Tutor] (no subject)
In-Reply-To: <19990906172347.8279.rocketmail@web1105.mail.yahoo.com>; from Jason Denniston on Mon, Sep 06, 1999 at 10:23:47AM -0700
References: <19990906172347.8279.rocketmail@web1105.mail.yahoo.com>
Message-ID: <19990906230216.A25013@optiplex.palga.uucp>

Hello,

On Mon, Sep 06, 1999 at 10:23:47AM -0700, Jason Denniston wrote:
> 
> okay i understand that i don't know very much about
> programming,

Neither I did, one year ago.

> but i do know a bit about basic programming

I didn't.

> and html'ing,

That won't really help you when you want to learn python.

> what i'm looking for is some
> programming examples, and a list of reserved words and
> things of that nature. 
> 

I strongly recommend to buy the book "Learning python". It's written for
people who haven't programmed before, and python is a very suitable language
for people who haven't programmed before.

Success,
regards,
Gerrit.
-- 
Unix is easy: type 'man man' and the rest comes of itself.


From deirdre@deirdre.net  Mon Sep  6 23:56:53 1999
From: deirdre@deirdre.net (Deirdre Saoirse)
Date: Mon, 6 Sep 1999 15:56:53 -0700 (PDT)
Subject: [Tutor] python vs VB
In-Reply-To: <19990906230635.B25013@optiplex.palga.uucp>
Message-ID: <Pine.LNX.4.10.9909061555100.26551-100000@adelie.deirdre.org>

On Mon, 6 Sep 1999, Gerrit Holl wrote:

> What I heard about VB is not good.
> Note: I only heard about VB from Linux users (often: micro$oft bashers).

Well, I am a Linux user and a frequent M$ basher but I will say that I
have recommended VB in situations where the alternative was more expensive
and a worse choice.

> > > Is Mark Lutz's book basic enough for a beginning programmer.
> > Perhaps not, though we're trying to get another book going.
> Learning python sure is.
> Programming python sure isn't.

Some people have said that Learning Python was too advanced for them which
is why I said "Perhaps not." If it works for the person in question, by
all means use it. It's the closest to a book for true beginners other than
the Python tutorial.

-- 
_Deirdre   *   http://www.linuxcabal.net   *   http://www.deirdre.net
"I must say that I was really happy to see _Linux for Dummies_ -- that's 
when you know you've arrived." -- Linus Torvalds



From Alexandre Passos" <atp@bahianet.com.br  Tue Sep  7 01:20:14 1999
From: Alexandre Passos" <atp@bahianet.com.br (Alexandre Passos)
Date: Mon, 6 Sep 1999 21:20:14 -0300
Subject: [Tutor] Python vs. VB
Message-ID: <002b01bef8c6$c23ad080$775bdfc8@the-user>

This is a multi-part message in MIME format.

------=_NextPart_000_0028_01BEF8AD.9C242E00
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

I've tried the working model of VB and noticed that Python is much =
different.
Python is text-oriented and VB is object/event oriented. I'm trying this =
tutorial ,too:
http://members.xoom.com/alan_gauld/tutor/tutindex.htm
it's nice for beginners like me.

------=_NextPart_000_0028_01BEF8AD.9C242E00
Content-Type: text/html;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD W3 HTML//EN">
<HTML>
<HEAD>

<META content=3Dtext/html;charset=3Diso-8859-1 =
http-equiv=3DContent-Type>
<META content=3D'"MSHTML 4.72.3110.7"' name=3DGENERATOR>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT color=3D#000000 size=3D2>I've tried the working model of VB =
and noticed=20
that Python is much different.</FONT></DIV>
<DIV><FONT color=3D#000000 size=3D2>Python is text-oriented and VB is =
object/event=20
oriented. I'm trying this tutorial ,too:</FONT></DIV>
<DIV><FONT color=3D#000000 size=3D2><A=20
href=3D"http://members.xoom.com/alan_gauld/tutor/tutindex.htm">http://mem=
bers.xoom.com/alan_gauld/tutor/tutindex.htm</A><BR>it's=20
nice for beginners like me.</FONT></DIV></BODY></HTML>

------=_NextPart_000_0028_01BEF8AD.9C242E00--



From strat_addict@yahoo.com  Tue Sep  7 07:08:49 1999
From: strat_addict@yahoo.com (G. Norton)
Date: Mon, 6 Sep 1999 23:08:49 -0700 (PDT)
Subject: [Tutor] (no subject)
Message-ID: <19990907060849.21397.rocketmail@web1405.mail.yahoo.com>

> I strongly recommend to buy the book "Learning
> python". It's written for
> people who haven't programmed before, and python is
> a very suitable language
> for people who haven't programmed before.

                         As a newbie who has been studying Python for a
month or so, I cannot recommend "Learning Python" from O'Reilly.If you
have absolutely no programming experience, this book won't be much help
in the beginning.It's too fast, too soon and at times the syntax can be
quite overwhelming very early on.If your a Windows user(like myself)you
are at times left to figure out which examples apply to you.Alan
Gauld's tutorial is a good place to start.It's thorough, very easy to
understand and Alan has been very kind to answer my questions.
                               Perhaps an update to  the O'Reilly book
should be called
                     "Learning "Learning Python""

                                  gtnorton   

__________________________________________________
Do You Yahoo!?
Bid and sell for free at http://auctions.yahoo.com


From alan.gauld@bt.com  Tue Sep  7 10:34:24 1999
From: alan.gauld@bt.com (alan.gauld@bt.com)
Date: Tue, 7 Sep 1999 10:34:24 +0100
Subject: [Tutor] Python vs. VB
Message-ID: <5104D4DBC598D211B5FE0000F8FE7EB202DF5E05@mbtlipnt02.btlabs.bt.co.uk>

> Python is text-oriented and VB is object/event oriented. I'm 
> trying this tutorial ,too:
> http://members.xoom.com/alan_gauld/tutor/tutindex.htm
> it's nice for beginners like me.

Thanks for the kind words. Any feedback/criticism is welcome too.

VB is fine for small GUI projects on Windoze platforms. Its certainly 
easier that GUI programming in Python(which you can do using several 
approaches and there is even a GUI builder - SpecPython. But VB is 
easier if its windows.

Personally I prefer Delphi since its more like Python in concept 
and easier to use for larger projects, but if you are working 
alone then VB is adequate.

Alan g.


From m.faassen@vet.uu.nl  Tue Sep  7 17:51:58 1999
From: m.faassen@vet.uu.nl (Martijn Faassen)
Date: Tue, 07 Sep 1999 18:51:58 +0200
Subject: [Tutor] Python vs. VB
References: <002b01bef8c6$c23ad080$775bdfc8@the-user>
Message-ID: <37D542AE.3AA4DAC4@vet.uu.nl>

> Alexandre Passos wrote:
> 
> I've tried the working model of VB and noticed that Python is much
> different.
> Python is text-oriented and VB is object/event oriented.

Actually *Python* is the object oriented programming language and VB
isn't. VB can have objects, but they can't inherit from each other as
far as I know, which is part of the definition of 'object oriented'.
That's why VB is sometimes called 'object based'. In VB you tend to deal
a lot with user interface objects that can receive events, and you
attach code to those events. I think it's possible to develop your own
VB objects as well (within limitations), but in general that's obscured
from view; the whole paradigm is that you build a user interface and do
your stuff in the events. Your mind gets focused on GUI building, and
distracted from actually programming.

This paradigm is fine for short programs, but for larger projects it
becomes very limiting; you aren't able to organize your code as easily,
and good code organisation (and abstraction of things) is one of the
most important things in programming.

In Python, there's no default way to construct a GUI, no default GUI
builder, no default object/event system. But, you can work with such
systems in Python; although it is harder to get something going with
Python than with VB, if it includes user interface things. Once you have
it going in Python however, you can organize your code a lot better than
in VB, as Python as a language is much nicer.

VB is not just a programming language, but an environment to develop
software in -- it includes an editor and GUI builder, among other
things. Python is just the programming language itself -- you get
external editors, and external GUI builders (though not many Python GUI
builders exist yet). You can pick and choose your own things. This makes
Python more flexible and open.

That said, it would be nice to have a Python GUI development environment
as well. It may make it more difficult to organize code, just like VB
does now, but Python is a more open and flexible language, so I think
we'll survive that :) It would be handy to quickly whip up a nice GUI
app, and it would be easier on newbies as well (who tend to like to see
quick results). There are various projects that can provide the parts
for such an environment bandied around right now, so perhaps in a while
we'll see a 'Visual Python'.

Regards,

Martijn


From YankoC@gspinc.com  Wed Sep  8 13:51:29 1999
From: YankoC@gspinc.com (Yanko, Curtis (GSP))
Date: Wed, 8 Sep 1999 08:51:29 -0400
Subject: [Tutor] PP and App framework
Message-ID: <23EF0668B5D3D111A0CF00805F9FDC4401707E52@SRV_EXCH1>

Hello everyone,

I've been following the list for a bit now and am fairly new to Python
but not programming in general.

I've read both Learning Python and PP and decided to use the app
framework in the back of PP. I'm having trouble understanding how to
implement the framework as a part of my Python environment. I am trying
to study the existing examples but am having a hard time getting them to
run.

I'm trying to run Myapp4.py and get the following:

Traceback (innermost last):
  File "E:\PYTHON\FRAMEWRK\MYAPP4.PY", line 24, in ?
    class MyApp(MenuApp):
NameError: MenuApp

Ok, a simple namespace issue so I look at the source file:

from app import *

...


class MyApp(MenuApp):
    def start(self):
	...

Menuapp is a class in interact.py but we are only importing all of app.
So is this meant to be a package? I had initially just added the folder
with all of the framework stuff to the python path.

Has anyone done any work with this framework? It seems like a great
starting point for an aspiring Python programmer. What's the best way to
integrate it into my environment?

Thank
-Curtis Yanko

p.s. I'm going to try and just import interact.py for now to keep going
but I intend to use this framework a lot until I get into GUI's so it's
not just a get over the hurdle question.
	


From eroubinc@u.washington.edu  Thu Sep  9 20:09:19 1999
From: eroubinc@u.washington.edu (Evgeny Roubinchtein)
Date: Thu, 9 Sep 1999 12:09:19 -0700 (PDT)
Subject: [Tutor] Tkinter: Grid : weight option
Message-ID: <Pine.A41.4.10.9909091145300.84762-100000@dante20.u.washington.edu>

After my initial frustration with doing a "fileevent" in Python a'la TCL,
I am translating some simpler scripts from TCL/Tk to Python, so I can be
comfortable  with widgets, geometry managers and such.

I hit a snag on this script, in particular with the "weight" setting:

#!/usr/local/bin/wish8.0

text .text -yscrollcommand ".yscroll set" \
           -xscrollcommand ".xscroll set" \
           -width 40 -height 10
scrollbar .yscroll -command ".text yview" -orient vertical
scrollbar .xscroll -command ".text xview" -orient horizontal
grid .text .yscroll -sticky news
grid .xscroll -sticky ew
grid rowconfigure . 0 -weight 1
grid columnconfigure . 0 -weight 1


I looked at Fredrik Lundh's Tkinter tutorial, where he talks about the
Grid Geometry Manager "Manager Options", and decided that one way to
translate the above into Python would be thusly:

#! /usr/local/bin/python

from Tkinter import *

class App(Frame):
    def __init__(self, master = None): # as in Matt Conways examples
        Frame.__init__(self, master) 
        Pack.configure(self)  
        self.create_widgets()

    def create_widgets(self):
        self.text = Text(self, width = 40, height = 10)
        self.yscroll = Scrollbar(self, command = self.text.yview, orient = VERTICAL)
        self.xscroll = Scrollbar(self, command = self.text.xview, orient = HORIZONTAL)
        self.text.configure(yscrollcommand = self.yscroll.set, xscrollcommand = self.xscroll.set)
        self.text.grid(row = 0, column = 0, sticky = 'news')
        self.yscroll.grid(row = 0, column = 1, sticky = 'news')
        self.xscroll.grid(row = 1, column = 0, sticky = 'ew')
        # now set the weights
        self.rowconfigure(0, weight = 1)
        self.columnconfigure(0, weight = 1)
        
def test():
    app = App()
    app.mainloop()

if __name__ == '__main__':
    test()

Unfortunately, when I run it the text area and the scrollbars shrink
when I make the window smaller, but they won't grow when I make the
window larger (resizing the window in my window manager). I am a bit
puzzled as to why this happens. I did a "grep -i -l weight *.py" in my
the lib-tk directory of my Python installation, and the only mention of
weight appears to be in the tkFont module, which puzzles me even more.

This is Python 1.5.2 running under FreeBSD-3.2-STABLE, with XFree86 and
AfterStep-1.6.10 as a WM, btw.

--
Evgeny Roubinchtein, eroubinc@u.washington.edu
...................
Performance proven: It works through beta test.



From Aaron Marzec" <glwarriors7@netzero.net  Fri Sep 10 00:59:23 1999
From: Aaron Marzec" <glwarriors7@netzero.net (Aaron Marzec)
Date: Thu, 9 Sep 1999 19:59:23 -0400
Subject: [Tutor] (no subject)
Message-ID: <19990910000524.64991.qmail@hotmail.com>

This is a multi-part message in MIME format.

------=_NextPart_000_000F_01BEFAFD.CFE1BC60
Content-Type: multipart/alternative;
	boundary="----=_NextPart_001_0010_01BEFAFD.CFE1BC60"


------=_NextPart_001_0010_01BEFAFD.CFE1BC60
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable



------=_NextPart_001_0010_01BEFAFD.CFE1BC60
Content-Type: text/html;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content=3D"text/html; charset=3Diso-8859-1" =
http-equiv=3DContent-Type><BASE=20
href=3D"file://C:\Program Files\Common Files\Microsoft =
Shared\Stationery\">
<STYLE>BODY {
	BACKGROUND-POSITION: left top; BACKGROUND-REPEAT: repeat; COLOR: =
#ffffff; FONT-FAMILY: Comic Sans MS; FONT-SIZE: 10pt; FONT-WEIGHT: bold
}
</STYLE>

<META content=3D"MSHTML 5.00.2314.1000" name=3DGENERATOR></HEAD>
<BODY background=3Dcid:000e01befb1f$56e29380$19500ed1@med.umich.edu=20
bgColor=3D#800000>
<DIV>&nbsp;</DIV></BODY></HTML>

------=_NextPart_001_0010_01BEFAFD.CFE1BC60--

------=_NextPart_000_000F_01BEFAFD.CFE1BC60
Content-Type: image/gif;
	name="Tiki.gif"
Content-Transfer-Encoding: base64
Content-ID: <000e01befb1f$56e29380$19500ed1@med.umich.edu>

R0lGODlhqAO0AKIAAP////+1IfelEOelGOeMCJyEEIRrCAAAACwAAAAAqAO0AAAD/xiyI81jkOdG
aCFnQYRSXIQ9EXcxjvdpXQC8cCzPdG3feK7vfO//wKBwSCwaj8ikcslsOp/QqHRKrVprkYxF4mlY
OCnLR4xRkDfb1ALUkZBKcMt1Tq/b7/i8fs/v+/+AgYJACyYqGlqIFwVbIhMqHB2FAQRjGyuXIGiV
HoOen6ChoqOkpaanqKlFmIcDBQUGBrCxsa+0s7ETK5AOJxGPEpxhZSYuqsfIycrLzM3Oz9BCLQS4
tNay17XXs7PBFgTg4ZHh5JItCxPR6uvs7e7v8PHsldWyBRMiXhUlKPi29YxA9CqkxlwHcRnkKVzI
sKHDhxAjymhADRYjghg3rGG1j/+aNYuP0OGDJOaQRmMSU6pcybKly5dM1vTSB0YEpQcfVFBsQ8Ki
PVk81WRJgQhcJ5hIkypdyrSpuhMgvpzzsLGFgoPnNAy7ZXEXpA3TrKJ0Sras2bNo0zrBeKiQ0XEY
K2UwKm7Nt1e2DLyt61ZFuLFqAwseTLiwUqpyeynSULKt1VZXD+HFK0brxhCJARvezLmz58/JBOac
BFUrohAbNU2SNDevrJKJCMrVDLq27du4c0/BiWESut8EcYqMrFq1AG4WqfJLA4a27ufQo0ufDiBq
F7sXRitf8yjRaIqiXf2TRdVudw3U06tfzz5wTlamTy/GqejM4gyTX1VmnLq9////AAYI0X0EKuKb
XJwcZFKBH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nH9ljMjxL8FfXTwMbP9
LHgvqwWXZzt4K17dcZSNoCMjkn2R9zcLbYZ5yyyJyFZl/DKbfIBkkA8mPRNzF04qvdFlaFtqV8x3
MnyNkjcm/DOPFwfiMn8sXYUJAAA7

------=_NextPart_000_000F_01BEFAFD.CFE1BC60--


From Aaron Marzec" <glwarriors7@netzero.net  Fri Sep 10 10:55:39 1999
From: Aaron Marzec" <glwarriors7@netzero.net (Aaron Marzec)
Date: Fri, 10 Sep 1999 05:55:39 -0400
Subject: [Tutor] (no subject)
Message-ID: <19990910100136.35139.qmail@hotmail.com>

This is a multi-part message in MIME format.

------=_NextPart_000_0033_01BEFB51.1C0A1C60
Content-Type: multipart/alternative;
	boundary="----=_NextPart_001_0034_01BEFB51.1C0A1C60"


------=_NextPart_001_0034_01BEFB51.1C0A1C60
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable



------=_NextPart_001_0034_01BEFB51.1C0A1C60
Content-Type: text/html;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content=3D"text/html; charset=3Diso-8859-1" =
http-equiv=3DContent-Type><BASE=20
href=3D"file://C:\Program Files\Common Files\Microsoft =
Shared\Stationery\">
<STYLE>BODY {
	BACKGROUND-POSITION: left top; BACKGROUND-REPEAT: repeat; COLOR: =
#ffffff; FONT-FAMILY: Comic Sans MS; FONT-SIZE: 10pt; FONT-WEIGHT: bold
}
</STYLE>

<META content=3D"MSHTML 5.00.2314.1000" name=3DGENERATOR></HEAD>
<BODY background=3Dcid:003201befb72$a31294a0$bed41004@med.umich.edu=20
bgColor=3D#800000>
<DIV>&nbsp;</DIV></BODY></HTML>

------=_NextPart_001_0034_01BEFB51.1C0A1C60--

------=_NextPart_000_0033_01BEFB51.1C0A1C60
Content-Type: image/gif;
	name="Tiki.gif"
Content-Transfer-Encoding: base64
Content-ID: <003201befb72$a31294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OEU5SJtmlcGi5jgAcguUFCA0zZd58zlRpzq2/LA/P8pp
bssNFzq4H3lHC4SVaZdiSKiRGJYJj8EjEQpVpEq5JBsVb1OdNemirYE5n4cz+0hHDzK6pCuPPXaP
v4Zr3PUBclFiCpghTfVukyEJs+uRqlgNzrduj/knJRdBtHcmnnI+HDC8EflcvMVn6kh/jpN/QmeZ
4hRfyiG9EIkPrzSSRvYvvacgNForg/MRG/hg0NYB4BuQf6Nh2NNjvf/WBRbZVK92YFjarJpZqfEb
jc8yVxxlv5nxokJ6YyW6k2V3ZnEbwOKIQgjIs3emjfWVs/ZrUJHBZuEAwbQrMMXZrObICUWSJF0m
NvKWpKphZIrgweJIKWM3OH4JbYYSUziEUl4xqi4cjhdZK7oUacYhhvPxqHA4iNzBGjssjVyki/lR
xDzmkBSkZp1KIEkcjZekPrtlc9kBp38FcY/YKFWSBTbRWr6gfVUsjIewKUiyTMqCE+yWL38Cf8IA
Pg8rLWeMxpn7eFFCdWVKRX51ozB6re6YEa9zx7SIh8zGuy5oCKn7N7krJ48yiCJryDGIhtBlmYkS
ydn3jiSMui4KwpPrS8mWGDU2laqSsIfzV8G8wGp8ERKEVMiibIm661BIqAkl1i8AiBh5C3AMdIRG
khOxfIkIgQZeoraURC4ThnWAKMYmkHkLiVmyG8xUGLM3MoLWKjCMxL5gorrhcya5WG/STIS6m5AR
+HjBZn/eJJPZ6p03eILRHM4xyGrIy2TV4wb8opKeks8tdhXwbIfuh2s0KnH9ljMjxL8FfXTwMbP9
LHgvqwWXZzt4K17dcZSNoCMjkn2R9zcLbYZ5yyyJyFZl/DKbfIBkkA8mPRNzF04qvdFlaFtqV8x3
MnyNkjcm/DOPFwfiMn8sXYUJAAA7

------=_NextPart_000_0033_01BEFB51.1C0A1C60--


From usia@email.msn.com  Fri Sep 10 21:02:49 1999
From: usia@email.msn.com (usia)
Date: Fri, 10 Sep 1999 16:02:49 -0400
Subject: [Tutor] Please help
Message-ID: <000501befbc7$761f9ec0$e9b5153f@usi-computer>

I am just starting out and i don't know the first thing about this language
and i was wonder where i should start, what is the first step to learning
this language. I don't know of any python writing and i've never even seen
it. i was wonder if you could PLEASE HELP ME , PLEASE.





From deirdre@deirdre.net  Fri Sep 10 21:43:03 1999
From: deirdre@deirdre.net (Deirdre Saoirse)
Date: Fri, 10 Sep 1999 13:43:03 -0700 (PDT)
Subject: [Tutor] Please help
In-Reply-To: <000501befbc7$761f9ec0$e9b5153f@usi-computer>
Message-ID: <Pine.LNX.4.10.9909101331310.10979-100000@adelie.deirdre.org>

http://www.python.org/doc/

There's a lovely tutorial there.

On Fri, 10 Sep 1999, usia wrote:

> I am just starting out and i don't know the first thing about this language
> and i was wonder where i should start, what is the first step to learning
> this language. I don't know of any python writing and i've never even seen

-- 
_Deirdre   *   http://www.linuxcabal.net   *   http://www.deirdre.net
"I must say that I was really happy to see _Linux for Dummies_ -- that's 
when you know you've arrived." -- Linus Torvalds



From dennis@operamail.com  Sun Sep 12 02:49:55 1999
From: dennis@operamail.com (Dennis)
Date: Sat, 11 Sep 1999 20:49:55 -0500
Subject: [Tutor] "Learning Python" Chapter Exercise
Message-ID: <37DB06C3.6EEF47C4@operamail.com>

I just started looking a python and picked up a copy of Learning Python.
At the end of chapter one, I managed to get the first question, but
can't work out the second, which is to create a one line module: print 
"hello module world', saved as module1.py

The book uses Linux (or unix) examples and I am (for now) running
windows. I assume my problem is windows specific. Following is the
result of trying to run module1.py.  If anyone is willing to point
me in the right direction I would appreciate the help. Thanks

>>>module1.py
Traceback (innermost last):
  File "<stdin>", line 1, in ?
NameError: module1


From deirdre@deirdre.net  Sun Sep 12 03:13:21 1999
From: deirdre@deirdre.net (Deirdre Saoirse)
Date: Sat, 11 Sep 1999 19:13:21 -0700 (PDT)
Subject: [Tutor] "Learning Python" Chapter Exercise
In-Reply-To: <37DB06C3.6EEF47C4@operamail.com>
Message-ID: <Pine.LNX.4.10.9909111912430.19095-100000@adelie.deirdre.org>

On Sat, 11 Sep 1999, Dennis wrote:

> The book uses Linux (or unix) examples and I am (for now) running
> windows. I assume my problem is windows specific. Following is the
> result of trying to run module1.py.  If anyone is willing to point
> me in the right direction I would appreciate the help. Thanks

You should instead say:

import module1

> >>>module1.py
> Traceback (innermost last):
>   File "<stdin>", line 1, in ?
> NameError: module1

-- 
_Deirdre   *   http://www.linuxcabal.net   *   http://www.deirdre.net
"I must say that I was really happy to see _Linux for Dummies_ -- that's 
when you know you've arrived." -- Linus Torvalds



From fmurray@email.com  Sun Sep 12 04:00:22 1999
From: fmurray@email.com (frank)
Date: Sat, 11 Sep 1999 20:00:22 -0700
Subject: [Tutor] little pythons
Message-ID: <99091120075500.02579@.c631759-a.tcma1.wa.home.com>

my twelve year old grandson has decided to learn python...i've heard that guido
has proposed a program for educating younger programmers, but have not located
any instructional materials specifically designed for younger folk...if any
here have info on any such materials, i'd send you a thanking in return for
such info...

in fact, i'l send it in advance...

thanks,

--  frank


From wilson@chemsun.chem.umn.edu  Sun Sep 12 04:51:22 1999
From: wilson@chemsun.chem.umn.edu (Tim Wilson)
Date: Sat, 11 Sep 1999 22:51:22 -0500 (CDT)
Subject: [Tutor] "Learning Python" Chapter Exercise
In-Reply-To: <37DB06C3.6EEF47C4@operamail.com>
Message-ID: <Pine.BSF.3.96.990911225033.10619B-100000@chemsun.chem.umn.edu>

On Sat, 11 Sep 1999, Dennis wrote:

> The book uses Linux (or unix) examples and I am (for now) running
> windows. I assume my problem is windows specific. Following is the
> result of trying to run module1.py.  If anyone is willing to point
> me in the right direction I would appreciate the help. Thanks

I don't have my copy in front of me, but did you check the answers to the
problems that are provided in the back of the book?

-Tim

--
Timothy Wilson       | "The faster you  |  Check out:
Henry Sibley H.S.    |  go, the shorter | http://slashdot.org/
W. St. Paul, MN, USA |  you are."       | http://linux.com/
wilson@chem.umn.edu  |       -Einstein  | http://www.mn-linux.org/



From eroubinc@u.washington.edu  Sun Sep 12 06:42:57 1999
From: eroubinc@u.washington.edu (Evgeny Roubinchtein)
Date: Sat, 11 Sep 1999 22:42:57 -0700 (PDT)
Subject: [Tutor] little pythons
In-Reply-To: <99091120075500.02579@.c631759-a.tcma1.wa.home.com>
Message-ID: <Pine.A41.4.10.9909112214190.91660-100000@dante08.u.washington.edu>

On Sat, 11 Sep 1999, frank wrote:

>my twelve year old grandson has decided to learn python...i've heard that guido
>has proposed a program for educating younger programmers, but have not located
>any instructional materials specifically designed for younger folk...if any
>here have info on any such materials, i'd send you a thanking in return for
>such info...

What you are probably thinking of is at:

http://www.python.org/doc/essays/cp4e.html

Unfortunately, this doesn't seem to give any instructions suitable for
a 12-year old.  I know that Seymor Papert of MIT was very enthusiastic
about teaching LOGO to children.  He desribes his experiences in a book
called "Mindstorms", and also in an memo AIM-249 available from the MIT
ftp server.   There is an annotated bibliography of many of the memos at:

http://www.neurop2.ruhr-uni-bochum.de/MIT_lit.html

(and links to download them).  Pyhon does have a turtle module, so dear to
the hearts of LOGO-minded people, so it is certainly possible to start
python, and then do something like 

>>> import turtle
>>> joe = turtle.Pen()
>>> lisa = turtle.Pen()
>>> joe.down()
>>> joe.forward(50)
>>> lisa.right()
# ... 
# then maybe 
>>> def square(turtle, side):
...     turtle.forward(side)
...     turtle.right(90)
...     turtle.forward(side)
...     turtle.right(90)
...     turtle.forward(side)
...     turtle.right(90)
...     turtle.forward(side)
>>> square(lisa, 30)
>>> square(joe, 20)
# etc...

You may want to look at the LOGO books in your local library, and follow
along in Python -- I can't think of it now, but I believe there was a LOGO
book by a Brian Harvey, who later wrote "Simply Scheme"... That book was
supposed to be good.  There was another book that introduced "little
people" as a way to think of procedures and recursion -- what was it?

These are all the bright ideas I can come up with, I hope this helps.

--
Evgeny Roubinchtein, eroubinc@u.washington.edu
...................
BDC: Break Down and Cry



From smb181@mciworld.com  Wed Sep 15 01:22:50 1999
From: smb181@mciworld.com (smb181)
Date: Tue, 14 Sep 1999 17:22:50 -0700
Subject: [Tutor] (no subject)
Message-ID: <000801beff10$72d9f980$6cbc143f@k2d2d6>

This is a multi-part message in MIME format.

--Boundary_(ID_b1QszdhjvhglIlKmVAHKmw)
Content-type: text/plain; charset="iso-8859-1"
Content-transfer-encoding: quoted-printable

>>>The following is part of the [4.4 section] in the Python Tutorial. =
Please help me If you can. I am new to programming and computers;thanks =
in advance.
for n in range(2, 10):
    ...     for x in range(2, n):
    ...         if n % x =3D=3D 0:( I don't understand the n%x what does =
it mean)
    ...            print n, 'equals', x, '*', n/x
    ...            break
    ...     else:
    ...          print n, 'is a prime number'
    ...=20
    2 is a prime number
    3 is a prime number
    4 equals 2 * 2
    5 is a prime number
    6 equals 2 * 3
    7 is a prime number
    8 equals 2 * 4
    9 equals 3 * 3
thanks
SAMUEL L BESS

--Boundary_(ID_b1QszdhjvhglIlKmVAHKmw)
Content-type: text/html; charset="iso-8859-1"
Content-transfer-encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content=3D"text/html; charset=3Diso-8859-1" =
http-equiv=3DContent-Type>
<META content=3D"MSHTML 5.00.2614.3401" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT size=3D2>&gt;&gt;&gt;The following is part of the [4.4 =
section] in the=20
Python Tutorial. Please help me If you can. I am new to programming and=20
computers;thanks in advance.</FONT></DIV>
<DIV><FONT size=3D2>for n in range(2, 10):<BR>&nbsp;&nbsp;&nbsp;=20
...&nbsp;&nbsp;&nbsp;&nbsp; for x in range(2, n):<BR>&nbsp;&nbsp;&nbsp; =
<FONT=20
color=3D#ff0000>...&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if n =
% x =3D=3D=20
0:( I&nbsp;don't understand the n%x what does it =
mean)<BR>&nbsp;&nbsp;&nbsp;=20
</FONT>...&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
sp;=20
print n, 'equals', x, '*', n/x<BR>&nbsp;&nbsp;&nbsp;=20
...&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
break<BR>&nbsp;&nbsp;&nbsp; ...&nbsp;&nbsp;&nbsp;&nbsp;=20
else:<BR>&nbsp;&nbsp;&nbsp;=20
...&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; print n, 'is a =
prime=20
number'<BR>&nbsp;&nbsp;&nbsp; ... <BR>&nbsp;&nbsp;&nbsp; 2 is a prime=20
number<BR>&nbsp;&nbsp;&nbsp; 3 is a prime number<BR>&nbsp;&nbsp;&nbsp; 4 =
equals=20
2 * 2<BR>&nbsp;&nbsp;&nbsp; 5 is a prime number<BR>&nbsp;&nbsp;&nbsp; 6 =
equals 2=20
* 3<BR>&nbsp;&nbsp;&nbsp; 7 is a prime number<BR>&nbsp;&nbsp;&nbsp; 8 =
equals 2 *=20
4<BR>&nbsp;&nbsp;&nbsp; 9 equals 3 * 3</FONT></DIV>
<DIV><FONT size=3D2>thanks</FONT></DIV>
<DIV><FONT size=3D2>SAMUEL L BESS</FONT></DIV></BODY></HTML>

--Boundary_(ID_b1QszdhjvhglIlKmVAHKmw)--


From smb181@mciworld.com  Wed Sep 15 01:25:22 1999
From: smb181@mciworld.com (smb181)
Date: Tue, 14 Sep 1999 17:25:22 -0700
Subject: [Tutor] HELP
Message-ID: <000a01beff10$cd6ec1a0$6cbc143f@k2d2d6>

This is a multi-part message in MIME format.

--Boundary_(ID_acL3Ecdpm8UB7UJugEW8AA)
Content-type: text/plain; charset="iso-8859-1"
Content-transfer-encoding: quoted-printable


----- Original Message -----=20
From: smb181=20
To: tutor@python.org=20
Sent: Tuesday, September 14, 1999 5:22 PM


>>>The following is part of the [4.4 section] in the Python Tutorial. =
Please help me If you can. I am new to programming and computers;thanks =
in advance.
for n in range(2, 10):
    ...     for x in range(2, n):
    ...         if n % x =3D=3D 0:( I don't understand the n%x what does =
it mean)
    ...            print n, 'equals', x, '*', n/x
    ...            break
    ...     else:
    ...          print n, 'is a prime number'
    ...=20
    2 is a prime number
    3 is a prime number
    4 equals 2 * 2
    5 is a prime number
    6 equals 2 * 3
    7 is a prime number
    8 equals 2 * 4
    9 equals 3 * 3
thanks
SAMUEL L BESS

--Boundary_(ID_acL3Ecdpm8UB7UJugEW8AA)
Content-type: text/html; charset="iso-8859-1"
Content-transfer-encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content=3D"text/html; charset=3Diso-8859-1" =
http-equiv=3DContent-Type>
<META content=3D"MSHTML 5.00.2614.3401" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV>&nbsp;</DIV>
<DIV style=3D"FONT: 10pt arial">----- Original Message -----=20
<DIV style=3D"BACKGROUND: #e4e4e4; font-color: black"><B>From:</B> <A=20
href=3D"mailto:smb181@mciworld.com" =
title=3Dsmb181@mciworld.com>smb181</A> </DIV>
<DIV><B>To:</B> <A href=3D"mailto:tutor@python.org"=20
title=3Dtutor@python.org>tutor@python.org</A> </DIV>
<DIV><B>Sent:</B> Tuesday, September 14, 1999 5:22 PM</DIV></DIV>
<DIV><BR></DIV>
<DIV><FONT size=3D2>&gt;&gt;&gt;The following is part of the [4.4 =
section] in the=20
Python Tutorial. Please help me If you can. I am new to programming and=20
computers;thanks in advance.</FONT></DIV>
<DIV><FONT size=3D2>for n in range(2, 10):<BR>&nbsp;&nbsp;&nbsp;=20
...&nbsp;&nbsp;&nbsp;&nbsp; for x in range(2, n):<BR>&nbsp;&nbsp;&nbsp; =
<FONT=20
color=3D#ff0000>...&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if n =
% x =3D=3D=20
0:( I&nbsp;don't understand the n%x what does it =
mean)<BR>&nbsp;&nbsp;&nbsp;=20
</FONT>...&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
sp;=20
print n, 'equals', x, '*', n/x<BR>&nbsp;&nbsp;&nbsp;=20
...&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
break<BR>&nbsp;&nbsp;&nbsp; ...&nbsp;&nbsp;&nbsp;&nbsp;=20
else:<BR>&nbsp;&nbsp;&nbsp;=20
...&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; print n, 'is a =
prime=20
number'<BR>&nbsp;&nbsp;&nbsp; ... <BR>&nbsp;&nbsp;&nbsp; 2 is a prime=20
number<BR>&nbsp;&nbsp;&nbsp; 3 is a prime number<BR>&nbsp;&nbsp;&nbsp; 4 =
equals=20
2 * 2<BR>&nbsp;&nbsp;&nbsp; 5 is a prime number<BR>&nbsp;&nbsp;&nbsp; 6 =
equals 2=20
* 3<BR>&nbsp;&nbsp;&nbsp; 7 is a prime number<BR>&nbsp;&nbsp;&nbsp; 8 =
equals 2 *=20
4<BR>&nbsp;&nbsp;&nbsp; 9 equals 3 * 3</FONT></DIV>
<DIV><FONT size=3D2>thanks</FONT></DIV>
<DIV><FONT size=3D2>SAMUEL L BESS</FONT></DIV></BODY></HTML>

--Boundary_(ID_acL3Ecdpm8UB7UJugEW8AA)--


From ed_tsang@yahoo.com  Wed Sep 15 00:05:27 1999
From: ed_tsang@yahoo.com (edward)
Date: Tue, 14 Sep 1999 16:05:27 -0700
Subject: [Tutor] embedding python in C --- big porblem
Message-ID: <37DED4B7.A8375337@yahoo.com>

Hi to all knowlegable python user out there:
I'm am very new to python and have been having huge trouble in embdding
python with c and extending python with c.
here is what I am trying to do:
1) extending python in c
   A)
   *  create a function mymath(int a, int b)  in a file called mymath.c;

   *  try to call mymath  function to add 1 & 2 from a pythohn script,
   * without recompling try to call mymath to add 3 and 4 from the
python script
   *  without recompliing try to redefine mymath, so that I am
subtracting this time
   * try to call mymath function to subtract 1 from 2
   * without recompliing try to call mymath to subtract 3 from 4
    B)
    * create a structure which has two elements a and b,
         a function initStruct(x,y)  to in a file called intiStruct.c.
initStruct(x,y)  will initlize a    to     x, b to y value.
     *  try  from a pythohn script, try to call the initStruct to
intialise the stucture to 2 and 3
    * without recompling try to call initStruct to intialise structure
to 3 and 4 from the python script

2) embedding python to c
A)
  *  create a function mymath(int a, int b)  in a file called mymath.py
;
   *  try to call mymath  function to add 1 & 2 from a C program,
   * without recompling try to call mymath to add 3 and 4 from the C
program
   *  without recompliing try to redefine mymath, so that I am
subtracting this time.
   * try to call mymath function to subtract 1 from 2, from the C
program
   * without recompliing try to call mymath to subtract 3 from 4, from
the C program

Can any one help me on this please. Can you give me the complete working
code on this matter. I really need all you expert help on this thing.
thanks.



From ed_tsang@yahoo.com  Wed Sep 15 00:08:43 1999
From: ed_tsang@yahoo.com (edward)
Date: Tue, 14 Sep 1999 16:08:43 -0700
Subject: [Tutor] Re: embedding python in C --- big porblem
References: <37DED4B7.A8375337@yahoo.com>
Message-ID: <37DED57B.FB1395F9@yahoo.com>

Please mail me your response to ed_tsang@yahoo.com
thanks

edward wrote:

> Hi to all knowlegable python user out there:
> I'm am very new to python and have been having huge trouble in embdding
> python with c and extending python with c.
> here is what I am trying to do:
> 1) extending python in c
>    A)
>    *  create a function mymath(int a, int b)  in a file called mymath.c;
>
>    *  try to call mymath  function to add 1 & 2 from a pythohn script,
>    * without recompling try to call mymath to add 3 and 4 from the
> python script
>    *  without recompliing try to redefine mymath, so that I am
> subtracting this time
>    * try to call mymath function to subtract 1 from 2
>    * without recompliing try to call mymath to subtract 3 from 4
>     B)
>     * create a structure which has two elements a and b,
>          a function initStruct(x,y)  to in a file called intiStruct.c.
> initStruct(x,y)  will initlize a    to     x, b to y value.
>      *  try  from a pythohn script, try to call the initStruct to
> intialise the stucture to 2 and 3
>     * without recompling try to call initStruct to intialise structure
> to 3 and 4 from the python script
>
> 2) embedding python to c
> A)
>   *  create a function mymath(int a, int b)  in a file called mymath.py
> ;
>    *  try to call mymath  function to add 1 & 2 from a C program,
>    * without recompling try to call mymath to add 3 and 4 from the C
> program
>    *  without recompliing try to redefine mymath, so that I am
> subtracting this time.
>    * try to call mymath function to subtract 1 from 2, from the C
> program
>    * without recompliing try to call mymath to subtract 3 from 4, from
> the C program
>
> Can any one help me on this please. Can you give me the complete working
> code on this matter. I really need all you expert help on this thing.
> thanks.



From ed_tsang@yahoo.com  Wed Sep 15 00:15:08 1999
From: ed_tsang@yahoo.com (edward)
Date: Tue, 14 Sep 1999 16:15:08 -0700
Subject: [Tutor] Re: embedding python in C --- big porblem
References: <37DED4B7.A8375337@yahoo.com> <37DED57B.FB1395F9@yahoo.com>
Message-ID: <37DED6FC.E0AF92B2@yahoo.com>

I have forgotten to ask one more question on this:
Is it possible to compile the code such that the resultant will be just one
excutable? (ie. python executable and the c exxcutable are residing in the
same process)?
If that is the case, I suspect I cannot change the input parameters on the fly
(ie: I cannot do something like having mymath doing addin and  then redefining
the do substraction. without recmpling as in my questions below) Am I right on
that?
Thanks a gain
edward wrote:

> Please mail me your response to ed_tsang@yahoo.com
> thanks
>
> edward wrote:
>
> > Hi to all knowlegable python user out there:
> > I'm am very new to python and have been having huge trouble in embdding
> > python with c and extending python with c.
> > here is what I am trying to do:
> > 1) extending python in c
> >    A)
> >    *  create a function mymath(int a, int b)  in a file called mymath.c;
> >
> >    *  try to call mymath  function to add 1 & 2 from a pythohn script,
> >    * without recompling try to call mymath to add 3 and 4 from the
> > python script
> >    *  without recompliing try to redefine mymath, so that I am
> > subtracting this time
> >    * try to call mymath function to subtract 1 from 2
> >    * without recompliing try to call mymath to subtract 3 from 4
> >     B)
> >     * create a structure which has two elements a and b,
> >          a function initStruct(x,y)  to in a file called intiStruct.c.
> > initStruct(x,y)  will initlize a    to     x, b to y value.
> >      *  try  from a pythohn script, try to call the initStruct to
> > intialise the stucture to 2 and 3
> >     * without recompling try to call initStruct to intialise structure
> > to 3 and 4 from the python script
> >
> > 2) embedding python to c
> > A)
> >   *  create a function mymath(int a, int b)  in a file called mymath.py
> > ;
> >    *  try to call mymath  function to add 1 & 2 from a C program,
> >    * without recompling try to call mymath to add 3 and 4 from the C
> > program
> >    *  without recompliing try to redefine mymath, so that I am
> > subtracting this time.
> >    * try to call mymath function to subtract 1 from 2, from the C
> > program
> >    * without recompliing try to call mymath to subtract 3 from 4, from
> > the C program
> >
> > Can any one help me on this please. Can you give me the complete working
> > code on this matter. I really need all you expert help on this thing.
> > thanks.



From piercew@netscape.net  Wed Sep 15 02:51:59 1999
From: piercew@netscape.net (Wayne)
Date: 14 Sep 99 18:51:59 PDT
Subject: [Tutor] Help needed?
Message-ID: <19990915015159.3309.qmail@ww184.netaddress.usa.net>

...I know I'm going to regret this, but I've recently started learning Python
{I know a little [Perl, Java, C, C++, Scheme, Clips], enough to cause problems
on the system without understanding what went wrong}.  However, I don't have
any ideas on good projects to start working on to help solidify the learning.

My question....does anyone need help with a project they are working on?  Most
of the time I have will be on the weekends.  I was thinking about starting to
port various Perl modules to Python as a way to get more familiar with
things.

Wayne

____________________________________________________________________
Get your own FREE, personal Netscape WebMail account today at http://webmail.netscape.com.


From skip@mojam.com (Skip Montanaro)  Wed Sep 15 06:00:43 1999
From: skip@mojam.com (Skip Montanaro) (Skip Montanaro)
Date: Wed, 15 Sep 1999 00:00:43 -0500 (CDT)
Subject: [Tutor] Re: [Python-Help] embedding python in C --- big porblem
In-Reply-To: <37DED4B7.A8375337@yahoo.com>
References: <37DED4B7.A8375337@yahoo.com>
Message-ID: <14303.10235.382144.699775@dolphin.mojam.com>

Edward,

I seriously doubt you are going to find anyone willing to solve our complete 
examples, but I will give you a few pointers.

To extend Python with a module written in C, first you start by reading the
extending and embedding manual at

    http://www.python.org/doc/current/ext/ext.html

and familiarize yourself with the stub module that is delivered as
xxmodule.c in the Modules directory of the source distribution.  In your
example of a module named mymath that defines a single function called
mymath that takes two integers and adds them, you can ignore all but the
Xxo_demo function, the PyMethodDef array and the initxx function.  You will
need to flesh out the Xxo_demo function to perform the required task
(convert the Python args into C variables, add the two numbers, then convert
the C variable back into a Python object that is returned).  Modify the
Xxo_method array to point to your mymath_mymath routine and suitably
initialize the initxx routine.  You might also look at the soundex module in
the Modules directory as an example of a very simple module that only
exposes a couple functions and doesn't define any new objects.

As for embedding Python into C, again, read the extending and embedding
manual.  In the simplest case, you may have little to do but insert a few
Python calls in your application and give your users some way to enter
Python code that is then interpreted.  Embedding Python into a C app can get 
very hairy as well, and for most useful tasks probably overlaps heavily with 
extending examples.

Skip Montanaro | http://www.mojam.com/
skip@mojam.com | http://www.musi-cal.com/~skip/
847-971-7098   | Python: Programming the way Guido indented...


From arcege@shore.net  Wed Sep 15 16:19:19 1999
From: arcege@shore.net (Michael P. Reilly)
Date: Wed, 15 Sep 1999 11:19:19 -0400 (EDT)
Subject: [Tutor] Re: embedding python in C --- big porblem
In-Reply-To: <37DED6FC.E0AF92B2@yahoo.com> from edward at "Sep 14, 99 04:15:08 pm"
Message-ID: <199909151519.LAA23988@northshore.shore.net>

> edward wrote:
> 
> > Please mail me your response to ed_tsang@yahoo.com
> > thanks
> >
> > edward wrote:
> >
> > > Hi to all knowlegable python user out there:
> > > I'm am very new to python and have been having huge trouble in embdding
> > > python with c and extending python with c.
> > > here is what I am trying to do:
> > > 1) extending python in c
> > >    A)
> > >    *  create a function mymath(int a, int b)  in a file called mymath.c;

If you have a specific C function, then you can easily create a C
wrapper function for it.  You can do this with sig, or write the C
wrapper yourself.  In fact many of the standard C extension modules are
such wrappers.  The function would look like:

  PyObject *  /* return a Python object */
  pyfunc_mymath(self, args)
    PyObject *self, *args;
    { PyObject *result;
      int rc, a, b;

      if (!PyArg_ParseTuple(args, "ii:mymath", &a, &b))
        /* PyArg_ParseTuple sets the exception for you */
        return NULL;
      /* call your function */
      rc = mymath(a, b);
      /* construct a Python object from it */
      result = Py_BuildValue("i", rc);
      /* return the resulting Python object */
      return result;
    }

Now you just need to add the new wrapper function to the module listing
as described in the manuals:
  http://www.python.org/doc/current/ext/ext.html
You will need to create a new module to hold this new function (and
possibly others).

> > >    *  try to call mymath  function to add 1 & 2 from a pythohn script,

Import the module created above and call the function:
  >>> import mymod
  >>> print mymod.mymath(1, 2)
  3

> > >    * without recompling try to call mymath to add 3 and 4 from the
> > > python script

Call the function with other arguments within Python.
  >>> import mymod
  >>> mymod.mymath(1, 2)
  3
  >>> mymod.mymath(3, 4)
  7

> > >    *  without recompliing try to redefine mymath, so that I am
> > > subtracting this time

Well, you can not redefine the internal function of mymath - that is a
C function compiled into the module.  But the module IS a normal Python
namespace and namespaces can be changed:

  >>> import mymod
  >>> mymod.mymath(1, 2)
  3
  >>> mymod.mymath = lambda a, b: a - b
  >>> mymod.mymath(3, 4)
  -1

The name is redefined to be a Python lambda function instead of a
builtin C function.

> > >    * try to call mymath function to subtract 1 from 2
> > >    * without recompliing try to call mymath to subtract 3 from 4

> > >     B)
> > >     * create a structure which has two elements a and b,
> > >          a function initStruct(x,y)  to in a file called intiStruct.c.
> > > initStruct(x,y)  will initlize a    to     x, b to y value.
> > >      *  try  from a pythohn script, try to call the initStruct to
> > > intialise the stucture to 2 and 3

This is the same as above.

> > >     * without recompling try to call initStruct to intialise structure
> > > to 3 and 4 from the python script

> > > 2) embedding python to c
> > > A)
> > >   *  create a function mymath(int a, int b)  in a file called mymath.py
> > > ;

Creating a C function inside a Python module file?

Assuming you mean to create a Python function, then you can use:
  fp = fopen("commands.py", "r");
  PyRun_SimpleFile(fp, "commands.py");

This is about the same as `exec("commands.py")'.

Assuming that you mean to call a C function, you would need to code
this into the C program.  This is the same as above, except through the
C API instead of through a Python script:

  /* import the module */
  mymod = PyImport_ImportModule("mymod");
  /* get the mymod.initStruct */
  myfunc = PyObject_GetAttrString(mymod, "initStruct");
  /* call it */
  x = 2;
  result = PyObject_CallFunction(myfunc, "ii", x, 3);

> > >    *  try to call mymath  function to add 1 & 2 from a C program,
> > >    * without recompling try to call mymath to add 3 and 4 from the C
> > > program

That would need to be a C solution and not something for Python to
handle. E.g. reading from stdin, reading from file, reading from UI
form.

> > >    *  without recompliing try to redefine mymath, so that I am
> > > subtracting this time.

See the first section; again, we're talking about namespaces.  But you
have to write code to tell the program to redefine the name "mymath".

> > >    * try to call mymath function to subtract 1 from 2, from the C
> > > program
> > >    * without recompliing try to call mymath to subtract 3 from 4, from
> > > the C program

Most everything in this section means changing the C program, which
means recompiling, or changing the Python script file.

> > > Can any one help me on this please. Can you give me the complete working
> > > code on this matter. I really need all you expert help on this thing.
> > > thanks.

Considering there is little to go on, it's unlikely that you will get
"complete working code" from anyone.  Maybe you could repost what you
are looking to do in a more clearly defined manner.

> I have forgotten to ask one more question on this:
> Is it possible to compile the code such that the resultant will be just one
> excutable? (ie. python executable and the c exxcutable are residing in the
> same process)?

When you extend or embed Python with C (or another language), then you
get one executable (and possibly some dynamic loadables (.so, .dll,
etc. depending on how you build it)

> If that is the case, I suspect I cannot change the input parameters on the fly
> (ie: I cannot do something like having mymath doing addin and  then redefining
> the do substraction. without recmpling as in my questions below) Am I right on
> that?
> Thanks a gain

This would depend on what you have the program do.  You could have the
program define all of Python if you realllllly wanted (not that I would
suggest it).  The python interpreter, like just about any interpreter,
is just read-eval-print loop.  Your program could read input parameters
from any medium and use them within the program without recompiling (if
you designed the program to do that.)

I suggest you read the Python documentation thoroughly; specifically:
  http://www.python.org/doc/current/ext/ext.html, and
  http://www.python.org/doc/current/api/api.html, and possibly even
  http://starship.python.net/crew/arcege/extwriting/pyext.html.

  -Arcege

-- 
------------------------------------------------------------------------
| Michael P. Reilly, Release Engineer | Email: arcege@shore.net        |
| Salem, Mass. USA  01970             |                                |
------------------------------------------------------------------------


From ed_tsang@yahoo.com  Wed Sep 15 23:21:03 1999
From: ed_tsang@yahoo.com (Edward Tsang)
Date: Wed, 15 Sep 1999 15:21:03 -0700 (PDT)
Subject: [Tutor] compliing error and linkage error
Message-ID: <19990915222103.18973.rocketmail@web219.mail.yahoo.com>


> 
> here is the error message I have got when I try to
> link modules together.
> For some reason, python does seem to know where
> mymath/mymath_wrapper  is?
> Can anyone give me a hand on that? (see Below for
> more detailed dscription)
> 
> Python 1.5 (#1, Jan 23 1998, 15:03:33)  [GCC
> 2.7.2.2] on sunos5
> Copyright 1991-1995 Stichting Mathematisch Centrum,
> Amsterdam
> >>> import mymath 
> Traceback (innermost last):
>   File "<stdin>", line 1, in ?
> ImportError: No module named mymath
> >>> import mymath_wrapper
> Traceback (innermost last):
>   File "<stdin>", line 1, in ?
> ImportError: ld.so.1: python: fatal: relocation
> error: file ./mymath_wrapper.so: symbol mymath:
> referenced symbol not found
> 
> 
> Description:
> AIM 1)  try to call mymath from Python
> 2) mymath function is defined and declared in
> mymath.h, all written in c
> 3) a wrapper module mymath_wrapper.c is done for
> mymath function also in c
> 4) attached are the make files I used, have done the
> following:
>    *) Makefile.pre.in ---> no ediiting done
>    *)Setup  ----> editted to include mymath_wrapper
> and mymathwrapper.c  
>     Setup.in (same as Setup and not included in
> here)
>     *) make_shared ---> edited to include
> mymath_wrapper and mymath_wrapper.c
> 5) using Python1.5.2 and cc. on Solris CDE 1.3
> Thanks
>   
> 

> ATTACHMENT part 2 application/x-sun-shell-script name=make_shared;
x-unix-mode=0755
> # Universal Unix Makefile for Python extensions
> # =============================================
> 
> # Short Instructions
> # ------------------
> 
> # 1. Build and install Python (1.5 or newer).
> # 2. "make -f Makefile.pre.in boot"
> # 3. "make"
> # You should now have a shared library.
> 
> # Long Instructions
> # -----------------
> 
> # Build *and install* the basic Python 1.5
> distribution.  See the
> # Python README for instructions.  (This version of
> Makefile.pre.in
> # only withs with Python 1.5, alpha 3 or newer.)
> 
> # Create a file Setup.in for your extension.  This
> file follows the
> # format of the Modules/Setup.in file; see the
> instructions there.
> # For a simple module called "spam" on file
> "spammodule.c", it can
> # contain a single line:
> #   spam spammodule.c
> # You can build as many modules as you want in the
> same directory --
> # just have a separate line for each of them in the
> Setup.in file.
> 
> # If you want to build your extension as a shared
> library, insert a
> # line containing just the string
> #   *shared*
> # at the top of your Setup.in file.
> 
> # Note that the build process copies Setup.in to
> Setup, and then works
> # with Setup.  It doesn't overwrite Setup when
> Setup.in is changed, so
> # while you're in the process of debugging your
> Setup.in file, you may
> # want to edit Setup instead, and copy it back to
> Setup.in later.
> # (All this is done so you can distribute your
> extension easily and
> # someone else can select the modules they actually
> want to build by
> # commenting out lines in the Setup file, without
> editing the
> # original.  Editing Setup is also used to specify
> nonstandard
> # locations for include or library files.)
> 
> # Copy this file (Misc/Makefile.pre.in) to the
> directory containing
> # your extension.
> 
> # Run "make -f Makefile.pre.in boot".  This creates
> Makefile
> # (producing Makefile.pre and sedscript as
> intermediate files) and
> # config.c, incorporating the values for sys.prefix,
> sys.exec_prefix
> # and sys.version from the installed Python binary. 
> For this to work,
> # the python binary must be on your path.  If this
> fails, try
> #   make -f Makefile.pre.in Makefile VERSION=1.5
> installdir=<prefix>
> # where <prefix> is the prefix used to install
> Python for installdir
> # (and possibly similar for
> exec_installdir=<exec_prefix>).
> 
> # Note: "make boot" implies "make clobber" -- it
> assumes that when you
> # bootstrap you may have changed platforms so it
> removes all previous
> # output files.
> 
> # If you are building your extension as a shared
> library (your
> # Setup.in file starts with *shared*), run "make" or
> "make sharedmods"
> # to build the shared library files.  If you are
> building a statically
> # linked Python binary (the only solution of your
> platform doesn't
> # support shared libraries, and sometimes handy if
> you want to
> # distribute or install the resulting Python
> binary), run "make
> # python".
> 
> # Note: Each time you edit Makefile.pre.in or Setup,
> you must run
> # "make Makefile" before running "make".
> 
> # Hint: if you want to use VPATH, you can start in
> an empty
> # subdirectory and say (e.g.):
> #   make -f ../Makefile.pre.in boot srcdir=..
> VPATH=..
> 
> 
> # === Bootstrap variables (edited through "make
> boot") ===
> 
> # The prefix used by "make inclinstall libainstall"
> of core python
> installdir=	/usr/local
> 
> # The exec_prefix used by the same
> exec_installdir=$(installdir)
> 
> # Source directory and VPATH in case you want to use
> VPATH.
> # (You will have to edit these two lines yourself --
> there is no
> # automatic support as the Makefile is not generated
> by
> # config.status.)
> srcdir=		.
> VPATH=		.
> 
> # === Variables that you may want to customize
> (rarely) ===
> 
> # (Static) build target
> TARGET=		python
> 
> # Installed python binary (used only by boot target)
> PYTHON=		python
> 
> # Add more -I and -D options here
> CFLAGS=		$(OPT) -I$(INCLUDEPY) -I$(EXECINCLUDEPY)
> $(DEFS)
> 
> # These two variables can be set in Setup to merge
> extensions.
> # See example[23].
> BASELIB=	
> BASESETUP=	
> 
> # === Variables set by makesetup ===
> 
> MODOBJS=	_MODOBJS_
> MODLIBS=	_MODLIBS_
> 
> # === Definitions added by makesetup ===
> 
> # === Variables from configure (through sedscript)
> ===
> 
> VERSION=	@VERSION@
> CC=		@CC@
> LINKCC=		@LINKCC@
> SGI_ABI=	@SGI_ABI@
> OPT=		@OPT@
> LDFLAGS=	@LDFLAGS@
> LDLAST=		@LDLAST@
> DEFS=		@DEFS@
> LIBS=		@LIBS@
> LIBM=		@LIBM@
> LIBC=		@LIBC@
> RANLIB=		@RANLIB@
> MACHDEP=	@MACHDEP@
> SO=		@SO@
> LDSHARED=	@LDSHARED@
> CCSHARED=	@CCSHARED@
> LINKFORSHARED=	@LINKFORSHARED@
> #@SET_CCC@
> 
> # Install prefix for architecture-independent files
> prefix=		/usr/local
> 
> # Install prefix for architecture-dependent files
> exec_prefix=	$(prefix)
> 
> # Uncomment the following two lines for AIX
> #LINKCC= 	$(LIBPL)/makexp_aix $(LIBPL)/python.exp ""
> $(LIBRARY); $(PURIFY) $(CC)
> #LDSHARED=	$(LIBPL)/ld_so_aix $(CC)
> -bI:$(LIBPL)/python.exp
> 
> # === Fixed definitions ===
> 
> # Shell used by make (some versions default to the
> login shell, which is bad)
> SHELL=		/bin/sh
> 
> # Expanded directories
> BINDIR=		$(exec_installdir)/bin
> LIBDIR=		$(exec_prefix)/lib
> MANDIR=		$(installdir)/man
> INCLUDEDIR=	$(installdir)/include
> SCRIPTDIR=	$(prefix)/lib
> 
> # Detailed destination directories
> BINLIBDEST=	$(LIBDIR)/python$(VERSION)
> LIBDEST=	$(SCRIPTDIR)/python$(VERSION)
> INCLUDEPY=	$(INCLUDEDIR)/python$(VERSION)
> EXECINCLUDEPY=
> $(exec_installdir)/include/python$(VERSION)
> LIBP=		$(exec_installdir)/lib/python$(VERSION)
> DESTSHARED=	$(BINLIBDEST)/site-packages
> 
> LIBPL=		$(LIBP)/config
> 
> PYTHONLIBS=	$(LIBPL)/libpython$(VERSION).a
> 
> MAKESETUP=	$(LIBPL)/makesetup
> MAKEFILE=	$(LIBPL)/Makefile
> CONFIGC=	$(LIBPL)/config.c
> CONFIGCIN=	$(LIBPL)/config.c.in
> SETUP=		$(LIBPL)/Setup.thread $(LIBPL)/Setup.local
> $(LIBPL)/Setup
> 
> SYSLIBS=	$(LIBM) $(LIBC)
> 
> ADDOBJS=	$(LIBPL)/python.o config.o
> 
> # Portable install script (configure doesn't always
> guess right)
> INSTALL=	$(LIBPL)/install-sh -c
> # Shared libraries must be installed with executable
> mode on some systems;
> # rather than figuring out exactly which, we always
> give them executable mode.
> # Also, making them read-only seems to be a good
> idea...
> INSTALL_SHARED=	${INSTALL} -m 555
> 
> # === Fixed rules ===
> 
> # Default target.  This builds shared libraries only
> default:	sharedmods
> 
> # Build everything
> all:		static sharedmods
> 
> # Build shared libraries from our extension modules
> sharedmods:	$(SHAREDMODS)
> 
> # Build a static Python binary containing our
> extension modules
> static:		$(TARGET)
> $(TARGET):	$(ADDOBJS) lib.a $(PYTHONLIBS) Makefile
> $(BASELIB)
> 		$(LINKCC) $(LDFLAGS) $(LINKFORSHARED) \
> 		 $(ADDOBJS) lib.a $(PYTHONLIBS) \
> 		 $(LINKPATH) $(BASELIB) $(MODLIBS) $(LIBS)
> $(SYSLIBS) \
> 		 -o $(TARGET) $(LDLAST)
> 
> install:	sharedmods
> 		if test ! -d $(DESTSHARED) ; then \
> 			mkdir $(DESTSHARED) ; else true ; fi
> 		-for i in X $(SHAREDMODS); do \
> 			if test $$i != X; \
> 			then $(INSTALL_SHARED) $$i $(DESTSHARED)/$$i; \
> 			fi; \
> 		done
> 
> # Build the library containing our extension modules
> lib.a:		$(MODOBJS)
> 		-rm -f lib.a
> 		ar cr lib.a $(MODOBJS)
> 		-$(RANLIB) lib.a 
> 
> # This runs makesetup *twice* to use the BASESETUP
> definition from Setup
> config.c Makefile:	Makefile.pre Setup $(BASESETUP)
> $(MAKESETUP)
> 		$(MAKESETUP) \
> 		 -m Makefile.pre -c $(CONFIGCIN) Setup -n
> $(BASESETUP) $(SETUP)
> 		$(MAKE) -f Makefile do-it-again
> 
> # Internal target to run makesetup for the second
> time
> do-it-again:
> 		$(MAKESETUP) \
> 		 -m Makefile.pre -c $(CONFIGCIN) Setup -n
> $(BASESETUP) $(SETUP)
> 
> # Make config.o from the config.c created by
> makesetup
> config.o:	config.c
> 		$(CC) $(CFLAGS) -c config.c
> 
> # Setup is copied from Setup.in *only* if it doesn't
> yet exist
> Setup:
> 		cp $(srcdir)/Setup.in Setup
> 
> # Make the intermediate Makefile.pre from
> Makefile.pre.in
> Makefile.pre: Makefile.pre.in sedscript
> 		sed -f sedscript $(srcdir)/Makefile.pre.in
> >Makefile.pre
> 
> # Shortcuts to make the sed arguments on one line
> P=prefix
> E=exec_prefix
> H=Generated automatically from Makefile.pre.in by
> sedscript.
> L=LINKFORSHARED
> 
> # Make the sed script used to create Makefile.pre
> from Makefile.pre.in
> sedscript:	$(MAKEFILE)
> 	sed -n \
> 	 -e '1s/.*/1i\\/p' \
> 	 -e '2s%.*%# $H%p' \
> 	 -e '/^VERSION=/s/^VERSION=[ 
> ]*\(.*\)/s%@VERSION[@]%\1%/p' \
> 	 -e '/^CC=/s/^CC=[ 	]*\(.*\)/s%@CC[@]%\1%/p' \
> 	 -e '/^CCC=/s/^CCC=[ 
> ]*\(.*\)/s%#@SET_CCC[@]%CCC=\1%/p' \
> 	 -e '/^LINKCC=/s/^LINKCC=[ 
> ]*\(.*\)/s%@LINKCC[@]%\1%/p' \
> 	 -e '/^OPT=/s/^OPT=[ 	]*\(.*\)/s%@OPT[@]%\1%/p' \
> 	 -e '/^LDFLAGS=/s/^LDFLAGS=[ 
> ]*\(.*\)/s%@LDFLAGS[@]%\1%/p' \
> 	 -e '/^LDLAST=/s/^LDLAST=[     
> ]*\(.*\)/s%@LDLAST[@]%\1%/p' \
> 	 -e '/^DEFS=/s/^DEFS=[ 	]*\(.*\)/s%@DEFS[@]%\1%/p'
> \
> 	 -e '/^LIBS=/s/^LIBS=[ 	]*\(.*\)/s%@LIBS[@]%\1%/p'
> \
> 	 -e '/^LIBM=/s/^LIBM=[ 	]*\(.*\)/s%@LIBM[@]%\1%/p'
> \
> 	 -e '/^LIBC=/s/^LIBC=[ 	]*\(.*\)/s%@LIBC[@]%\1%/p'
> \
> 	 -e '/^RANLIB=/s/^RANLIB=[ 
> ]*\(.*\)/s%@RANLIB[@]%\1%/p' \
> 	 -e '/^MACHDEP=/s/^MACHDEP=[ 
> ]*\(.*\)/s%@MACHDEP[@]%\1%/p' \
> 	 -e '/^SO=/s/^SO=[ 	]*\(.*\)/s%@SO[@]%\1%/p' \
> 	 -e '/^LDSHARED=/s/^LDSHARED=[ 
> ]*\(.*\)/s%@LDSHARED[@]%\1%/p' \
> 	 -e '/^CCSHARED=/s/^CCSHARED=[ 
> ]*\(.*\)/s%@CCSHARED[@]%\1%/p' \
> 	 -e '/^SGI_ABI=/s/^SGI_ABI=[ 
> ]*\(.*\)/s%@SGI_ABI[@]%\1%/p' \
> 	 -e '/^$L=/s/^$L=[ 	]*\(.*\)/s%@$L[@]%\1%/p' \
> 	 -e '/^$P=/s/^$P=\(.*\)/s%^$P=.*%$P=\1%/p' \
> 	 -e '/^$E=/s/^$E=\(.*\)/s%^$E=.*%$E=\1%/p' \
> 	 $(MAKEFILE) >sedscript
> 	echo "/^#@SET_CCC@/d" >>sedscript
> 	echo "/^installdir=/s%=.*%=	$(installdir)%"
> >>sedscript
> 	echo
> "/^exec_installdir=/s%=.*%=$(exec_installdir)%"
> >>sedscript
> 	echo "/^srcdir=/s%=.*%=		$(srcdir)%" >>sedscript
> 	echo "/^VPATH=/s%=.*%=		$(VPATH)%" >>sedscript
> 	echo "/^LINKPATH=/s%=.*%=	$(LINKPATH)%" >>sedscript
> 	echo "/^BASELIB=/s%=.*%=	$(BASELIB)%" >>sedscript
> 	echo "/^BASESETUP=/s%=.*%=	$(BASESETUP)%"
> >>sedscript
> 
> # Bootstrap target
> boot:	clobber
> 	VERSION=`$(PYTHON) -c "import sys; print
> sys.version[:3]"`; \
> 	installdir=`$(PYTHON) -c "import sys; print
> sys.prefix"`; \
> 	exec_installdir=`$(PYTHON) -c "import sys; print
> sys.exec_prefix"`; \
> 	$(MAKE) -f $(srcdir)/Makefile.pre.in VPATH=$(VPATH)
> srcdir=$(srcdir) \
> 		VERSION=$$VERSION \
> 		installdir=$$installdir \
> 		exec_installdir=$$exec_installdir \
> 		Makefile
> 
> # Handy target to remove intermediate files and
> backups
> clean:
> 		-rm -f *.o *~
> 
> # Handy target to remove everything that is easily
> regenerated
> clobber:	clean
> 		-rm -f *.a tags TAGS config.c Makefile.pre
> $(TARGET) sedscript
> 		-rm -f *.so *.sl so_locations
> 
> 
> # Handy target to remove everything you don't want
> to distribute
> distclean:	clobber
> 		-rm -f Makefile Setup
> > 
> 
> int add(int a, int b)
> {
> 	return (int)(a+b);
> }
> > #include <Python.h>
> #include "mymath.h"
> 
> PyObject*
> pyfunc_mymath(self, args)
>  PyObject *self, *args;
>  {
>  PyObject *result;
>  int res, a, b;
>  if(!PyArg_ParseTuple(args,"ii:mymath",&a,&b))
>  	return NULL;
>  res = mymath(a,b);
>  result = Py_BuildValue("i",res);
>  return result;
>  }
>  
>  static PyMethodDef mymathMethods[] = 
>  {
>  	{"mymath", pyfunc_mymath, METH_VARARGS},
>  	{NULL,NULL}
>  };
>  
>  void initmymath()
>  {
>  	(void) Py_InitModule("mymath", mymathMethods);
>  }
>  
> > *shared*
> mymath_wrapper mymath_wrapper.c
> 

__________________________________________________
Do You Yahoo!?
Bid and sell for free at http://auctions.yahoo.com


From alan.gauld@bt.com  Thu Sep 16 09:42:59 1999
From: alan.gauld@bt.com (alan.gauld@bt.com)
Date: Thu, 16 Sep 1999 09:42:59 +0100
Subject: [Tutor] "Learning Python" Chapter Exercise
Message-ID: <5104D4DBC598D211B5FE0000F8FE7EB202DF5E1D@mbtlipnt02.btlabs.bt.co.uk>

> At the end of chapter one, I managed to get the first question, but
> can't work out the second, which is to create a one line 
> module: print 
> "hello module world', saved as module1.py
> 
> The book uses Linux (or unix) examples and I am (for now) running
> windows. 

Best bet is start a command prompt(aka MS DOs box) and CD 
to the folder containing your module(say C:\Projects\Python):

Then type:

C:\Projects\Python> python module1.py

If you want to run it from anywhjere you have to set 
the PYTHONPATH environment variable in your autoexec.bat

Its similar to the DOS Path VARIABLE...

Alan g.


From alan.gauld@bt.com  Thu Sep 16 09:59:33 1999
From: alan.gauld@bt.com (alan.gauld@bt.com)
Date: Thu, 16 Sep 1999 09:59:33 +0100
Subject: [Tutor] little pythons
Message-ID: <5104D4DBC598D211B5FE0000F8FE7EB202DF5E1E@mbtlipnt02.btlabs.bt.co.uk>

> a 12-year old.  I know that Seymor Papert of MIT was very enthusiastic
> about teaching LOGO to children.  He desribes his experiences in a book

I used LOGO to teach a 14 year old and it was quite successful.
Unfortunately LOGO is more like LISP than any of the 'normal' 
languages so making the transition to VB or even Python is a 
big jump...

> (and links to download them).  Pyhon does have a turtle module, so dear to
> the hearts of LOGO-minded people, so it is certainly possible to start
> python, and then do something like 

Oh dear, I know Turtle graphics started with Logo but Logo is 
much more than that. It is a full list prpocessing language 
like lisp. The turtle graphics are only one small part 
and pretty boring in my experience unless you have one of 
the proper turtle robots that crawls over the floor!

>>> import turtle
>>> joe = turtle.Pen()
>>> lisa = turtle.Pen()
>>> joe.down()
>>> joe.forward(50)
>>> lisa.right()

But if you want to use turtle graphics logo, smalltalk and yes, 
python will all do a spliendid job. 


Alan G.


From alan.gauld@bt.com  Thu Sep 16 10:18:41 1999
From: alan.gauld@bt.com (alan.gauld@bt.com)
Date: Thu, 16 Sep 1999 10:18:41 +0100
Subject: [Tutor] (no subject)
Message-ID: <5104D4DBC598D211B5FE0000F8FE7EB202DF5E23@mbtlipnt02.btlabs.bt.co.uk>

>     ...     for x in range(2, n):
>     ...         if n % x == 0:( I don't understand the n%x 

It means find the remainder of an integer division.

Thus 7 divided by 3 is 2 remainder 1
So,
7/3 => 2
7%3 => 1

Thus 
   n%x == 0 
is true when the number held in n is exactlty 
divisible by the number in x.
And thus n cannot be a prime number...

Alan G.


From eroubinc@u.washington.edu  Thu Sep 16 18:01:51 1999
From: eroubinc@u.washington.edu (Evgeny Roubinchtein)
Date: Thu, 16 Sep 1999 10:01:51 -0700 (PDT)
Subject: [Tutor] little pythons
In-Reply-To: <5104D4DBC598D211B5FE0000F8FE7EB202DF5E1E@mbtlipnt02.btlabs.bt.co.uk>
Message-ID: <Pine.A41.4.10.9909160952001.82166-100000@dante29.u.washington.edu>

On Thu, 16 Sep 1999 alan.gauld@bt.com wrote:

>I used LOGO to teach a 14 year old and it was quite successful.
>Unfortunately LOGO is more like LISP than any of the 'normal' 
>languages so making the transition to VB or even Python is a 
>big jump...

But seeing past the syntax of the language at hand and learning to
appreciate the concepts involved might be a good practice -- maybe not
to begin with.

>> (and links to download them).  Pyhon does have a turtle module, so dear to
>
>Oh dear, I know Turtle graphics started with Logo but Logo is 
>much more than that. It is a full list prpocessing language 
>like lisp. The turtle graphics are only one small part 
>and pretty boring in my experience unless you have one of 
>the proper turtle robots that crawls over the floor!

So, I am curious, what ideas do you have in mind for teaching programming
to a 12-year old with Python?  I am reasonably certain Python is flexible
enough to do just about anything you can do in LOGO or LISP.  What's wrong
with translating a LOGO book into Python, for instance?


--
Evgeny Roubinchtein, eroubinc@u.washington.edu
...................
DO: Deadstart Operator



From alan.gauld@bt.com  Thu Sep 16 18:18:43 1999
From: alan.gauld@bt.com (alan.gauld@bt.com)
Date: Thu, 16 Sep 1999 18:18:43 +0100
Subject: [Tutor] little pythons
Message-ID: <5104D4DBC598D211B5FE0000F8FE7EB202DF5E37@mbtlipnt02.btlabs.bt.co.uk>

> From: Evgeny Roubinchtein [mailto:eroubinc@u.washington.edu]

Wow, bizarre,

I was just reading this message on the Web digest on the python 
page when it popped into my mailbox!

> >Unfortunately LOGO is more like LISP than any of the 'normal' 
> >languages so making the transition to VB or even Python is a 
> >big jump...
> 
> But seeing past the syntax of the language at hand and learning to
> appreciate the concepts involved might be a good practice -- maybe not
> to begin with.

I agree in principle but as you say - not to begin with.

> >Oh dear, I know Turtle graphics started with Logo but Logo is 
> >much more than that. It is a full list prpocessing language 
> ...
> So, I am curious, what ideas do you have in mind for teaching 
> programming to a 12-year old with Python?  
> ...
> What's wrong
> with translating a LOGO book into Python, for instance?

Nothing at all. I was merely responding to the common 
misconception that teaching Logo means teaching turtle graphics.
The idea started in Logo but is available elsewhere and indeed 
there are even (a very few)Logos around without turtle graphics.
What makes Logo good for youngsters is not just the turtles but 
also its simple syntax(even easier than Python IMHO). Unfortunately 
that turns out to be a bit of a dead end for youngsters because 
its a big jump to anything else. Which is what I was trying to 
say earlier.

There's even an OO LOGO and a full MFC encapsulation for windows 
programming - no turtles in sight.

BUT Python can do the turtle graphics just as well as LOGO.
Also, its an easier jump to VB etc - which most youngsters want 
to do because they want to build GUI based programs and VB is 
almost certainly the easiest way to do that. Python will 
instill good habits before they move and some may even stick 
with it and become regular Python programmers! :-).

Alan G.


From skip@mojam.com (Skip Montanaro)  Thu Sep 16 19:27:55 1999
From: skip@mojam.com (Skip Montanaro) (Skip Montanaro)
Date: Thu, 16 Sep 1999 13:27:55 -0500 (CDT)
Subject: [Tutor] Re: [Python-Help] compliing error and linkage error
In-Reply-To: <19990915222103.18973.rocketmail@web219.mail.yahoo.com>
References: <19990915222103.18973.rocketmail@web219.mail.yahoo.com>
Message-ID: <14305.13995.678136.849157@dolphin.mojam.com>

    >> >>> import mymath 
    >> Traceback (innermost last):
    >> File "<stdin>", line 1, in ?
    >> ImportError: No module named mymath
    >> >>> import mymath_wrapper
    >> Traceback (innermost last):
    >> File "<stdin>", line 1, in ?
    >> ImportError: ld.so.1: python: fatal: relocation
    >> error: file ./mymath_wrapper.so: symbol mymath:
    >> referenced symbol not found

Edward,

There are a few things to check when you have import problems, especially
for the first module or two you write.

1. Make sure your C source file is named mymath.c or mymathmodule.c.

2. If you want your module statically linked into Python, make sure either
   the *shared* line in your Setup file was commented out or at least
   appears after the definition for your module.  In this case you will have 
   to rebuild Python.

3. If you want your module dynamically linked into Python, make sure the
   *shared* line is uncommented and appears in you Setup file before the
   definition for your module.  If both conditions don't hold, make won't
   generate the proper type of output file.  Also, make sure that the
   generated shared object file (mymath.so or mymathmodule.so for Solaris I
   think) resides somewhere on sys.path.  For testing, you can just execute
   Python from the directory containing mymath.so or mymathmodule.so, since
   that is in sys.path by default.  You can examine sys.path from the Python
   prompt by executing

    >>> import sys
    >>> print sys.path

Skip Montanaro | http://www.mojam.com/
skip@mojam.com | http://www.musi-cal.com/~skip/
847-971-7098   | Python: Programming the way Guido indented...


From ed_tsang@yahoo.com  Thu Sep 16 22:43:50 1999
From: ed_tsang@yahoo.com (Edward Tsang)
Date: Thu, 16 Sep 1999 14:43:50 -0700 (PDT)
Subject: [Tutor] can I pass a "structure" to a C function to init a C struct?
Message-ID: <19990916214350.19562.rocketmail@web215.mail.yahoo.com>

A new question:
I'm trying this:
1) create something similar to C structure with a number of fields say
3 fields: a, b, c.
a will hold integer value
b will hold a string
c will hold a float
2) Python script will pass this to a C function called
initStruct through a wrapper function.
3)initStruct will initalise its a global structure according to a,b,and
c. its global structure also contains three fields: i,j,k. i being an
integer, j a string,, c a float. But they are C type.
4) it will return the values to python script
5) python script will know how to convert it back and display on screen

Can anyone tell me what is teh best way to do that? Is that possible???




What is the most appropriate method to create a 

__________________________________________________
Do You Yahoo!?
Bid and sell for free at http://auctions.yahoo.com


From arcege@shore.net  Fri Sep 17 00:29:42 1999
From: arcege@shore.net (Michael P. Reilly)
Date: Thu, 16 Sep 1999 19:29:42 -0400 (EDT)
Subject: [Tutor] can I pass a "structure" to a C function to init a C struct?
In-Reply-To: <19990916214350.19562.rocketmail@web215.mail.yahoo.com> from Edward Tsang at "Sep 16, 99 02:43:50 pm"
Message-ID: <199909162329.TAA12930@northshore.shore.net>

> A new question:
> I'm trying this:
> 1) create something similar to C structure with a number of fields say
> 3 fields: a, b, c.
> a will hold integer value
> b will hold a string
> c will hold a float
> 2) Python script will pass this to a C function called
> initStruct through a wrapper function.
> 3)initStruct will initalise its a global structure according to a,b,and
> c. its global structure also contains three fields: i,j,k. i being an
> integer, j a string,, c a float. But they are C type.
> 4) it will return the values to python script
> 5) python script will know how to convert it back and display on screen
> 
> Can anyone tell me what is teh best way to do that? Is that possible???

You will want to look at the "struct" module which encodes data as a
byte array (which is how a C struct is laid out in memory).

Since you don't say what the integer is, I'll assume it is a long. Also
you do not specify what the "string" is; is it a character array or a
pointer to a char?  Let's say that it is a character array.

  >>> import struct
  >>> fmt = "l20sf"
  >>> data = struct.pack(fmt, a, b, c)
  >>> print data
  '\377\000\000\000knights who say ni\000\000\320\017I@'
  >>> print struct.unpack(fmt, data)
  (255, 'knights who say ni\000\000', 3.14159011841)

Then in the C function, overlay the resulting string as a pointer to
the struct you want.  When converting the data back, you need to deal
with the null characters ('\000') in the unpacked string.

    struct b_struct {
      int a;
      char b[20];
      float c;
    } *b;
    PyObject *string_from_python;
    if (PyString_Size(string_from_python) != sizeof(struct b_struct)) {
      PyErr_SetString(PyExc_AssertionError, "Given string not a good size");
      return NULL;
    }
    b = (struct b_struct *)PyString_AsString(string_from_python);
    printf("%d\n%s\n%f\n", b->a, b->b, b-c);

Pointers will be more difficult since references are always
dereferenced in Python.  To handle pointers, you will need to write a C
function.

  -Arcege

-- 
------------------------------------------------------------------------
| Michael P. Reilly, Release Engineer | Email: arcege@shore.net        |
| Salem, Mass. USA  01970             |                                |
------------------------------------------------------------------------


From ed_tsang@yahoo.com  Fri Sep 17 06:01:13 1999
From: ed_tsang@yahoo.com (Edward Tsang)
Date: Thu, 16 Sep 1999 22:01:13 -0700 (PDT)
Subject: [Tutor] can I pass a "structure" to a C function to init a C struct?
Message-ID: <19990917050113.5775.rocketmail@web201.mail.yahoo.com>

Hello,
I have tried on the code I encountered segmentation fault error when it
at the 
if(PyString_size(string_from_python) != sizeof(struct b_struct)
statement.
Can anyone give a hand?


--- "Michael P. Reilly" <arcege@shore.net> wrote:
> > A new question:
> > I'm trying this:
> > 1) create something similar to C structure with a
> number of fields say
> > 3 fields: a, b, c.
> > a will hold integer value
> > b will hold a string
> > c will hold a float
> > 2) Python script will pass this to a C function
> called
> > initStruct through a wrapper function.
> > 3)initStruct will initalise its a global structure
> according to a,b,and
> > c. its global structure also contains three
> fields: i,j,k. i being an
> > integer, j a string,, c a float. But they are C
> type.
> > 4) it will return the values to python script
> > 5) python script will know how to convert it back
> and display on screen
> > 
> > Can anyone tell me what is teh best way to do
> that? Is that possible???
> 
> You will want to look at the "struct" module which
> encodes data as a
> byte array (which is how a C struct is laid out in
> memory).
> 
> Since you don't say what the integer is, I'll assume
> it is a long. Also
> you do not specify what the "string" is; is it a
> character array or a
> pointer to a char?  Let's say that it is a character
> array.
> 
>   >>> import struct
>   >>> fmt = "l20sf"
>   >>> data = struct.pack(fmt, a, b, c)
>   >>> print data
>   '\377\000\000\000knights who say
> ni\000\000\320\017I@'
>   >>> print struct.unpack(fmt, data)
>   (255, 'knights who say ni\000\000', 3.14159011841)
> 
> Then in the C function, overlay the resulting string
> as a pointer to
> the struct you want.  When converting the data back,
> you need to deal
> with the null characters ('\000') in the unpacked
> string.
> 
>     struct b_struct {
>       int a;
>       char b[20];
>       float c;
>     } *b;
>     PyObject *string_from_python;
>     if (PyString_Size(string_from_python) !=
> sizeof(struct b_struct)) {
>       PyErr_SetString(PyExc_AssertionError, "Given
> string not a good size");
>       return NULL;
>     }
>     b = (struct b_struct
> *)PyString_AsString(string_from_python);
>     printf("%d\n%s\n%f\n", b->a, b->b, b-c);
> 
> Pointers will be more difficult since references are
> always
> dereferenced in Python.  To handle pointers, you
> will need to write a C
> function.
> 
>   -Arcege
> 
> -- 
>
------------------------------------------------------------------------
> | Michael P. Reilly, Release Engineer | Email:
> arcege@shore.net        |
> | Salem, Mass. USA  01970             |             
>                   |
>
------------------------------------------------------------------------
> 

__________________________________________________
Do You Yahoo!?
Bid and sell for free at http://auctions.yahoo.com


From bryan.hann@pobox.com  Thu Sep 16 20:05:56 1999
From: bryan.hann@pobox.com (Bryan Hann)
Date: Fri, 17 Sep 1999 03:05:56 +0800
Subject: [Tutor] Learning Project Proposal (was: Help needed?)
References: <19990915015159.3309.qmail@ww184.netaddress.usa.net>
Message-ID: <37E13F94.46F33C4D@pobox.com>

Wayne,

I post this to the list because it might be a worthwhile
learning project for others here.

I have a little project that might be nifty.  I assume you 
are familiar with regular expressions.  Python's re module 
leaves some things to be desired.  Suppose I want to build 
a RE to match identifiers built out of letters, numbers and/or 
underscores, but not starting with a number.  This pattern 
should work:

    identifier="(_|a-z|A-Z)(_|a-z|A-Z|0-9)*'

But things can soon get messy. It would be nice to be able to
write something like

    letter="_|a-z|A-Z"
    digit="0-9"
    identifier="letter+(letter|digit)*"

But identifier is a pattern that, roughly speaking, does not 
match strings beginning with a letter, but instead matches 
strings that begin with the string "letter+" -- clearly not 
our intent! I propose a reBuilder class that will work like 
this:

    >>>foo=reBuilder()
    >>>foo.letter="_|a-z|A-Z"
    >>>foo.digit="0-9"
    >>>foo.id="letter+(letter|digit)*"
    >>>foo.letter
    "_|a-z|A-Z"
    >>>foo.digit
    "0-9"
    >>>foo.id
    "_|a-z|A-Z((_|a-z|A-Z)|(0-9))*"

The class will work roughly by redefining __setattr__ and 
__getattr__ to make objects

1. accept re components in the form foo.x=y,
2. rewrite y appropriately, then
3. store (x,y) in the dictionary
4. have "foo.x" return the stored string 

Rewriting will involve at least scanning y for substrings 
referring to previous components, and removing '+' and adding 
parentheses as necessary.  More is needed to handle the full
re syntax in the re module, but it will not be hard, and if 
you are very new to Python, you might find it nicely reinforces
some of the nicer semantics of the language. I will begin 
writing soon.  If this interests you, why don't we develop in 
parallel, and compare our results?  We can swap ideas along the 
way.  It should be a small project.  If we want to extend it, 
we can unify our strategy and divide the work.  

Cheers!
--Bryan

Wayne wrote:
> 
> ...I know I'm going to regret this, but I've recently started learning Python
> {I know a little [Perl, Java, C, C++, Scheme, Clips], enough to cause problems
> on the system without understanding what went wrong}.  However, I don't have
> any ideas on good projects to start working on to help solidify the learning.
> 
> My question....does anyone need help with a project they are working on?  Most
> of the time I have will be on the weekends.  I was thinking about starting to
> port various Perl modules to Python as a way to get more familiar with
> things.
-- 
==================================================================
 Bryan Hann -- bryan.hann@pobox.com -- www.pobox.com/~bryan.hann
 The RITE Group: Researching Information Technology in Education.
==================================================================


From pfjakub@earthlink.net  Fri Sep 17 15:13:56 1999
From: pfjakub@earthlink.net (Peter Jakubowicz)
Date: Fri, 17 Sep 1999 07:13:56 -0700
Subject: [Tutor] Setting Path
Message-ID: <37E24CA4.AA80AE07@earthlink.net>

Hi,

I am confused by the following (I am running Python under MS-Windows):
In order to pass a module to the intepreter, I have to switch to the
directory in which I have saved my module, i.e., I can't pass it from
the python shell. However, I can import my module from the shell. Should
I be able to also pass the module to the interpreter from the shell, and
what command should I place in my autoexec.bat file to do so. Any help
would be much appreciated. TIA


From ed_tsang@yahoo.com  Fri Sep 17 19:45:07 1999
From: ed_tsang@yahoo.com (Edward Tsang)
Date: Fri, 17 Sep 1999 11:45:07 -0700 (PDT)
Subject: [Tutor] NEWBIE: init a multiple field C struct from Python easyily
Message-ID: <19990917184507.15419.rocketmail@web202.mail.yahoo.com>

Hey, I am trying to initialise a C structure from Python. 
My Aim is to init a C structure without passing each indivual elements
through the interface, but rather package the whole thing and pass that
it one time. Then the C may do somethign about it, initialise its won
struct and pass back a struct with the same kind of elements but with
different parameters. I am stuck with the intialising the C struct
part, and have not clue how to convert the C struct back to a PyObject
appropriate to pass back to the Python script. Please help . Below is
the code. 

Error: segmentation fault occurres at 
PyArg_ParseTuple(args,"s:mymath",string_from_Python))
PyString_Size(string_from_Python)calls inside 
function pyfunc_mystruct 

Here is what I tried:

From the python script I have:
import struct
import mymath_wrapper
fmt = "120sf"
a=255
b='knights who say ni'
c=3.14159011841
data = struct.pack(fmt,a,b,c)
mymath_wrapper.mystruct(data)

in my mymath_wrapper.c file I have:
#include <Python.h>
#include "mymath.h"

PyObject*
pyfunc_mystruct(self, args)
 PyObject *self, *args;
 {
 PyObject* string_from_Python;
 if(!PyArg_ParseTuple(args,"s:mymath",string_from_Python))
 	return NULL;
 if(PyString_Size(string_from_Python)!= sizeof(struct diffstruct))
 {
 	PyErr_SetString(PyExc_AssertionError, "Given strgin not a good
size");
 	return NULL;
 }
 
 
 globaldiffstruct = (diffstruct
*)PyString_AsString(string_from_Python);
 
 printf("globaldiffstruct calling within C:%d  %s
%f\n",globaldiffstruct->a, globaldiffstruct->b,globaldiffstruct->c);
 /* python side will print the last res value*/
 return string_from_Python; /* not correct, deal with this later */
 }
 
 static PyMethodDef mymathMethods[] = 
 {
 	{"mystruct", pyfunc_mystruct, 1},
 	{NULL,NULL}
 };
 
 void initmymath_wrapper()
 {
 	(void) Py_InitModule("mymath_wrapper", mymathMethods);
 }
__________________________________________________
Do You Yahoo!?
Bid and sell for free at http://auctions.yahoo.com


From warren@nightwares.com  Fri Sep 17 19:53:59 1999
From: warren@nightwares.com (Warren 'The Howdy Man' Ockrassa)
Date: Fri, 17 Sep 1999 13:53:59 -0500
Subject: [Tutor] Duplicating lists in variables?
Message-ID: <37E28E47.E28300F@nightwares.com>

I don't see an immediate way around this one.

  >>> foo = [1,2,3]
  >>> bar = foo
  >>> bar
  [1, 2, 3]
  >>> bar.append(4)
  >>> bar
  [1, 2, 3, 4]
  >>> foo
  [1, 2, 3, 4]

When I append bar, IOW, foo gets modified too. Is there a way for me to
actually *duplicate* a list or am I stuck just propagating pointers to
one list?

Thanks!

--
    warren ockrassa | nightwares | mailto:warren@nightwares.com


From cwebster@nevada.edu  Fri Sep 17 20:09:12 1999
From: cwebster@nevada.edu (Corran Webster)
Date: Fri, 17 Sep 1999 12:09:12 -0700 (PDT)
Subject: [Tutor] Duplicating lists in variables?
In-Reply-To: <37E28E47.E28300F@nightwares.com>
Message-ID: <Pine.OSF.3.96.990917120208.3608F-100000@pollux.nevada.edu>

> I don't see an immediate way around this one.
> 
>   >>> foo = [1,2,3]
>   >>> bar = foo
>   >>> bar
>   [1, 2, 3]
>   >>> bar.append(4)
>   >>> bar
>   [1, 2, 3, 4]
>   >>> foo
>   [1, 2, 3, 4]
> 
> When I append bar, IOW, foo gets modified too. Is there a way for me to
> actually *duplicate* a list or am I stuck just propagating pointers to
> one list?

One way is:

bar = foo[:]

which copies the entire list by taking it as a slice.  For more complex
mutable objects, you might take a look at the copy module:

import copy

bar = copy.copy(foo)      # same as above but works for any mutable object

bar = copy.deepcopy(foo)  # will copy any mutable objects contained in foo
                          #  and any mutables contained in _them_, and so
                          #  on...

Regards,
Corran




From joe@strout.net  Fri Sep 17 20:10:31 1999
From: joe@strout.net (Joseph J. Strout)
Date: Fri, 17 Sep 1999 12:10:31 -0700
Subject: [Tutor] Duplicating lists in variables?
In-Reply-To: <37E28E47.E28300F@nightwares.com>
References: <37E28E47.E28300F@nightwares.com>
Message-ID: <v04210121b4084254e156@[198.202.70.213]>

>When I append bar, IOW, foo gets modified too. Is there a way for me to
>actually *duplicate* a list?

But of course!  You could use the copy module, which can copy 
anything.  But there's a sneaky way to use the slice operator which 
is more common:

bar = foo[:]

This works because the slice operator returns a new list which is a 
subset of the original.  But if the subset starts at the beginning, 
and continues till the end, then it happens to be a copy of the 
entire list!

Cheers,
-- Joe

,------------------------------------------------------------------.
|    Joseph J. Strout           Biocomputing -- The Salk Institute |
|    joe@strout.net             http://www.strout.net              |
`------------------------------------------------------------------'


From ivanlan@callware.com  Fri Sep 17 20:16:04 1999
From: ivanlan@callware.com (Ivan Van Laningham)
Date: Fri, 17 Sep 1999 13:16:04 -0600
Subject: [Tutor] Duplicating lists in variables?
References: <37E28E47.E28300F@nightwares.com>
Message-ID: <37E29374.71A5F270@callware.com>

Hi All--

Warren 'The Howdy Man' Ockrassa wrote:
> 
> I don't see an immediate way around this one.
> 
>   >>> foo = [1,2,3]
>   >>> bar = foo
>   >>> bar
>   [1, 2, 3]
>   >>> bar.append(4)
>   >>> bar
>   [1, 2, 3, 4]
>   >>> foo
>   [1, 2, 3, 4]
> 
> When I append bar, IOW, foo gets modified too. Is there a way for me to
> actually *duplicate* a list or am I stuck just propagating pointers to
> one list?
> 

Try this:


foo = [1,2,3]
bar = foo[:]

print foo
print bar
bar.append(4)
print foo
print bar


<life-is-easier-than-you-think>-ly y'rs,
Ivan
----------------------------------------------
Ivan Van Laningham
Callware Technologies, Inc.
ivanlan@callware.com
ivanlan@home.com
http://www.pauahtun.org
See also: 
http://www.foretec.com/python/workshops/1998-11/proceedings.html
Army Signal Corps:  Cu Chi, Class of '70
----------------------------------------------


From dlhiggs@netins.net  Fri Sep 17 23:14:12 1999
From: dlhiggs@netins.net (donald higgs)
Date: Fri, 17 Sep 1999 15:14:12 -0700
Subject: [Tutor] (the reply's additional "re:"is ok)
Message-ID: <001501bf0159$f9a7bce0$9b0b8ea7@dlhiggs>

This is a multi-part message in MIME format.

------=_NextPart_000_0012_01BF011F.4C2D14A0
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

comfirm 262707

------=_NextPart_000_0012_01BF011F.4C2D14A0
Content-Type: text/html;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content=3D"text/html; charset=3Diso-8859-1" =
http-equiv=3DContent-Type>
<META content=3D"MSHTML 5.00.2614.3401" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT size=3D2>comfirm 262707</FONT></DIV></BODY></HTML>

------=_NextPart_000_0012_01BF011F.4C2D14A0--



From ed_tsang@yahoo.com  Fri Sep 17 22:04:29 1999
From: ed_tsang@yahoo.com (Edward Tsang)
Date: Fri, 17 Sep 1999 14:04:29 -0700 (PDT)
Subject: [Tutor] general question about python integration with C
Message-ID: <19990917210429.26670.rocketmail@web201.mail.yahoo.com>

I have a general question about python integration with C. I have the
current situation from what I want to drive to the outter most
triggering source.

0) a bunch of C App programs
1) a C wrapper file as conversion medium between a python script and
the C application program
2) a python script.

My aim is to use a python script to drive some triggers to the C App
programs. But I will need to input a lot of parameters as input values
either for initialisation purspose or as driver input parameters. 

Since if I use a seperate driver written soley in C, whenever I change
some input parameters, I need to recompile and link the whole thing. I
hope to use python to hold those changable parameters, pass it to C
Apps. So whenever I need to change the parameters, I only need to
change the script without all those recompliation and linking thing. I
may even change the driving sequence without recompliation.

Now I run into this situation:
I want to test the App program's ability to do interprocess
communication. The way to do this is to have my C driver program in one
process and My App program in another process. 
But in using Python extendsion to C. How can I have the driving
programs(python script, C wrapper program)  run in one process while my
Apps program in another process? Or is there something I can do? 
If you have run in a similar situation, or you are using pyton to drive
testing your Apps. What do you suggest?
Thanks.



__________________________________________________
Do You Yahoo!?
Bid and sell for free at http://auctions.yahoo.com


From arcege@shore.net  Fri Sep 17 22:13:22 1999
From: arcege@shore.net (Michael P. Reilly)
Date: Fri, 17 Sep 1999 17:13:22 -0400 (EDT)
Subject: [Tutor] NEWBIE: init a multiple field C struct from Python easyily
In-Reply-To: <19990917184507.15419.rocketmail@web202.mail.yahoo.com> from Edward Tsang at "Sep 17, 99 11:45:07 am"
Message-ID: <199909172113.RAA10492@northshore.shore.net>

Edward, I think it may be time to move this level of questioning to the
Python list (mailto:python-list@python.org or news:comp.lang.python), or
to the respondants directly. :)

See my comments below.

  -Arcege

> Hey, I am trying to initialise a C structure from Python. 
> My Aim is to init a C structure without passing each indivual elements
> through the interface, but rather package the whole thing and pass that
> it one time. Then the C may do somethign about it, initialise its won
> struct and pass back a struct with the same kind of elements but with
> different parameters. I am stuck with the intialising the C struct
> part, and have not clue how to convert the C struct back to a PyObject
> appropriate to pass back to the Python script. Please help . Below is
> the code. 
> 
> Error: segmentation fault occurres at 
> PyArg_ParseTuple(args,"s:mymath",string_from_Python))
> PyString_Size(string_from_Python)calls inside 
> function pyfunc_mystruct 
> 
> Here is what I tried:
> 
> >From the python script I have:
> import struct
> import mymath_wrapper
> fmt = "120sf"
> a=255
> b='knights who say ni'
> c=3.14159011841
> data = struct.pack(fmt,a,b,c)
> mymath_wrapper.mystruct(data)
> 
> in my mymath_wrapper.c file I have:
> #include <Python.h>
> #include "mymath.h"
> 
> PyObject*
> pyfunc_mystruct(self, args)
>  PyObject *self, *args;
>  {
>  PyObject* string_from_Python;
>  if(!PyArg_ParseTuple(args,"s:mymath",string_from_Python))
>          return NULL;

Using a small "s" returns a (char *), using a capital "S" returns a
(PyObject *).

The segmentation fault is from attempting to access a character array
as the fields of a PyObject *.

>  if(PyString_Size(string_from_Python)!= sizeof(struct diffstruct))
>  {
>          PyErr_SetString(PyExc_AssertionError, "Given strgin not a good
> size");
>          return NULL;
>  }
>  
>  
>  globaldiffstruct = (diffstruct
> *)PyString_AsString(string_from_Python);
>  
>  printf("globaldiffstruct calling within C:%d  %s
> %f\n",globaldiffstruct->a, globaldiffstruct->b,globaldiffstruct->c);
>  /* python side will print the last res value*/
>  return string_from_Python; /* not correct, deal with this later */
>  }
>  
>  static PyMethodDef mymathMethods[] = 
>  {
>          {"mystruct", pyfunc_mystruct, 1},
>          {NULL,NULL}
>  };
>  
>  void initmymath_wrapper()
>  {
>          (void) Py_InitModule("mymath_wrapper", mymathMethods);
>  }


-- 
------------------------------------------------------------------------
| Michael P. Reilly, Release Engineer | Email: arcege@shore.net        |
| Salem, Mass. USA  01970             |                                |
------------------------------------------------------------------------


From deirdre@deirdre.net  Fri Sep 17 22:22:09 1999
From: deirdre@deirdre.net (Deirdre Saoirse)
Date: Fri, 17 Sep 1999 14:22:09 -0700 (PDT)
Subject: [Tutor] NEWBIE: init a multiple field C struct from Python
 easyily
In-Reply-To: <199909172113.RAA10492@northshore.shore.net>
Message-ID: <Pine.LNX.4.10.9909171421170.13313-100000@adelie.deirdre.org>

On Fri, 17 Sep 1999, Michael P. Reilly wrote:

> Edward, I think it may be time to move this level of questioning to the
> Python list (mailto:python-list@python.org or news:comp.lang.python), or
> to the respondants directly. :)

Actually, I was finding it very interesting. :)

-- 
_Deirdre   *   http://www.linuxcabal.net   *   http://www.deirdre.net
"I must say that I was really happy to see _Linux for Dummies_ -- that's 
when you know you've arrived." -- Linus Torvalds



From Alexandre Passos" <atp@bahianet.com.br  Sat Sep 18 16:51:10 1999
From: Alexandre Passos" <atp@bahianet.com.br (Alexandre Passos)
Date: Sat, 18 Sep 1999 12:51:10 -0300
Subject: [Tutor] Python GUI builder
Message-ID: <000101bf01fe$4a44b140$485bdfc8@the-user>

This is a multi-part message in MIME format.

------=_NextPart_000_0082_01BF01D4.7B731F60
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

In Conectiva Linux 4.0 I found a python GUI module. It uses a TK builder =
called GTK and transfers it to python. The module  is called pygtk.=20

------=_NextPart_000_0082_01BF01D4.7B731F60
Content-Type: text/html;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD W3 HTML//EN">
<HTML>
<HEAD>

<META content=3Dtext/html;charset=3Diso-8859-1 =
http-equiv=3DContent-Type>
<META content=3D'"MSHTML 4.72.3110.7"' name=3DGENERATOR>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT color=3D#000000 size=3D2>In Conectiva Linux 4.0 I found a =
python GUI=20
module. It uses a TK builder called GTK and transfers it to python. The=20
module&nbsp; is called pygtk. </FONT></DIV></BODY></HTML>

------=_NextPart_000_0082_01BF01D4.7B731F60--



From Alexandre Passos" <atp@bahianet.com.br  Sat Sep 18 16:49:21 1999
From: Alexandre Passos" <atp@bahianet.com.br (Alexandre Passos)
Date: Sat, 18 Sep 1999 12:49:21 -0300
Subject: [Tutor] LOGO
Message-ID: <000001bf01fe$49953760$485bdfc8@the-user>

This is a multi-part message in MIME format.

------=_NextPart_000_007B_01BF01D4.3A9067A0
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

I'm a 12 year-old children and want to learn python. I know LOGO turtle =
and QBASIC. Logo is a very weird language and it hides the =
documentation. Python is nicer for begginners. But basic should be tried =
first because it's sintax is very similar to english.


------=_NextPart_000_007B_01BF01D4.3A9067A0
Content-Type: text/html;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD W3 HTML//EN">
<HTML>
<HEAD>

<META content=3Dtext/html;charset=3Diso-8859-1 =
http-equiv=3DContent-Type>
<META content=3D'"MSHTML 4.72.3110.7"' name=3DGENERATOR>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT color=3D#000000 size=3D2>I'm a 12 year-old children and want =
to learn=20
python. I know LOGO turtle and QBASIC. Logo is a very weird language and =
it=20
hides the documentation. Python is nicer for begginners. But basic =
should be=20
tried first because it's sintax is very similar to english.</FONT></DIV>
<DIV><FONT color=3D#000000 size=3D2></FONT>&nbsp;</DIV></BODY></HTML>

------=_NextPart_000_007B_01BF01D4.3A9067A0--



From seanconway@home.com  Sun Sep 19 03:18:46 1999
From: seanconway@home.com (Sean Conway)
Date: Sat, 18 Sep 1999 19:18:46 -0700
Subject: [Tutor] Printing Multiple Objects, no spaces
Message-ID: <001701bf0245$4def7180$0528a8c0@home>

Hello all.

I need to print multiple objects, without spaces in between. This method
doesn't work:

print foo, foobar

Thanks in advance,

Sean Conway



From rushing@shreve.net  Sat Sep 18 23:43:42 1999
From: rushing@shreve.net (rushing@shreve.net)
Date: Sat, 18 Sep 1999 17:43:42 -0500 (CDT)
Subject: [Tutor] accessing a postgresql database
Message-ID: <Pine.LNX.4.10.9909181740280.2013-100000@vec.shreve.net>

anyone know the syntax to access a postgresql database with a username and
password?   I can disable the postgresql password and it works, but i need
to be able to use the password feature.

ex.

import pg
dat = pg.connect('scribe', 'localhost')
res = dat.query('select * from scribe')

.....




From eroubinc@u.washington.edu  Sun Sep 19 02:06:57 1999
From: eroubinc@u.washington.edu (Evgeny Roubinchtein)
Date: Sat, 18 Sep 1999 18:06:57 -0700 (PDT)
Subject: [Tutor] Printing Multiple Objects, no spaces
In-Reply-To: <001701bf0245$4def7180$0528a8c0@home>
Message-ID: <Pine.A41.4.10.9909181803120.54176-100000@dante35.u.washington.edu>

On Sat, 18 Sep 1999, Sean Conway wrote:

>
>I need to print multiple objects, without spaces in between. This method
>doesn't work:
>
>print foo, foobar

print `foo` + `bar` 

, perhaps? The Language Reference says backqouting an object calls its
__repr__ method, if you need to overwrite that.

--
Evgeny Roubinchtein, eroubinc@u.washington.edu
...................
"Today's subliminal thought is:"



From loewis@informatik.hu-berlin.de  Sun Sep 19 17:41:53 1999
From: loewis@informatik.hu-berlin.de (Martin von Loewis)
Date: Sun, 19 Sep 1999 18:41:53 +0200
Subject: [Tutor] Re: [Python-Help] general question about python integration with C
In-Reply-To: <19990917210429.26670.rocketmail@web201.mail.yahoo.com> (message
 from Edward Tsang on Fri, 17 Sep 1999 14:04:29 -0700 (PDT))
References: <19990917210429.26670.rocketmail@web201.mail.yahoo.com>
Message-ID: <199909191641.SAA14443@pandora>

> I want to test the App program's ability to do interprocess
> communication. The way to do this is to have my C driver program in one
> process and My App program in another process. 
> But in using Python extendsion to C. How can I have the driving
> programs(python script, C wrapper program)  run in one process while my
> Apps program in another process? Or is there something I can do? 
> If you have run in a similar situation, or you are using pyton to drive
> testing your Apps. What do you suggest?

You should create a Python module for your C driver program. Please
see the "extending and embedding" Python manual on how to create a new
Python module.

Then, the C driver code, and the Python script will both run in the
same process; communicating to Your App via interprocess
communication.

Regards,
Martin


From da@ski.org  Sun Sep 19 17:47:52 1999
From: da@ski.org (David Ascher)
Date: Sun, 19 Sep 1999 09:47:52 -0700 (Pacific Daylight Time)
Subject: [Tutor] Printing Multiple Objects, no spaces
In-Reply-To: <001701bf0245$4def7180$0528a8c0@home>
Message-ID: <Pine.WNT.4.05.9909190945380.57-100000@david.ski.org>

On Sat, 18 Sep 1999, Sean Conway wrote:

> Hello all.
> 
> I need to print multiple objects, without spaces in between. This method
> doesn't work:
> 
> print foo, foobar

You need to use the sys.stdout.write() method directly, and build your
strings yourself.  For example:

sys.stdout.write(str(foo))
sys.stdout.write(str(foobar))

Or more generically:

objects = [foo, foobar]  # put whatever you want here
object_strings = map(str, objects)
onebigstring = string.join(object_strings, '') # join w/o spaces
sys.stdout.write(onebigstring)

Or more concisely and harder-to-read:

sys.stdout.write(string.join(map(str, objects), ''))

BTW, that won't write the last newline, which you can just add with a
+'\n' after the string construction.

--david



From piercew@netscape.net  Sun Sep 19 20:06:17 1999
From: piercew@netscape.net (Wayne)
Date: 19 Sep 99 12:06:17 PDT
Subject: [Tutor] Re: learning Python
Message-ID: <19990919190617.6250.qmail@www0c.netaddress.usa.net>

> I post this to the list because it might be a worthwhile
> learning project for others here.

Thanks to everyone that sent me ideas on projects.  I came across one where I
work that I have decided to try out, hopefully it will help sneak Python in
the door as well.

Thanks again,

Wayne

____________________________________________________________________
Get your own FREE, personal Netscape WebMail account today at http://webmail.netscape.com.


From dcmx@hotmail.com  Mon Sep 20 01:23:46 1999
From: dcmx@hotmail.com (Jihone Du)
Date: Sun, 19 Sep 1999 17:23:46 MST
Subject: [Tutor] please do not send me any more e-mails
Message-ID: <19990920002346.71328.qmail@hotmail.com>

tutor-

i would like to cancel my subscribtion to your news letter.
i have learned alot from the tutoring help, but unfortunelately i have no 
more use for your services.

thank you
Jihone

______________________________________________________
Get Your Private, Free Email at http://www.hotmail.com


From ed_tsang@yahoo.com  Mon Sep 20 02:36:58 1999
From: ed_tsang@yahoo.com (ET)
Date: Sun, 19 Sep 1999 18:36:58 -0700 (PDT)
Subject: [Tutor] Re: [Python-Help] general question about python integration with C
Message-ID: <19990920013658.15261.rocketmail@web216.mail.yahoo.com>

--0-424238335-937791418=:11258
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

Hello Martin,
Sorry I don't quite get what you say.
Let me put in some sample code here.
I have three files: 
1) mymathtest.py as the python script
2) mymath_wrapper.c as the wrapper file to mymath.c
3) mymath.c is my App.
From what I get, you are saying once I have this, then
I can have 1) and 2) in the one process, and 3) as a
seperate process?  
How? Can you show me a concrete example, may be by
modifying the code I have as in attachment?

--- Martin von Loewis <loewis@informatik.hu-berlin.de>
wrote:
> > I want to test the App program's ability to do
> interprocess
> > communication. The way to do this is to have my C
> driver program in one
> > process and My App program in another process. 
> > But in using Python extendsion to C. How can I
> have the driving
> > programs(python script, C wrapper program)  run in
> one process while my
> > Apps program in another process? Or is there
> something I can do? 
> > If you have run in a similar situation, or you are
> using pyton to drive
> > testing your Apps. What do you suggest?
> 
> You should create a Python module for your C driver
> program. Please
> see the "extending and embedding" Python manual on
> how to create a new
> Python module.
> 
> Then, the C driver code, and the Python script will
> both run in the
> same process; communicating to Your App via
> interprocess
> communication.
> 
> Regards,
> Martin
> 

__________________________________________________
Do You Yahoo!?
Bid and sell for free at http://auctions.yahoo.com
--0-424238335-937791418=:11258
Content-Type: text/plain; name="mymathtest.py"
Content-Description: mymathtest.py
Content-Disposition: inline; filename="mymathtest.py"

#!/tools/2.5.1/local/bin/python


if __name__== '__main__':
     import sys
     import mymath_wrapper
     import struct
    
     print 'calling mymath_wrapper.c\n'
     print mymath_wrapper.mymath(1,2)
    
     print '\n'
     
     print 'without recomplilation, calling mymath_wrapper.c again\n'
     print mymath_wrapper.mymath(3,4)
      
     print 'using stucture to packed the init value before send'
     fmt = "l20sf"
     a = 250
     b = 'knight who say ni'
     c = 3.14159011841
     
     packed_data = struct.pack(fmt,a,b,c)
     # print struct.unpack(fmt, packed_data)
     print mymath_wrapper.mystruct(packed_data)
     
     
     

--0-424238335-937791418=:11258
Content-Type: application/x-unknown-content-type-h_auto_file; name="mymath.h"
Content-Transfer-Encoding: base64
Content-Description: mymath.h
Content-Disposition: attachment; filename="mymath.h"

dHlwZWRlZiBzdHJ1Y3QgYmxvY2tzdHJ1Y3QNCnsNCglpbnQgYTsgDQoJaW50
IGI7DQoJaW50IGM7DQp9IGJsb2Nrc3RydWN0Ow0KDQp0eXBlZGVmIHN0cnVj
dCBkaWZmc3RydWN0DQp7DQoJaW50IGE7DQoJY2hhciBiWzIwXTsNCglmbG9h
dCBjOw0KDQp9IGRpZmZzdHJ1Y3Q7DQoNCg0KYmxvY2tzdHJ1Y3QgZ2xvYmFs
c3RydWN0Ow0KDQpkaWZmc3RydWN0ICpnbG9iYWxkaWZmc3RydWN0Ow0KDQpp
bnQgbXltYXRoKGJsb2Nrc3RydWN0KiBsb2NhbHN0cnVjdCwgaW50IGEsIGlu
dCBiKQ0Kew0KCXByaW50ZigibXltYXRoIGlzIGNhbGxlZFxuIik7DQoJbG9j
YWxzdHJ1Y3QtPmEgPSBhOw0KCWxvY2Fsc3RydWN0LT5iID0gYjsNCglsb2Nh
bHN0cnVjdC0+YyA9IGEgKyBiOwkNCglyZXR1cm4gKGludCkobG9jYWxzdHJ1
Y3QtPmMpOw0KfQ0KDQppbnQgbXltYXRoMihpbnQgYSwgaW50IGIpDQp7DQoJ
cHJpbnRmKCJteW1hdGgyIGlzIGNhbGxlZFxuIik7DQoJZ2xvYmFsc3RydWN0
LmEgPSBhOw0KCWdsb2JhbHN0cnVjdC5iID0gYjsNCglnbG9iYWxzdHJ1Y3Qu
YyA9IGEgKyBiOwkNCglyZXR1cm4gKGludCkoZ2xvYmFsc3RydWN0LmMpOw0K
fQ0KDQppbnQgbXlzdHJ1Y3QoZGlmZnN0cnVjdCogbG9jYWxzdHJ1Y3QpDQp7
DQoJcHJpbnRmKCJteXN0cnVjdCBpcyBjYWxsZWRcbiIpOw0KCQkNCglyZXR1
cm4gMTsNCn0NCg==

--0-424238335-937791418=:11258
Content-Type: application/x-unknown-content-type-c_auto_file; name="mymath_wrapper.c"
Content-Transfer-Encoding: base64
Content-Description: mymath_wrapper.c
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TEwsTlVMTH0NCiB9Ow0KIA0KIHZvaWQgaW5p
dG15bWF0aF93cmFwcGVyKCkNCiB7DQogCSh2b2lkKSBQeV9Jbml0TW9kdWxl
KCJteW1hdGhfd3JhcHBlciIsIG15bWF0aE1ldGhvZHMpOw0KIH0NCiANCg==


--0-424238335-937791418=:11258--


From gerrit.holl@pobox.com  Mon Sep 20 14:25:19 1999
From: gerrit.holl@pobox.com (Gerrit Holl)
Date: Mon, 20 Sep 1999 15:25:19 +0200
Subject: [Tutor] Printing Multiple Objects, no spaces
In-Reply-To: <001701bf0245$4def7180$0528a8c0@home>
References: <001701bf0245$4def7180$0528a8c0@home>
Message-ID: <19990920152518.A17178@optiplex.palga.uucp>

Sean Conway:
> Hello all.
> 
> I need to print multiple objects, without spaces in between. This method
> doesn't work:
> 
> print foo, foobar
> 

Several way:

print "%s%s" % (foo, foobar)
print foo + foobar
sys.stdout.write(foo); sys.stdout.write(foobar)
sys.stdout.write(foo+foobar)

regards,
Gerrit.
-- 
RTFM: Read That FreshMeat


From ed_tsang@yahoo.com  Mon Sep 20 17:24:38 1999
From: ed_tsang@yahoo.com (ET)
Date: Mon, 20 Sep 1999 09:24:38 -0700 (PDT)
Subject: [Tutor] general question about python integration: repost code included
Message-ID: <19990920162438.13527.rocketmail@web205.mail.yahoo.com>

Hello, I noticed that my code attached last time are
not displayed properly. So I included the code once
more. Attached below is the ORIGIAL PROBLEM, FIRST
ANSWER received and then the codes. Thanks
--------------------------------------------------
POSTED: 

Hello Martin,Sorry I don't quite get what you say.
Let me put in some sample code here.I have three
files: 
1) mymathtest.py as the python script
2) mymath_wrapper.c as the wrapper file to mymath.c3)
mymath.c is my App.
From what I get, you are saying once I have this, then
I can have 1) and 2) in the one process, and 3) as
aseperate process?  
How? Can you show me a concrete example, may be by
modifying the code I have as in attachment?


ORIGINAL PROBLEM: 
I want to test the App program's ability to do>
interprocess communication. The way to do this is to
have my C driver program in one process and My App
program in another process.  But in using Python
extendsion to C. How can I have the driving
programs(python script, C wrapper program)  run in one
process while my Apps program in another process? Or
is there something I can do?  If you have run in a
similar situation, or you are using pyton to drive
testing your Apps. What do you suggest? 

FIRST ANSWER:
You should create a Python module for your C driver
program. Please see the "extending and embedding"
Python manual on how to create a new Python module.
Then, the C driver code, and the Python script will
both run in the same process; communicating to Your
App via interprocess communication. Regards,Martin 
________________________________________________
mymathtest.py
#!/tools/2.5.1/local/bin/pythonif __name__==
'__main__':     import sys
     import mymath_wrapper     import struct    
     print 'calling mymath_wrapper.c\n'     print
mymath_wrapper.mymath(1,2)    
     print '\n'     
     print 'without recomplilation, calling
mymath_wrapper.c again\n'
     print mymath_wrapper.mymath(3,4)      
     print 'using stucture to packed the init value
before send'
     fmt = "l20sf"     a = 250     b = 'knight who say
ni'     c = 3.14159011841
          packed_data = struct.pack(fmt,a,b,c)
     # print struct.unpack(fmt, packed_data)
     print mymath_wrapper.mystruct(packed_data)       
       
------------------------------------------------------
mymath.h:


typedef struct blockstruct
{
	int a; 
	int b;
	int c;
} blockstruct;

typedef struct diffstruct
{
	int a;
	char b[20];
	float c;

} diffstruct;


blockstruct globalstruct;

diffstruct *globaldiffstruct;

int mymath(blockstruct* localstruct, int a, int b)
{
	printf("mymath is called\n");
	localstruct->a = a;
	localstruct->b = b;
	localstruct->c = a + b;	
	return (int)(localstruct->c);
}

int mymath2(int a, int b)
{
	printf("mymath2 is called\n");
	globalstruct.a = a;
	globalstruct.b = b;
	globalstruct.c = a + b;	
	return (int)(globalstruct.c);
}

int mystruct(diffstruct* localstruct)
{
	printf("mystruct is called\n");
		
	return 1;
}
------------------------------------------------------
mymath_wrapper.c:


#include <Python.h>
#include "mymath.h"

PyObject*
pyfunc_mymath(self, args)
 PyObject *self, *args;
 {
 PyObject *result;
 int res, a, b;
 blockstruct localstruct;
 
 if(!PyArg_ParseTuple(args,"ii:mymath",&a,&b))
 	return NULL;
 
 /* initialise a local structure */
 res = mymath(&localstruct,a,b);
 printf("localstruct a:%d b:%d
c:%d\n",localstruct.a,localstruct.b,localstruct.c);
 /* initialise a global structure, don't need to pass
in address of global struct */
 res = mymath2((a+1),(b+1));
 printf("globalstruct a:%d b:%d
c:%d\n",globalstruct.a,globalstruct.b,globalstruct.c);
 result = Py_BuildValue("i",res);
 
 /* python side will print the last res value*/
 return result;
 }
 

PyObject*
pyfunc_mystruct(self, args)
 PyObject *self, *args;
 {
 PyObject* string_from_Python;

if(!PyArg_ParseTuple(args,"S:mymath",&string_from_Python)
)
 	return NULL;
 if(PyString_Size(string_from_Python)!= sizeof(struct
diffstruct))
 {
 	PyErr_SetString(PyExc_AssertionError, "Given strgin
not a good size");
 	return NULL;
 }
 
 globaldiffstruct = (diffstruct
*)PyString_AsString(string_from_Python);
 printf("globaldiffstruct calling within C:%d  %s
%f\n",globaldiffstruct->a,
globaldiffstruct->b,globaldiffstruct->c);
 /* python side will print the last res value*/
 return (PyObject *) globaldiffstruct; /* not correct,
deal with this later */
 }
 
 static PyMethodDef mymathMethods[] = 
 {
 	{"mymath", pyfunc_mymath, 1},
 	{"mymath2", pyfunc_mymath, 1},
 	{"mystruct", pyfunc_mystruct, 1},
 	{NULL,NULL}
 };
 
 void initmymath_wrapper()
 {
 	(void) Py_InitModule("mymath_wrapper",
mymathMethods);
 }
 


__________________________________________________
Do You Yahoo!?
Bid and sell for free at http://auctions.yahoo.com


From webmaster@juwanet.org  Thu Sep 23 11:07:21 1999
From: webmaster@juwanet.org (Reijo Paunonen)
Date: Thu, 23 Sep 1999 13:07:21 +0300
Subject: [Tutor] Core python Binaries
Message-ID: <3.0.5.32.19990923130721.00900e20@www.juwanet.org>

Greetings from Finland !!!
I am installing BSCW program to our server (Win NT4.0 server) and i need to
know from where can i  download "Core Python Binaries" for Wpy ?.
I didnt find it.
Also I am very grateful if u can guide me throught the whole installation.
Its my first time when i try to do this and this software(BSCW) does not
appear
so often in Finnish servers. So it would be very big step to Finnish
education too!!.
Our network operates in field of education. www.juwanet.org

Yours:
Reijo Paunonen 
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Terveisin:                              @
Reijo Paunonen                        @@ @@
ATK-Tukihenkilö                     @@     @@
Juvan sivistystoimi.              @@ JUWANET @@ 
tel.040-5688590                     @@     @@
fax: 015-7551327                      @@ @@   
webmaster@juwanet.org                   @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@


From teroc@zianet.com  Mon Sep 27 14:50:41 1999
From: teroc@zianet.com (K P)
Date: Mon, 27 Sep 1999 08:50:41 -0500
Subject: [Tutor] Identifying objects
Message-ID: <13452518721335@zianet.com>

How would I detect object recursing(that may not be the real term 
for it)? For example, I have:

class myObject():
   def myFunct(param)

tempObj = myObject()

tempObj.myFunct(tempObj)

How would tempObj.myFunct determine that its own object was 
passed to it?

Ken
Ken


From da@ski.org  Mon Sep 27 17:14:42 1999
From: da@ski.org (David Ascher)
Date: Mon, 27 Sep 1999 09:14:42 -0700 (Pacific Daylight Time)
Subject: [Tutor] Identifying objects
In-Reply-To: <13452518721335@zianet.com>
Message-ID: <Pine.WNT.4.04.9909270914140.200-100000@rigoletto.ski.org>

On Mon, 27 Sep 1999, K P wrote:

> How would I detect object recursing(that may not be the real term 
> for it)? For example, I have:
> 
> class myObject():
>    def myFunct(param)
> 
> tempObj = myObject()
> 
> tempObj.myFunct(tempObj)
> 
> How would tempObj.myFunct determine that its own object was 
> passed to it?

if param is self:
  ...

Note that 'is' tests reference identity, while == tests value equality.

--david



From Moshe Zadka <mzadka@geocities.com>  Mon Sep 27 17:50:33 1999
From: Moshe Zadka <mzadka@geocities.com> (Moshe Zadka)
Date: Mon, 27 Sep 1999 18:50:33 +0200 (IST)
Subject: [Tutor] Identifying objects
In-Reply-To: <13452518721335@zianet.com>
Message-ID: <Pine.SOL.3.96.990927183943.4492A-100000@sundial>

On Mon, 27 Sep 1999, K P wrote:

> How would I detect object recursing(that may not be the real term 
> for it)? For example, I have:
> 
> class myObject():
>    def myFunct(param)
> 
> tempObj = myObject()
> 
> tempObj.myFunct(tempObj)
> 
> How would tempObj.myFunct determine that its own object was 
> passed to it?

There is an easy way, but I won't tell it to you, for fear you'll use it.
Instead, try to fine a design which does not rely on RTTI, but on
functionality. E.g., try to call appropriate methods in the object.
--
Moshe Zadka <mzadka@geocities.com>. 
INTERNET: Learn what you know.
Share what you don't.



From ed_tsang@yahoo.com  Mon Sep 27 19:11:32 1999
From: ed_tsang@yahoo.com (ET)
Date: Mon, 27 Sep 1999 11:11:32 -0700 (PDT)
Subject: [Tutor] installation of ExpectPy
Message-ID: <19990927181132.16095.rocketmail@web207.mail.yahoo.com>

During the installation of ExpectPy I used this:

./configure --with-python=../Python-1.5.2
--with-expect=/tools/2.5.1/local/lib

but his is what I get when it says cannot compile with
the pythonlibrary.....
any heads up? Is there something I need to dwobload
before this?? I have got the 
python from www.python.org. The final release one...

This is the message displayed on teh screen:
loading cache ./config.cachechecking host system
type... sparc-sun-solaris2.7
checking for gcc... gccchecking whether the C compiler
(gcc  ) works... yes
checking whether the C compiler (gcc  ) is a
cross-compiler... no
checking whether we are using GNU C... yeschecking
whether gcc accepts -g... yes
checking whether gcc and cc understand -c and -o
together... yes
checking how to run the C preprocessor... gcc
-Echecking for AIX... no
checking for a BSD compatible install...
/tools/2.5.1/local/bin/install-c
checking for ranlib... ranlibchecking whether ln -s
works... yes
checking for rm... /bin/rmchecking for python...
/tools/2.5.1/local/bin/python
checking for expect...
/tools/2.5.1/local/bin/expectchecking SO... .so
checking LDSHARED... $(LD) -Gchecking LDEXE...
$(LD)checking CCSHARED... 
checking Python version... 1.5checking Expect
version... 5.26
checking Expect library location... -lexpect5.26
checking Tcl version (for testing)... checking use of
Python Setup... no
checking for openpty... nochecking for openpty in
-lutil... no
checking for cos in -lm... yeschecking for dlopen in
-ldl... yes
checking for pthread_create in -lpthread... yes
checking for exp_expectv in -lexpect5.26... no
checking for exp_expectv in -lexpect5.26... yes
checking for PyObject_GetAttr in -lpython1.5... no
checking for PyObject_GetAttr in -lpython1.5...
(cached) no
configure: error: Cannot compile with the Python
library


__________________________________________________
Do You Yahoo!?
Bid and sell for free at http://auctions.yahoo.com


From ed_tsang@yahoo.com  Tue Sep 28 19:25:07 1999
From: ed_tsang@yahoo.com (ET)
Date: Tue, 28 Sep 1999 11:25:07 -0700 (PDT)
Subject: [Tutor] ExpectPy Installation problem --- attached config.log
Message-ID: <19990928182507.23170.rocketmail@web216.mail.yahoo.com>

./configure
--with-python=/s1/sqa/edwardt/Python/Python-1.5.2--with-expect=/tools/2.5.1/local/lib
but this is what I get when it says cannot compile
with the python library.....
Any heads up? Is there something I need to dwobload
before this?? I have got the 
python from www.python.org. The final release one...
but for some reason, it is still trying to look for
the network installed Python!!!!
Attached below is the config.log: 
Please help experts!!!
This file contains any messages produced by compilers
while
running configure, to aid debugging if configure makes
a mistake.

configure:568: checking host system type
configure:659: checking for gcc
configure:736: checking whether the C compiler (gcc  )
works
configure:750: gcc -o conftest    conftest.c  1>&5
configure:770: checking whether the C compiler (gcc  )
is a cross-compiler
configure:775: checking whether we are using GNU C
configure:784: gcc -E conftest.c
configure:799: checking whether gcc accepts -g
configure:828: checking whether gcc and cc understand
-c and -o together
configure:843: gcc -c conftest.c -o conftest.o 1>&5
configure:844: gcc -c conftest.c -o conftest.o 1>&5
configure:849: cc -c conftest.c 1>&5
configure:851: cc -c conftest.c -o conftest.o 1>&5
configure:852: cc -c conftest.c -o conftest.o 1>&5
configure:879: checking how to run the C preprocessor
configure:900: gcc -E  conftest.c >/dev/null
2>conftest.out
configure:940: checking for AIX
configure:974: checking for a BSD compatible install
configure:1026: checking for ranlib
configure:1053: checking whether ln -s works
configure:1076: checking for rm
configure:1116: checking for python
configure:1155: checking for expect
configure:1202: checking SO
configure:1224: checking LDSHARED
configure:1256: checking LDEXE
configure:1279: checking CCSHARED
configure:1341: checking Python version
configure:1370: checking Expect version
configure:1390: checking Expect library location
configure:1435: checking Tcl version (for testing)
configure:1473: checking use of Python Setup
configure:1548: checking for openpty
configure:1576: gcc -o conftest -g -O2 
-I/s1/sqa/edwardt/Python/Python-1.5.2/Include
-I/tools/2.5.1/local/lib  
-L/s1/sqa/edwardt/Python/Python-1.5.2
-L/tools/2.5.1/local/lib  conftest.c  1>&5
/var/tmp/ccafaaHJ1.o: In function `main':
/s1/sqa/edwardt/Python/ExpectPy-1.8/configure:1570:
undefined reference to 
`openpty'
configure: failed program was:
#line 1553 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully
few prototypes,
    which can conflict with char openpty(); below.  */
#include <assert.h>
/* Override any gcc2 internal prototype to avoid an
error.  */
/* We use char because int might match the return type
of a gcc2
    builtin and then its argument prototype would
still apply.  */
char openpty();

int main() {

/* The GNU C library defines this for functions which
it implements
    to always fail with ENOSYS.  Some functions are
actually named
    something starting with __ and the normal name is
an alias.  */
#if defined (__stub_openpty) || defined
(__stub___openpty)
choke me
#else
openpty();
#endif

; return 0; }
configure:1598: checking for openpty in -lutil
configure:1617: gcc -o conftest -g -O2 
-I/s1/sqa/edwardt/Python/Python-1.5.2/Include
-I/tools/2.5.1/local/lib  
-L/s1/sqa/edwardt/Python/Python-1.5.2
-L/tools/2.5.1/local/lib  conftest.c 
-lutil   1>&5
/tools/2.5.1/local/sparc-sun-solaris2.5.1/bin/ld:
cannot open -lutil: No such 
file or directory
configure: failed program was:
#line 1606 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an
error.  */
/* We use char because int might match the return type
of a gcc2
    builtin and then its argument prototype would
still apply.  */
char openpty();

int main() {
openpty()
; return 0; }
configure:1646: checking for cos in -lm
configure:1665: gcc -o conftest -g -O2 
-I/s1/sqa/edwardt/Python/Python-1.5.2/Include
-I/tools/2.5.1/local/lib  
-L/s1/sqa/edwardt/Python/Python-1.5.2
-L/tools/2.5.1/local/lib  conftest.c -lm   
1>&5
configure:1658: warning: conflicting types for
built-in function `cos'
configure:1693: checking for dlopen in -ldl
configure:1712: gcc -o conftest -g -O2 
-I/s1/sqa/edwardt/Python/Python-1.5.2/Include
-I/tools/2.5.1/local/lib  
-L/s1/sqa/edwardt/Python/Python-1.5.2
-L/tools/2.5.1/local/lib  conftest.c -ldl  
-lm  1>&5
configure:1741: checking for pthread_create in
-lpthread
configure:1760: gcc -o conftest -g -O2 
-I/s1/sqa/edwardt/Python/Python-1.5.2/Include
-I/tools/2.5.1/local/lib  
-L/s1/sqa/edwardt/Python/Python-1.5.2
-L/tools/2.5.1/local/lib  conftest.c 
-lpthread  -ldl -lm  1>&5
configure:1877: checking for exp_expectv in
-lexpect5.26
configure:1896: gcc -o conftest -g -O2 
-I/s1/sqa/edwardt/Python/Python-1.5.2/Include
-I/tools/2.5.1/local/lib  
-L/s1/sqa/edwardt/Python/Python-1.5.2
-L/tools/2.5.1/local/lib  conftest.c 
-lexpect5.26  -ldl -lm  1>&5
/tools/2.5.1/local/lib/libexpect5.26.a(exp_clib.o): In
function `exp_spawnv':
/net/wrk/expect-5.26/exp_clib.c:282: undefined
reference to `Tcl_ErrnoMsg'
/net/wrk/expect-5.26/exp_clib.c:296: undefined
reference to `Tcl_ErrnoMsg'
/net/wrk/expect-5.26/exp_clib.c:369: undefined
reference to `Tcl_ErrnoMsg'
/net/wrk/expect-5.26/exp_clib.c:497: undefined
reference to `Tcl_ErrnoMsg'
/net/wrk/expect-5.26/exp_clib.c:509: undefined
reference to `Tcl_ErrnoMsg'
/tools/2.5.1/local/lib/libexpect5.26.a(exp_clib.o):/net/wrk/expect-5.26/exp_clib
.c:532: more undefined references to `Tcl_ErrnoMsg'
follow
/tools/2.5.1/local/lib/libexpect5.26.a(exp_clib.o): In
function `expectv':
/net/wrk/expect-5.26/exp_clib.c:771: undefined
reference to `TclRegError'
/net/wrk/expect-5.26/exp_clib.c:772: undefined
reference to `TclRegComp'
/net/wrk/expect-5.26/exp_clib.c:773: undefined
reference to `TclGetRegError'
/net/wrk/expect-5.26/exp_clib.c:947: undefined
reference to `TclRegError'
/net/wrk/expect-5.26/exp_clib.c:948: undefined
reference to `TclRegExec'
/net/wrk/expect-5.26/exp_clib.c:952: undefined
reference to `TclGetRegError'
/net/wrk/expect-5.26/exp_clib.c:953: undefined
reference to `TclGetRegError'
/tools/2.5.1/local/lib/libexpect5.26.a(pty_termios.o):
In function 
`exp_getptyslave':
/net/wrk/expect-5.26/pty_termios.c:623: undefined
reference to `Tcl_ErrnoMsg'
/net/wrk/expect-5.26/pty_termios.c:626: undefined
reference to `Tcl_ErrnoMsg'
/net/wrk/expect-5.26/pty_termios.c:629: undefined
reference to `Tcl_ErrnoMsg'
configure: failed program was:
#line 1885 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an
error.  */
/* We use char because int might match the return type
of a gcc2
    builtin and then its argument prototype would
still apply.  */
char exp_expectv();

int main() {
exp_expectv()
; return 0; }
configure:1920: checking for exp_expectv in
-lexpect5.26
configure:1939: gcc -o conftest -g -O2 
-I/s1/sqa/edwardt/Python/Python-1.5.2/Include
-I/tools/2.5.1/local/lib  
-L/s1/sqa/edwardt/Python/Python-1.5.2
-L/tools/2.5.1/local/lib  conftest.c 
-lexpect5.26 -ltcl -ldl -lm  1>&5
configure:2024: checking for PyObject_GetAttr in
-lpython1.5
configure:2043: gcc -o conftest -g -O2 
-I/s1/sqa/edwardt/Python/Python-1.5.2/Include
-I/tools/2.5.1/local/lib  
-L/s1/sqa/edwardt/Python/Python-1.5.2
-L/tools/2.5.1/local/lib  conftest.c 
-lpython1.5  -ldl -lm  1>&5
/s1/sqa/edwardt/Python/Python-1.5.2/libpython1.5.a(socketmodule.o):
In function 
`setipaddr':
/s1/sqa/poonam/python/Python-1.5.2/Modules/./socketmodule.c:404:
undefined 
reference to `gethostbyname'
/s1/sqa/edwardt/Python/Python-1.5.2/libpython1.5.a(socketmodule.o):
In function 
`PySocketSock_accept':
/s1/sqa/poonam/python/Python-1.5.2/Modules/./socketmodule.c:612:
undefined 
reference to `accept'
/s1/sqa/edwardt/Python/Python-1.5.2/libpython1.5.a(socketmodule.o):
In function 
`PySocketSock_setsockopt':
/s1/sqa/poonam/python/Python-1.5.2/Modules/./socketmodule.c:719:
undefined 
reference to `setsockopt'
/s1/sqa/edwardt/Python/Python-1.5.2/libpython1.5.a(socketmodule.o):
In function 
`PySocketSock_getsockopt':
/s1/sqa/poonam/python/Python-1.5.2/Modules/./socketmodule.c:759:
undefined 
reference to `getsockopt'
/s1/sqa/poonam/python/Python-1.5.2/Modules/./socketmodule.c:773:
undefined 
reference to `getsockopt'
/s1/sqa/edwardt/Python/Python-1.5.2/libpython1.5.a(socketmodule.o):
In function 
`PySocketSock_bind':
/s1/sqa/poonam/python/Python-1.5.2/Modules/./socketmodule.c:803:
undefined 
reference to `bind'
/s1/sqa/edwardt/Python/Python-1.5.2/libpython1.5.a(socketmodule.o):
In function 
`PySocketSock_connect':
/s1/sqa/poonam/python/Python-1.5.2/Modules/./socketmodule.c:854:
undefined 
reference to `connect'
/s1/sqa/edwardt/Python/Python-1.5.2/libpython1.5.a(socketmodule.o):
In function 
`PySocketSock_connect_ex':
/s1/sqa/poonam/python/Python-1.5.2/Modules/./socketmodule.c:880:
undefined 
reference to `connect'
/s1/sqa/edwardt/Python/Python-1.5.2/libpython1.5.a(socketmodule.o):
In function 
`PySocketSock_getsockname':
/s1/sqa/poonam/python/Python-1.5.2/Modules/./socketmodule.c:953:
undefined 
reference to `getsockname'
/s1/sqa/edwardt/Python/Python-1.5.2/libpython1.5.a(socketmodule.o):
In function 
`PySocketSock_getpeername':
/s1/sqa/poonam/python/Python-1.5.2/Modules/./socketmodule.c:980:
undefined 
reference to `getpeername'
/s1/sqa/edwardt/Python/Python-1.5.2/libpython1.5.a(socketmodule.o):
In function 
`PySocketSock_listen':
/s1/sqa/poonam/python/Python-1.5.2/Modules/./socketmodule.c:1008:
undefined 
reference to `listen'
/s1/sqa/edwardt/Python/Python-1.5.2/libpython1.5.a(socketmodule.o):
In function 
`PySocketSock_recv':
/s1/sqa/poonam/python/Python-1.5.2/Modules/./socketmodule.c:1083:
undefined 
reference to `recv'
/s1/sqa/edwardt/Python/Python-1.5.2/libpython1.5.a(socketmodule.o):
In function 
`PySocketSock_recvfrom':
/s1/sqa/poonam/python/Python-1.5.2/Modules/./socketmodule.c:1122:
undefined 
reference to `recvfrom'
/s1/sqa/edwardt/Python/Python-1.5.2/libpython1.5.a(socketmodule.o):
In function 
`PySocketSock_send':
/s1/sqa/poonam/python/Python-1.5.2/Modules/./socketmodule.c:1167:
undefined 
reference to `send'
/s1/sqa/edwardt/Python/Python-1.5.2/libpython1.5.a(socketmodule.o):
In function 
`PySocketSock_sendto':
/s1/sqa/poonam/python/Python-1.5.2/Modules/./socketmodule.c:1199:
undefined 
reference to `sendto'
/s1/sqa/edwardt/Python/Python-1.5.2/libpython1.5.a(socketmodule.o):
In function 
`PySocketSock_shutdown':
/s1/sqa/poonam/python/Python-1.5.2/Modules/./socketmodule.c:1223:
undefined 
reference to `shutdown'
/s1/sqa/edwardt/Python/Python-1.5.2/libpython1.5.a(socketmodule.o):
In function 
`PySocket_gethostbyname_ex':
/s1/sqa/poonam/python/Python-1.5.2/Modules/./socketmodule.c:1483:
undefined 
reference to `gethostbyname'
/s1/sqa/edwardt/Python/Python-1.5.2/libpython1.5.a(socketmodule.o):
In function 
`PySocket_gethostbyaddr':
/s1/sqa/poonam/python/Python-1.5.2/Modules/./socketmodule.c:1551:
undefined 
reference to `gethostbyaddr'
/s1/sqa/edwardt/Python/Python-1.5.2/libpython1.5.a(socketmodule.o):
In function 
`PySocket_getservbyname':
/s1/sqa/poonam/python/Python-1.5.2/Modules/./socketmodule.c:1583:
undefined 
reference to `getservbyname'
/s1/sqa/edwardt/Python/Python-1.5.2/libpython1.5.a(socketmodule.o):
In function 
`PySocket_getprotobyname':
/s1/sqa/poonam/python/Python-1.5.2/Modules/./socketmodule.c:1617:
undefined 
reference to `getprotobyname'
/s1/sqa/edwardt/Python/Python-1.5.2/libpython1.5.a(socketmodule.o):
In function 
`PySocket_socket':
/s1/sqa/poonam/python/Python-1.5.2/Modules/./socketmodule.c:1651:
undefined 
reference to `socket'
configure: failed program was:
#line 2032 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an
error.  */
/* We use char because int might match the return type
of a gcc2
    builtin and then its argument prototype would
still apply.  */
char PyObject_GetAttr();

int main() {
PyObject_GetAttr()
; return 0; }
configure:2066: checking for PyObject_GetAttr in
-lpython1.5

__________________________________________________
Do You Yahoo!?
Bid and sell for free at http://auctions.yahoo.com


From ed_tsang@yahoo.com  Tue Sep 28 19:28:16 1999
From: ed_tsang@yahoo.com (ET)
Date: Tue, 28 Sep 1999 11:28:16 -0700 (PDT)
Subject: [Tutor] ExpectPy Installation problem --- problem restated.
Message-ID: <19990928182816.4618.rocketmail@web218.mail.yahoo.com>

I used this during installation of ExpectPy:
./configure
--with-python=/s1/sqa/edwardt/Python/Python-1.5.2--with-expect=/tools/2.5.1/local/lib

But it says cannot compile with the python
library.....
Any heads up? Is there something I need to download
before this?? I have got the 
python from www.python.org. The final release one...
But for some reason, the installation program is 
still trying to look for the network installed
Python!!!!

Attached below is the config.log: 
Please help experts!!!
This file contains any messages produced by compilers
while
running configure, to aid debugging if configure makes
a mistake.

configure:568: checking host system type
configure:659: checking for gcc
configure:736: checking whether the C compiler (gcc  )
works
configure:750: gcc -o conftest    conftest.c  1>&5
configure:770: checking whether the C compiler (gcc  )
is a cross-compiler
configure:775: checking whether we are using GNU C
configure:784: gcc -E conftest.c
configure:799: checking whether gcc accepts -g
configure:828: checking whether gcc and cc understand
-c and -o together
configure:843: gcc -c conftest.c -o conftest.o 1>&5
configure:844: gcc -c conftest.c -o conftest.o 1>&5
configure:849: cc -c conftest.c 1>&5
configure:851: cc -c conftest.c -o conftest.o 1>&5
configure:852: cc -c conftest.c -o conftest.o 1>&5
configure:879: checking how to run the C preprocessor
configure:900: gcc -E  conftest.c >/dev/null
2>conftest.out
configure:940: checking for AIX
configure:974: checking for a BSD compatible install
configure:1026: checking for ranlib
configure:1053: checking whether ln -s works
configure:1076: checking for rm
configure:1116: checking for python
configure:1155: checking for expect
configure:1202: checking SO
configure:1224: checking LDSHARED
configure:1256: checking LDEXE
configure:1279: checking CCSHARED
configure:1341: checking Python version
configure:1370: checking Expect version
configure:1390: checking Expect library location
configure:1435: checking Tcl version (for testing)
configure:1473: checking use of Python Setup
configure:1548: checking for openpty
configure:1576: gcc -o conftest -g -O2 
-I/s1/sqa/edwardt/Python/Python-1.5.2/Include
-I/tools/2.5.1/local/lib  
-L/s1/sqa/edwardt/Python/Python-1.5.2
-L/tools/2.5.1/local/lib  conftest.c  1>&5
/var/tmp/ccafaaHJ1.o: In function `main':
/s1/sqa/edwardt/Python/ExpectPy-1.8/configure:1570:
undefined reference to 
`openpty'
configure: failed program was:
#line 1553 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully
few prototypes,
    which can conflict with char openpty(); below.  */
#include <assert.h>
/* Override any gcc2 internal prototype to avoid an
error.  */
/* We use char because int might match the return type
of a gcc2
    builtin and then its argument prototype would
still apply.  */
char openpty();

int main() {

/* The GNU C library defines this for functions which
it implements
    to always fail with ENOSYS.  Some functions are
actually named
    something starting with __ and the normal name is
an alias.  */
#if defined (__stub_openpty) || defined
(__stub___openpty)
choke me
#else
openpty();
#endif

; return 0; }
configure:1598: checking for openpty in -lutil
configure:1617: gcc -o conftest -g -O2 
-I/s1/sqa/edwardt/Python/Python-1.5.2/Include
-I/tools/2.5.1/local/lib  
-L/s1/sqa/edwardt/Python/Python-1.5.2
-L/tools/2.5.1/local/lib  conftest.c 
-lutil   1>&5
/tools/2.5.1/local/sparc-sun-solaris2.5.1/bin/ld:
cannot open -lutil: No such 
file or directory
configure: failed program was:
#line 1606 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an
error.  */
/* We use char because int might match the return type
of a gcc2
    builtin and then its argument prototype would
still apply.  */
char openpty();

int main() {
openpty()
; return 0; }
configure:1646: checking for cos in -lm
configure:1665: gcc -o conftest -g -O2 
-I/s1/sqa/edwardt/Python/Python-1.5.2/Include
-I/tools/2.5.1/local/lib  
-L/s1/sqa/edwardt/Python/Python-1.5.2
-L/tools/2.5.1/local/lib  conftest.c -lm   
1>&5
configure:1658: warning: conflicting types for
built-in function `cos'
configure:1693: checking for dlopen in -ldl
configure:1712: gcc -o conftest -g -O2 
-I/s1/sqa/edwardt/Python/Python-1.5.2/Include
-I/tools/2.5.1/local/lib  
-L/s1/sqa/edwardt/Python/Python-1.5.2
-L/tools/2.5.1/local/lib  conftest.c -ldl  
-lm  1>&5
configure:1741: checking for pthread_create in
-lpthread
configure:1760: gcc -o conftest -g -O2 
-I/s1/sqa/edwardt/Python/Python-1.5.2/Include
-I/tools/2.5.1/local/lib  
-L/s1/sqa/edwardt/Python/Python-1.5.2
-L/tools/2.5.1/local/lib  conftest.c 
-lpthread  -ldl -lm  1>&5
configure:1877: checking for exp_expectv in
-lexpect5.26
configure:1896: gcc -o conftest -g -O2 
-I/s1/sqa/edwardt/Python/Python-1.5.2/Include
-I/tools/2.5.1/local/lib  
-L/s1/sqa/edwardt/Python/Python-1.5.2
-L/tools/2.5.1/local/lib  conftest.c 
-lexpect5.26  -ldl -lm  1>&5
/tools/2.5.1/local/lib/libexpect5.26.a(exp_clib.o): In
function `exp_spawnv':
/net/wrk/expect-5.26/exp_clib.c:282: undefined
reference to `Tcl_ErrnoMsg'
/net/wrk/expect-5.26/exp_clib.c:296: undefined
reference to `Tcl_ErrnoMsg'
/net/wrk/expect-5.26/exp_clib.c:369: undefined
reference to `Tcl_ErrnoMsg'
/net/wrk/expect-5.26/exp_clib.c:497: undefined
reference to `Tcl_ErrnoMsg'
/net/wrk/expect-5.26/exp_clib.c:509: undefined
reference to `Tcl_ErrnoMsg'
/tools/2.5.1/local/lib/libexpect5.26.a(exp_clib.o):/net/wrk/expect-5.26/exp_clib
.c:532: more undefined references to `Tcl_ErrnoMsg'
follow
/tools/2.5.1/local/lib/libexpect5.26.a(exp_clib.o): In
function `expectv':
/net/wrk/expect-5.26/exp_clib.c:771: undefined
reference to `TclRegError'
/net/wrk/expect-5.26/exp_clib.c:772: undefined
reference to `TclRegComp'
/net/wrk/expect-5.26/exp_clib.c:773: undefined
reference to `TclGetRegError'
/net/wrk/expect-5.26/exp_clib.c:947: undefined
reference to `TclRegError'
/net/wrk/expect-5.26/exp_clib.c:948: undefined
reference to `TclRegExec'
/net/wrk/expect-5.26/exp_clib.c:952: undefined
reference to `TclGetRegError'
/net/wrk/expect-5.26/exp_clib.c:953: undefined
reference to `TclGetRegError'
/tools/2.5.1/local/lib/libexpect5.26.a(pty_termios.o):
In function 
`exp_getptyslave':
/net/wrk/expect-5.26/pty_termios.c:623: undefined
reference to `Tcl_ErrnoMsg'
/net/wrk/expect-5.26/pty_termios.c:626: undefined
reference to `Tcl_ErrnoMsg'
/net/wrk/expect-5.26/pty_termios.c:629: undefined
reference to `Tcl_ErrnoMsg'
configure: failed program was:
#line 1885 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an
error.  */
/* We use char because int might match the return type
of a gcc2
    builtin and then its argument prototype would
still apply.  */
char exp_expectv();

int main() {
exp_expectv()
; return 0; }
configure:1920: checking for exp_expectv in
-lexpect5.26
configure:1939: gcc -o conftest -g -O2 
-I/s1/sqa/edwardt/Python/Python-1.5.2/Include
-I/tools/2.5.1/local/lib  
-L/s1/sqa/edwardt/Python/Python-1.5.2
-L/tools/2.5.1/local/lib  conftest.c 
-lexpect5.26 -ltcl -ldl -lm  1>&5
configure:2024: checking for PyObject_GetAttr in
-lpython1.5
configure:2043: gcc -o conftest -g -O2 
-I/s1/sqa/edwardt/Python/Python-1.5.2/Include
-I/tools/2.5.1/local/lib  
-L/s1/sqa/edwardt/Python/Python-1.5.2
-L/tools/2.5.1/local/lib  conftest.c 
-lpython1.5  -ldl -lm  1>&5
/s1/sqa/edwardt/Python/Python-1.5.2/libpython1.5.a(socketmodule.o):
In function 
`setipaddr':
/s1/sqa/poonam/python/Python-1.5.2/Modules/./socketmodule.c:404:
undefined 
reference to `gethostbyname'
/s1/sqa/edwardt/Python/Python-1.5.2/libpython1.5.a(socketmodule.o):
In function 
`PySocketSock_accept':
/s1/sqa/poonam/python/Python-1.5.2/Modules/./socketmodule.c:612:
undefined 
reference to `accept'
/s1/sqa/edwardt/Python/Python-1.5.2/libpython1.5.a(socketmodule.o):
In function 
`PySocketSock_setsockopt':
/s1/sqa/poonam/python/Python-1.5.2/Modules/./socketmodule.c:719:
undefined 
reference to `setsockopt'
/s1/sqa/edwardt/Python/Python-1.5.2/libpython1.5.a(socketmodule.o):
In function 
`PySocketSock_getsockopt':
/s1/sqa/poonam/python/Python-1.5.2/Modules/./socketmodule.c:759:
undefined 
reference to `getsockopt'
/s1/sqa/poonam/python/Python-1.5.2/Modules/./socketmodule.c:773:
undefined 
reference to `getsockopt'
/s1/sqa/edwardt/Python/Python-1.5.2/libpython1.5.a(socketmodule.o):
In function 
`PySocketSock_bind':
/s1/sqa/poonam/python/Python-1.5.2/Modules/./socketmodule.c:803:
undefined 
reference to `bind'
/s1/sqa/edwardt/Python/Python-1.5.2/libpython1.5.a(socketmodule.o):
In function 
`PySocketSock_connect':
/s1/sqa/poonam/python/Python-1.5.2/Modules/./socketmodule.c:854:
undefined 
reference to `connect'
/s1/sqa/edwardt/Python/Python-1.5.2/libpython1.5.a(socketmodule.o):
In function 
`PySocketSock_connect_ex':
/s1/sqa/poonam/python/Python-1.5.2/Modules/./socketmodule.c:880:
undefined 
reference to `connect'
/s1/sqa/edwardt/Python/Python-1.5.2/libpython1.5.a(socketmodule.o):
In function 
`PySocketSock_getsockname':
/s1/sqa/poonam/python/Python-1.5.2/Modules/./socketmodule.c:953:
undefined 
reference to `getsockname'
/s1/sqa/edwardt/Python/Python-1.5.2/libpython1.5.a(socketmodule.o):
In function 
`PySocketSock_getpeername':
/s1/sqa/poonam/python/Python-1.5.2/Modules/./socketmodule.c:980:
undefined 
reference to `getpeername'
/s1/sqa/edwardt/Python/Python-1.5.2/libpython1.5.a(socketmodule.o):
In function 
`PySocketSock_listen':
/s1/sqa/poonam/python/Python-1.5.2/Modules/./socketmodule.c:1008:
undefined 
reference to `listen'
/s1/sqa/edwardt/Python/Python-1.5.2/libpython1.5.a(socketmodule.o):
In function 
`PySocketSock_recv':
/s1/sqa/poonam/python/Python-1.5.2/Modules/./socketmodule.c:1083:
undefined 
reference to `recv'
/s1/sqa/edwardt/Python/Python-1.5.2/libpython1.5.a(socketmodule.o):
In function 
`PySocketSock_recvfrom':
/s1/sqa/poonam/python/Python-1.5.2/Modules/./socketmodule.c:1122:
undefined 
reference to `recvfrom'
/s1/sqa/edwardt/Python/Python-1.5.2/libpython1.5.a(socketmodule.o):
In function 
`PySocketSock_send':
/s1/sqa/poonam/python/Python-1.5.2/Modules/./socketmodule.c:1167:
undefined 
reference to `send'
/s1/sqa/edwardt/Python/Python-1.5.2/libpython1.5.a(socketmodule.o):
In function 
`PySocketSock_sendto':
/s1/sqa/poonam/python/Python-1.5.2/Modules/./socketmodule.c:1199:
undefined 
reference to `sendto'
/s1/sqa/edwardt/Python/Python-1.5.2/libpython1.5.a(socketmodule.o):
In function 
`PySocketSock_shutdown':
/s1/sqa/poonam/python/Python-1.5.2/Modules/./socketmodule.c:1223:
undefined 
reference to `shutdown'
/s1/sqa/edwardt/Python/Python-1.5.2/libpython1.5.a(socketmodule.o):
In function 
`PySocket_gethostbyname_ex':
/s1/sqa/poonam/python/Python-1.5.2/Modules/./socketmodule.c:1483:
undefined 
reference to `gethostbyname'
/s1/sqa/edwardt/Python/Python-1.5.2/libpython1.5.a(socketmodule.o):
In function 
`PySocket_gethostbyaddr':
/s1/sqa/poonam/python/Python-1.5.2/Modules/./socketmodule.c:1551:
undefined 
reference to `gethostbyaddr'
/s1/sqa/edwardt/Python/Python-1.5.2/libpython1.5.a(socketmodule.o):
In function 
`PySocket_getservbyname':
/s1/sqa/poonam/python/Python-1.5.2/Modules/./socketmodule.c:1583:
undefined 
reference to `getservbyname'
/s1/sqa/edwardt/Python/Python-1.5.2/libpython1.5.a(socketmodule.o):
In function 
`PySocket_getprotobyname':
/s1/sqa/poonam/python/Python-1.5.2/Modules/./socketmodule.c:1617:
undefined 
reference to `getprotobyname'
/s1/sqa/edwardt/Python/Python-1.5.2/libpython1.5.a(socketmodule.o):
In function 
`PySocket_socket':
/s1/sqa/poonam/python/Python-1.5.2/Modules/./socketmodule.c:1651:
undefined 
reference to `socket'
configure: failed program was:
#line 2032 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an
error.  */
/* We use char because int might match the return type
of a gcc2
    builtin and then its argument prototype would
still apply.  */
char PyObject_GetAttr();

int main() {
PyObject_GetAttr()
; return 0; }
configure:2066: checking for PyObject_GetAttr in
-lpython1.5

__________________________________________________
Do You Yahoo!?
Bid and sell for free at http://auctions.yahoo.com


From Alexandre Passos" <atp@bahianet.com.br  Tue Sep 28 22:46:10 1999
From: Alexandre Passos" <atp@bahianet.com.br (Alexandre Passos)
Date: Tue, 28 Sep 1999 18:46:10 -0300
Subject: [Tutor] Loops
Message-ID: <002101bf09fb$45dcc200$615bdfc8@the-user>

This is a multi-part message in MIME format.

------=_NextPart_000_000E_01BF09E1.BB1B8DE0
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

I know vary well that python=B4s got for and while loops. I=B4d like to =
know if python=B4s got the following loops:
-Do-Until (until)
-Goto, jump
Mail soon the answers

------=_NextPart_000_000E_01BF09E1.BB1B8DE0
Content-Type: text/html;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD W3 HTML//EN">
<HTML>
<HEAD>

<META content=3Dtext/html;charset=3Diso-8859-1 =
http-equiv=3DContent-Type>
<META content=3D'"MSHTML 4.72.3110.7"' name=3DGENERATOR>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT color=3D#000000 size=3D2>I know vary well that python&acute;s =
got for and=20
while loops. I&acute;d like to know if python&acute;s got the following=20
loops:</FONT></DIV>
<DIV><FONT color=3D#000000 size=3D2>-Do-Until (until)</FONT></DIV>
<DIV><FONT color=3D#000000 size=3D2>-Goto, jump</FONT></DIV>
<DIV><FONT color=3D#000000 size=3D2>Mail soon the =
answers</FONT></DIV></BODY></HTML>

------=_NextPart_000_000E_01BF09E1.BB1B8DE0--



From deirdre@deirdre.net  Tue Sep 28 22:51:08 1999
From: deirdre@deirdre.net (Deirdre Saoirse)
Date: Tue, 28 Sep 1999 14:51:08 -0700 (PDT)
Subject: [Tutor] Loops
In-Reply-To: <002101bf09fb$45dcc200$615bdfc8@the-user>
Message-ID: <Pine.LNX.4.10.9909281444160.5209-100000@adelie.deirdre.org>

On Tue, 28 Sep 1999, Alexandre Passos wrote:

> I know vary well that python´s got for and while loops. I´d like to know if python´s got the following loops:
> -Do-Until (until)

There's no real need for a do-until with a while loop. It's a redundant
form.

> -Goto, jump

No, thank goodness. It's considered bad design. It was really only
necessary in languages that didn't have exceptions or subroutines. Since
python has both it's not.

for example:

try:
 one thing
 another thing
 a third thing
 a fourth thing
except:
 error handling

is the equivalent of:

 if (! one_thing())
  goto error;
 (several other similar statements)

error:
 (do error handling)

-- 
_Deirdre   *   http://www.linuxcabal.net   *   http://www.deirdre.net
"I must say that I was really happy to see _Linux for Dummies_ -- that's 
when you know you've arrived." -- Linus Torvalds



From joe@strout.net  Tue Sep 28 23:00:11 1999
From: joe@strout.net (Joseph J. Strout)
Date: Tue, 28 Sep 1999 15:00:11 -0700
Subject: [Tutor] Loops
In-Reply-To: <002101bf09fb$45dcc200$615bdfc8@the-user>
References: <002101bf09fb$45dcc200$615bdfc8@the-user>
Message-ID: <v04210105b416ea93f8d9@[198.202.70.213]>

At 6:46 PM -0300 09/28/99, Alexandre Passos wrote:

>I know vary well that python´s got for and while loops. I´d like to 
>know if python´s got the following loops:
>-Do-Until (until)

Nope.  Instead of...

do:
	foo(bar)
	until bar==42

(which isn't legal), try this...

while 1:
	foo(bar)
	if bar==42: break

>-Goto, jump

Goodness no!  These are Evil, and Python is Good.

Cheers,
-- Joe

,------------------------------------------------------------------.
|    Joseph J. Strout           Biocomputing -- The Salk Institute |
|    joe@strout.net             http://www.strout.net              |
`------------------------------------------------------------------'


From matt@stary.zoomedia.com  Wed Sep 29 20:26:57 1999
From: matt@stary.zoomedia.com (Matt Dunford)
Date: Wed, 29 Sep 1999 12:26:57 -0700 (PDT)
Subject: [Tutor] Loops
In-Reply-To: <002101bf09fb$45dcc200$615bdfc8@the-user>
Message-ID: <Pine.BSI.4.05L.9909291225360.23255-100000@stary.zoomedia.com>

On Tue, 28 Sep 1999, Alexandre Passos wrote:

> I know vary well that python´s got for and while loops. I´d like to know if python´s got the following loops:
> -Do-Until (until)

for a do-until loop, do something like this.

while 1:
  # do something
  if (until_var == what_it_should): break



From skip@mojam.com (Skip Montanaro)  Thu Sep 30 17:17:40 1999
From: skip@mojam.com (Skip Montanaro) (Skip Montanaro)
Date: Thu, 30 Sep 1999 11:17:40 -0500 (CDT)
Subject: [Tutor] Re: [Python-Help] ExpectPy Installation problem --- problem restated.
In-Reply-To: <19990928182816.4618.rocketmail@web218.mail.yahoo.com>
References: <19990928182816.4618.rocketmail@web218.mail.yahoo.com>
Message-ID: <14323.36132.852507.748722@dolphin.mojam.com>

>>>>> "ET" == ET  <ed_tsang@yahoo.com> writes:
    ...
    ET> function `exp_spawnv':
    ET> /net/wrk/expect-5.26/exp_clib.c:282: undefined
    ET> reference to `Tcl_ErrnoMsg'
    ET> /net/wrk/expect-5.26/exp_clib.c:296: undefined
    ET> reference to `Tcl_ErrnoMsg'
    ET> /net/wrk/expect-5.26/exp_clib.c:369: undefined
    ET> reference to `Tcl_ErrnoMsg'
    ET> /net/wrk/expect-5.26/exp_clib.c:497: undefined
    ET> reference to `Tcl_ErrnoMsg'
    ...

Looks like you're not telling configure that it should link with some Tcl
libraries.

    ...
    ET> In function 
    ET> `PySocketSock_send':
    ET> /s1/sqa/poonam/python/Python-1.5.2/Modules/./socketmodule.c:1167:
    ET> undefined 
    ET> reference to `send'
    ET> /s1/sqa/edwardt/Python/Python-1.5.2/libpython1.5.a(socketmodule.o):
    ET> In function 
    ET> `PySocketSock_sendto':
    ET> /s1/sqa/poonam/python/Python-1.5.2/Modules/./socketmodule.c:1199:
    ET> undefined 
    ET> reference to `sendto'
    ...

Here it looks like AIX puts the socket functions in a separate library.
Check around for something like libsocket.a or search the libraries in
/usr/lib for the symbols send and/or sendto:

    for f in /usr/lib/lib* ; do
	echo $f
	nm -a $f | egrep sendto
    done

Again, it would appear this library needs to be fed to configure.

Skip Montanaro | http://www.mojam.com/
skip@mojam.com | http://www.musi-cal.com/
847-971-7098   | Python: Programming the way Guido indented...


From teroc@zianet.com  Thu Sep 30 18:00:41 1999
From: teroc@zianet.com (K P)
Date: Thu, 30 Sep 1999 12:00:41 -0500
Subject: [Tutor] Ok, take one step back and let you look
Message-ID: <16554262512929@zianet.com>

--Message-Boundary-31826
Content-type: text/plain; charset=US-ASCII
Content-transfer-encoding: 7BIT
Content-description: Mail message body

Just a little frustrated here, because I can't seem to make the 
connection on this little project: a basic inventory tracking system. 
Maybe a little too much, but hey, it's rather fun. Here's my 
problem: how do I make x number of objects (that is x number of 
different object instances, not x number of the same object 
instance) appear once in the inventory, with x number of items? I 
can do it with a single instance, amke it appear multiple times, but 
when I try it with different instances (but the same 'variables'), I 
can't seem to code it.
	Please could someone give me a suggestion? Not a solution, 
please. maybe a hint on what I need to do. Please teach me, don't 
lead me.
	Anyway, included is a copy of my code so you can laugh. yes I 
probably mangled all the technical terms, oh well, someday I'll get 
the straight.

Ken

--Message-Boundary-31826
Content-type: text/plain; charset=US-ASCII
Content-disposition: inline
Content-description: Attachment information.

The following section of this message contains a file attachment
prepared for transmission using the Internet MIME message format.
If you are using Pegasus Mail, or any another MIME-compliant system,
you should be able to save it or view it from within your mailer.
If you cannot, please ask your system administrator for assistance.

   ---- File information -----------
     File:  inven.py
     Date:  30 Sep 1999, 11:59
     Size:  7100 bytes.
     Type:  Unknown

--Message-Boundary-31826
Content-type: Application/Octet-stream; name="inven.py"; type=Unknown
Content-disposition: attachment; filename="inven.py"
Content-transfer-encoding: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gcHJp
bnQgaXRlbS5uYW1lLCAid2FzIHJlbW92ZWQuIg0KICAgICAgICAgaWYgc2VsZi5xdHlzW2l0
ZW1dID09IDAgYW5kIHNlbGYud2VpZ2h0c1tpdGVtXSA9PSAwIGFuZCBzZWxmLmN1YmVzW2l0
ZW1dID09IDA6DQogICAgICAgICAgICBkZWwgc2VsZi5xdHlzW2l0ZW1dDQogICAgICAgICAg
ICBkZWwgc2VsZi53ZWlnaHRzW2l0ZW1dDQogICAgICAgICAgICBkZWwgc2VsZi5jdWJlc1tp
dGVtXQ0KICAgICAgZWxzZToNCiAgICAgICAgIHByaW50IGl0ZW0ubmFtZSwgImlzIG5vdCBp
biB0aGlzIGNvbnRhaW5lci4iDQogICBkZWYgc2hvdyhzZWxmKToNCiAgICAgIHByaW50ICJJ
dGVtXHRcdFx0VC5XZWlnaHRcdFQuVm9sdW1lIg0KICAgICAgZm9yIGl0ZW0gaW4gc2VsZi5x
dHlzLmtleXMoKToNCiAgICAgICAgIHByaW50ICIlcyglZClcdFslaS8laV1cdCVpXHQlaSIg
JSAoaXRlbS5uYW1lLCBzZWxmLnF0eXNbaXRlbV0sIGl0ZW0ud2VpZ2h0LCBpdGVtLnZvbHVt
ZSwgc2VsZi53ZWlnaHRzW2l0ZW1dLCBzZWxmLmN1YmVzW2l0ZW1dKQ0KICAgICAgcHJpbnQg
IlRvdGFsIFdlaWdodDogIiwgc2VsZi5jb250ZW50V2VpZ2h0LCAiXHRUb3RhbCBWb2x1bWU6
ICIsIHNlbGYuY29udGVudFZvbHVtZQ0KDQo=

--Message-Boundary-31826--


From joe@strout.net  Thu Sep 30 18:20:42 1999
From: joe@strout.net (Joseph J. Strout)
Date: Thu, 30 Sep 1999 10:20:42 -0700
Subject: [Tutor] Ok, take one step back and let you look
In-Reply-To: <16554262512929@zianet.com>
References: <16554262512929@zianet.com>
Message-ID: <v04210102b4194bfb19db@[198.202.70.213]>

At 12:00 PM -0500 09/30/99, K P wrote:

>problem: how do I make x number of objects (that is x number of
>different object instances, not x number of the same object
>instance) appear once in the inventory, with x number of items?

I don't quite understand your question -- and I confess I haven't 
looked at the code.  But there are lots of ways to create many 
objects:

	objects = []
	for i in range(x):
		objects.append(MyClass())

or, less clearly but more succinctly:

	objects = map(lambda i:MyClass(), range(x))

Hope this helps!
-- Joe

,------------------------------------------------------------------.
|    Joseph J. Strout           Biocomputing -- The Salk Institute |
|    joe@strout.net             http://www.strout.net              |
`------------------------------------------------------------------'


From warren@nightwares.com  Thu Sep 30 19:04:17 1999
From: warren@nightwares.com (Warren 'The Howdy Man' Ockrassa)
Date: Thu, 30 Sep 1999 13:04:17 -0500
Subject: [Tutor] Ok, take one step back and let you look
References: <16554262512929@zianet.com>
Message-ID: <37F3A621.A579C43@nightwares.com>

K P wrote:

> Anyway, included is a copy of my code so you can laugh.

You know, I'm on this list to learn python as well, but I'm not new to
lists in general, and I know that it is ALWAYS a violation of etiquette
to send attachments to listservs.

Please remember that in the future.

--WthmO


From arcege@shore.net  Thu Sep 30 20:40:03 1999
From: arcege@shore.net (Michael P. Reilly)
Date: Thu, 30 Sep 1999 15:40:03 -0400 (EDT)
Subject: [Tutor] Ok, take one step back and let you look
In-Reply-To: <16554262512929@zianet.com> from K P at "Sep 30, 99 12:00:41 pm"
Message-ID: <199909301940.PAA07497@northshore.shore.net>

> Just a little frustrated here, because I can't seem to make the 
> connection on this little project: a basic inventory tracking system. 
> Maybe a little too much, but hey, it's rather fun. Here's my 
> problem: how do I make x number of objects (that is x number of 
> different object instances, not x number of the same object 
> instance) appear once in the inventory, with x number of items? I 
> can do it with a single instance, amke it appear multiple times, but 
> when I try it with different instances (but the same 'variables'), I 
> can't seem to code it.
>   Please could someone give me a suggestion? Not a solution, 
> please. maybe a hint on what I need to do. Please teach me, don't 
> lead me.
>   Anyway, included is a copy of my code so you can laugh. yes I 
> probably mangled all the technical terms, oh well, someday I'll get 
> the straight.

It sounds like you want some form of "semaphore" when creating class
instances: a certain number of instances of that class can be
created, but beyond that the semaphore "blocks" (raises an exception
in this case).  Here is a mix-in you can look at and see how to work
into your code.

class InstanceLimiter:
  class InstanceLimiterError(Exception):
    pass
  _Instance_Limiter_count = 10
  def new_instance(self):
    klass = self.__class__
    if klass._Instance_Limiter_count > 0:
      klass._Instance_Limiter_count = klass._Instance_Limiter_count - 1
    else:
      raise self.InstanceLimiterError, \
          'too many instances of %s' % klass.__name__
  def remove_instance(self):
    klass = self.__class__
    klass._Instance_Limiter_count = klass._Instance_Limiter_count + 1

Then you can work it into a class like:

class Person(InstanceLimiter):
  """A person under population control."""
  _Instance_Limiter_count = 1000
  def __init__(self, name, location, birthdate):
    self.new_instance()
    ...
  def __del__(self):
    self.remove_instance()
    ...

Now only one thousand instances of Person can exist.

I'm not sure if this is what you want, if not maybe you can use the
techniques in other places.

  -Arcege


-- 
------------------------------------------------------------------------
| Michael P. Reilly, Release Engineer | Email: arcege@shore.net        |
| Salem, Mass. USA  01970             |                                |
------------------------------------------------------------------------


From teroc@zianet.com  Thu Sep 30 21:02:43 1999
From: teroc@zianet.com (K P)
Date: Thu, 30 Sep 1999 15:02:43 -0500
Subject: [Tutor] Ok, take one step back and let you look
In-Reply-To: <37F3A621.A579C43@nightwares.com>
Message-ID: <19574037535478@zianet.com>

Whoops, next time I'll stick it inline. Sorry about that.
Ken

On 30 Sep 99, at 13:04, Warren 'The Howdy Man' Ockras wrote:

> K P wrote:
> 
> > Anyway, included is a copy of my code so you can laugh.
> 
> You know, I'm on this list to learn python as well, but I'm not new to
> lists in general, and I know that it is ALWAYS a violation of etiquette
> to send attachments to listservs.
> 
> Please remember that in the future.
> 
> --WthmO
> 
> _______________________________________________
> Tutor maillist  -  Tutor@python.org
> http://www.python.org/mailman/listinfo/tutor




From teroc@zianet.com  Thu Sep 30 21:12:49 1999
From: teroc@zianet.com (K P)
Date: Thu, 30 Sep 1999 15:12:49 -0500
Subject: [Tutor] Ok, take one step back and let you look
In-Reply-To: <199909301940.PAA07497@northshore.shore.net>
References: <16554262512929@zianet.com> from K P at "Sep 30, 99 12:00:41 pm"
Message-ID: <20074596836699@zianet.com>

Hmmm, I can see the possiblities in other areas. Thanks for the 
'snippet'. Maybe a small example would refine what I am seeking:

Quick example: 3 books: red, blue, green. All instances of class 
Book. 3 glasses: yellow, purple, aqua, all instances of class 
Glassware. In my inventory, I would like them to appear thus:

Item          Qty
Book         3
Glass        3
Not like this, which is currently the case:

Item         Qty
Blue         1
Green       1
Red          1
yellow       1
purple       1
aqua         1

I'm not too concerned with having tons of instances of a particular 
class/object. Just how they would be tracked in the inventory, and 
also displayed(on screen). If I am still not being very clear with this, 
I shall try harder to clarify myself :)

Ken
[big snip]
> 
> It sounds like you want some form of "semaphore" when creating class
> instances: a certain number of instances of that class can be
> created, but beyond that the semaphore "blocks" (raises an exception
> in this case).  Here is a mix-in you can look at and see how to work
> into your code.
> 
> class InstanceLimiter:
>   class InstanceLimiterError(Exception):
>     pass
>   _Instance_Limiter_count = 10
>   def new_instance(self):
>     klass = self.__class__
>     if klass._Instance_Limiter_count > 0:
>       klass._Instance_Limiter_count = klass._Instance_Limiter_count - 1
>     else:
>       raise self.InstanceLimiterError, \
>           'too many instances of %s' % klass.__name__
>   def remove_instance(self):
>     klass = self.__class__
>     klass._Instance_Limiter_count = klass._Instance_Limiter_count + 1
> 
> Then you can work it into a class like:
> 
> class Person(InstanceLimiter):
>   """A person under population control."""
>   _Instance_Limiter_count = 1000
>   def __init__(self, name, location, birthdate):
>     self.new_instance()
>     ...
>   def __del__(self):
>     self.remove_instance()
>     ...
> 
> Now only one thousand instances of Person can exist.
> 
> I'm not sure if this is what you want, if not maybe you can use the
> techniques in other places.
> 
>   -Arcege
> 
> 
> -- 
> ------------------------------------------------------------------------
> | Michael P. Reilly, Release Engineer | Email: arcege@shore.net        |
> | Salem, Mass. USA  01970             |                                |
> ------------------------------------------------------------------------
> 
> _______________________________________________
> Tutor maillist  -  Tutor@python.org
> http://www.python.org/mailman/listinfo/tutor




From joe@strout.net  Thu Sep 30 21:31:15 1999
From: joe@strout.net (Joseph J. Strout)
Date: Thu, 30 Sep 1999 13:31:15 -0700
Subject: [Tutor] Ok, take one step back and let you look
In-Reply-To: <20074596836699@zianet.com>
References: <16554262512929@zianet.com> from K P at "Sep 30, 99 12:00:41
 pm" <20074596836699@zianet.com>
Message-ID: <v04210104b41978367f1e@[198.202.70.213]>

At 3:12 PM -0500 09/30/99, K P wrote:

>Quick example: 3 books: red, blue, green. All instances of class
>Book. 3 glasses: yellow, purple, aqua, all instances of class
>Glassware. In my inventory, I would like them to appear thus:
>
>Item          Qty
>Book         3
>Glass        3

So you just want to find and count the Book instances, say?  Followed 
by the Glassware instances?  Let's just do books first.  One way to 
do it is with a loop:

books = 0
for item in myInventory:
	if isInstance(item, Book): books = books+1

Or, you could do it using 'filter'...

bookList = filter(lambda i: isInstance(i, Book), myInventory)
qtyBooks = len(bookList)

The key trick here is the 'isInstance' built-in function.

HTH,
-- Joe

,------------------------------------------------------------------.
|    Joseph J. Strout           Biocomputing -- The Salk Institute |
|    joe@strout.net             http://www.strout.net              |
`------------------------------------------------------------------'


From arcege@shore.net  Thu Sep 30 21:44:06 1999
From: arcege@shore.net (Michael P. Reilly)
Date: Thu, 30 Sep 1999 16:44:06 -0400 (EDT)
Subject: [Tutor] Ok, take one step back and let you look
In-Reply-To: <20074596836699@zianet.com> from K P at "Sep 30, 99 03:12:49 pm"
Message-ID: <199909302044.QAA22017@northshore.shore.net>

> Hmmm, I can see the possiblities in other areas. Thanks for the 
> 'snippet'. Maybe a small example would refine what I am seeking:
> 
> Quick example: 3 books: red, blue, green. All instances of class 
> Book. 3 glasses: yellow, purple, aqua, all instances of class 
> Glassware. In my inventory, I would like them to appear thus:
> 
> Item          Qty
> Book         3
> Glass        3
> Not like this, which is currently the case:
> 
> Item         Qty
> Blue         1
> Green       1
> Red          1
> yellow       1
> purple       1
> aqua         1
> 
> I'm not too concerned with having tons of instances of a particular 
> class/object. Just how they would be tracked in the inventory, and 
> also displayed(on screen). If I am still not being very clear with this, 
> I shall try harder to clarify myself :)
> 
> Ken

I see, you just want to count the instances of classes within a
collection (rather than restricting creation).

This is a job for.... the vorpal bunny?  Nah, just maybe a dictionary. :)

>>> classify = {}
>>> for item in inventory:
...   key = item.__class__
...   if classify.has_key(key):
...     classify[key] = classify[key] + 1
...   else:
...     classify[key] = 1
...
>>> klasses = classify.keys()
>>> klasses.sort(lambda a, b: cmp(a.__name__, b.__name__)) # sort by name
>>> for klass in klasses:
...   print klass.__name__, classify[klass]
...
Book 3
Glass 3
>>>

This relies on the facts that just about any hashable object can be a
key to a dictionary, and keys in a dictionary are unique.  Then you
just need to count the number of unique classes in the inventory.  If
you wanted to base the "uniqueness" on something other than the class,
say some other property of each of the items, that can be done too.

  -Arcege