Sorry to do a thread takeover here, but I'm going to anyway :o)
I asked not too long ago but I don't think I got a reply, so I'll just try
again.
(FYI I'm using WinME, with Python 2.1)
I'm not familiar with popen, and I looked through the docs and couldn't find
anything, so I would like to know how this works...
With popen when you pipe to a program, it doesn't bring up the stdout - it
goes straight to the pipe. Is it possible for the output to be directed both
to the pipe and to stdout?
Let's say I have the following:
pipe = os.popen('python t','r')
print pipe.read()
############
t.py should look like:
while 1:
x=raw_input('')
print x
How can I get the above to come up as visible? With popen it seems to work
in the background.
Is it possible to also collect input from stdin as well as the pipe? Say if
I wanted to send a response to the raw_input bit through the pipe, or
through the actual stdin...
TIA,
Andrew Wilkins
From NHYTRO@compuserve.com Fri Jun 1 10:30:03 2001
From: NHYTRO@compuserve.com (Sharriff Aina)
Date: Fri, 1 Jun 2001 05:30:03 -0400
Subject: [Tutor] String puzzle...
Message-ID: <200106010531_MC3-D3E6-4CB4@compuserve.com>
Hi guys!
This tiny bug hast stopped me releasing my online HTML Page editor for
testing. I am retrieveng per python/CGI HTML code from a clients browser
and storing in a databse on a remote server. The same client can edit his=
and save hispages. To facilitate the bility to edit existing pages, I jus=
t
retrieve the content from the databse and present it in a content editor =
in
a browser client automatically.
THE BUG
----------------------
As long as the the HTML is written with out carriage returns from the use=
r,
everything is fine. The carriage return or "" tag is entered by the us=
er
from the browser by tapping the enter key. The editor on its part fails t=
o
display any text or HTML code that is not written in the same line, it
complains of an "Unterminated String" error.
I have stripped spaces, by database entry, and database access for writin=
g,
but the cgi always writes the TEXT/HTML in separte lines if he user has
inputted a carriage return in the entry/edit form.
THE QUESTION
-----------------------------
How do I strip a a carriage return? is it really a carriage return thats
tripping my code up?
Sorry for rambling, but the problem was too difficult to descibe in fewer=
sentences.
Best regards
Sharriff
From alan.gauld@bt.com Fri Jun 1 10:46:40 2001
From: alan.gauld@bt.com (alan.gauld@bt.com)
Date: Fri, 1 Jun 2001 10:46:40 +0100
Subject: [Tutor] starting tcl?
Message-ID: <5104D4DBC598D211B5FE0000F8FE7EB20751D7E9@mbtlipnt02.btlabs.bt.co.uk>
> I'm on windows 98 IE and have python 2.1
> On Alan Gaulds webpage lessons it says to type tclsh80
> at the dos prompt to start tcl.
Yes, unfortunately from Python 2.0(*) they stopped shipping
tcl with Python, they only include the DLLs needed to
run Tkinter. From the python users point of view thats
great. From my tutors point of view thats bad...
I need to mention that somewhere on the site I guess...
You can download the real Tcl (for free) from the tcl
web link on the intro page
http://www.scriptics.com
Scriptics no longer exists but the url redirects to
the correct site...
Sorry about that,
Alan G.
(*)It might be from v1.6 I never used it...
From alan.gauld@bt.com Fri Jun 1 10:51:04 2001
From: alan.gauld@bt.com (alan.gauld@bt.com)
Date: Fri, 1 Jun 2001 10:51:04 +0100
Subject: [Tutor] Lists...
Message-ID: <5104D4DBC598D211B5FE0000F8FE7EB20751D7EA@mbtlipnt02.btlabs.bt.co.uk>
> Is there a way of returning the intersection of two lists?
> Eg. [1,2,'3',4.0,'x'] & [1,8,'3',9,10,'x'] to return [1,'3','x']
Several ways. The easiest for me is:
L1 = [1,2,'3',4.0,'x']
L2 = [1,8,'3',9,10,'x']
intersect = filter(lambda x: (x in L2), L1)
The (x in L2) parens are not needed but I like to use them
to clarify the extent of the lambda expression
Alan G
From lonetwin@yahoo.com Fri Jun 1 11:10:00 2001
From: lonetwin@yahoo.com (steve)
Date: Fri, 1 Jun 2001 15:40:00 +0530
Subject: [Tutor] captering output of a cmd run using os.system.
In-Reply-To: <718A0962DFC2D4119FF80008C7289E4701032D43@ICICIBACK3>
References: <718A0962DFC2D4119FF80008C7289E4701032D43@ICICIBACK3>
Message-ID: <01060115400002.03175@mercury.in.cqsl.com>
Hey there,
> > > a cmd that I run using os.sustem() gives the output that I want to
> > > assign to a var and use later in prog. How do I do that ?
> >
A lil' bit too late in the thread , 'cos I didn't chk my mail,.....but I=20
prefer to use the commands module, commands.getoutput(),=20
commands.getstatusoutput()....stuff like that,...just thought I'd mention=
=20
that, even tho' the Ques. is Ans'ed
Peace
Steve
--=20
||||||||||||||||||||||
|||||||||#####||||||||
||||||||#######|||||||
||||||||# O O #|||||||
||||||||#\ ~ /#|||||||
||||||##||\_/||##|||||
|||||#||||||||||##||||
||||#||||||||||||##|||
||||#|||||||||||||##||=09
|||/\##|||||||||##/\||=09
|/ \#########/ \=09
|\ \#######/ /=09
||\____/#######\____/|=09
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=09
Hello. Just walk along and try NOT to think about your INTESTINES
being almost FORTY YARDS LONG!!
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
From dyoo@hkn.eecs.berkeley.edu Fri Jun 1 11:07:20 2001
From: dyoo@hkn.eecs.berkeley.edu (Daniel Yoo)
Date: Fri, 1 Jun 2001 03:07:20 -0700 (PDT)
Subject: [Tutor] captering output of a cmd run using os.system.
In-Reply-To:
Message-ID:
On Fri, 1 Jun 2001, Andrew Wilkins wrote:
> Let's say I have the following:
>
> pipe = os.popen('python t','r')
> print pipe.read()
>
> ############
> t.py should look like:
>
> while 1:
> x=raw_input('')
> print x
>
> How can I get the above to come up as visible? With popen it seems to
> work in the background.
> Is it possible to also collect input from stdin as well as the pipe?
> Say if I wanted to send a response to the raw_input bit through the
> pipe, or through the actual stdin...
Yes: you'll want to use the extended popen(): os.popen2(). It gives back
two file-like objects, one for input, and the other for output. For
reference, let's look at the documentation:
"""
popen2(cmd[, bufsize[, mode]])
Executes cmd as a sub-process. Returns the file objects (child_stdin,
child_stdout). New in version 2.0.
"""
http://python.org/doc/current/lib/os-newstreams.html
Warning! They switched the order of the arguments "bufsize" and "mode"
between os.popen() and os.popen2(). By default, though, it's in text
mode, so there's usually less of a need to tell Python to override the
defaults.
What we can do, then, might look something like this:
###
input_pipe, output_pipe = os.popen2('python t')
input_pipe.write("Hello world, this is a test.\n")
print output_pipe.read()
###
I have not been able to test this on Windows though, so I'm not sure how
successful this will be... *grin* Try it out, and if you run into
problems, email us again.
Good luck!
From alan.gauld@bt.com Fri Jun 1 11:01:46 2001
From: alan.gauld@bt.com (alan.gauld@bt.com)
Date: Fri, 1 Jun 2001 11:01:46 +0100
Subject: [Tutor] Python syntax highligting with Vim
Message-ID: <5104D4DBC598D211B5FE0000F8FE7EB20751D7EB@mbtlipnt02.btlabs.bt.co.uk>
> and would like to implement it in gvim under windows.
It should already work
> cannot find any documentation on turning on syntax
> highligting.
Try :help syntax
But put simply its:
:syntax on
Or put the line
syntax on
in your .gvimrc file.
Alan g
From alan.gauld@bt.com Fri Jun 1 11:05:27 2001
From: alan.gauld@bt.com (alan.gauld@bt.com)
Date: Fri, 1 Jun 2001 11:05:27 +0100
Subject: [Tutor] Off Topic - tutor@pyhon.org FAQ?
Message-ID: <5104D4DBC598D211B5FE0000F8FE7EB20751D7EC@mbtlipnt02.btlabs.bt.co.uk>
> If one does not exist I would be willing to contribute my
> time.
You said the magic words.
Feel free, I'm pretty sure there iusn't a tutor-faq yet
and yes we do get a lot of duplication. Just nobody
else has time...
So I say go for it.
Alan G.
From alan.gauld@bt.com Fri Jun 1 11:09:11 2001
From: alan.gauld@bt.com (alan.gauld@bt.com)
Date: Fri, 1 Jun 2001 11:09:11 +0100
Subject: [Tutor] captering output of a cmd run using os.system.
Message-ID: <5104D4DBC598D211B5FE0000F8FE7EB20751D7ED@mbtlipnt02.btlabs.bt.co.uk>
------_=_NextPart_001_01C0EA82.E7A76810
Content-type: text/plain; charset="ISO-8859-1"
> You can use the os.popen3 command instead.
You might need to use the version of popwen in
the winall package if you are on NT/W9x
- it seems to work better...
Alan g
------_=_NextPart_001_01C0EA82.E7A76810
Content-type: text/html; charset="ISO-8859-1"
captering output of a cmd run using os.system.
> You can use the os.popen3 command
instead.
You might need to use the version of popwen in
the winall package if you are on NT/W9x
- it seems to work
better...
Alan g
------_=_NextPart_001_01C0EA82.E7A76810--
From dyoo@hkn.eecs.berkeley.edu Fri Jun 1 11:18:18 2001
From: dyoo@hkn.eecs.berkeley.edu (Daniel Yoo)
Date: Fri, 1 Jun 2001 03:18:18 -0700 (PDT)
Subject: [Tutor] String puzzle...
In-Reply-To: <200106010531_MC3-D3E6-4CB4@compuserve.com>
Message-ID:
On Fri, 1 Jun 2001, Sharriff Aina wrote:
> How do I strip a a carriage return? is it really a carriage return
> thats tripping my code up?
Might be; we'd probably need to see the exact error message to be more
sure about it.
The carriage return character can be written as "\r" in Python, if you
have your form output, you can do something like a replace():
###
>>> myform = '''this is a test form
with some carriage\r\n returns in it.'''
>>> myform = myform.replace('\r', '')
###
From craig@osa.att.ne.jp Fri Jun 1 11:39:19 2001
From: craig@osa.att.ne.jp (Craig Hagerman)
Date: Fri, 01 Jun 2001 19:39:19 +0900
Subject: [Tutor] bitwise operations
Message-ID:
Hi,
Could anyone tell me all there is to know about bit manipulation; that is,
how and why a person would want to be fiddling with bits. I have several
books on Python (as well as some other languages) and they tell me what the
bitwise operators are but don't tell me how I would use them, or in what
cases such use would be benificial. Any bit guru's up to such an explainatio
for me?
Craig Hagerman
From arcege@speakeasy.net Fri Jun 1 12:45:31 2001
From: arcege@speakeasy.net (Michael P. Reilly)
Date: Fri, 1 Jun 2001 07:45:31 -0400 (EDT)
Subject: [Tutor] captering output of a cmd run using os.system.
In-Reply-To: <5104D4DBC598D211B5FE0000F8FE7EB20751D7ED@mbtlipnt02.btlabs.bt.co.uk> from "alan.gauld@bt.com" at Jun 01, 2001 11:09:11 AM
Message-ID: <200106011145.f51BjVO02073@dsl092-074-184.bos1.dsl.speakeasy.net>
alan.gauld@bt.com wrote
>
> ------_=_NextPart_001_01C0EA82.E7A76810
> Content-type: text/plain; charset="ISO-8859-1"
>
> > You can use the os.popen3 command instead.
>
> You might need to use the version of popwen in
> the winall package if you are on NT/W9x
> - it seems to work better...
WinXX os.popen also has a bug in GUI environments and will fail anyways
(which is why it doesn't work in the IDEs).
One win32all solution is:
>>> import win32pipe
>>> file = win32pipe.popen("echo Hello from Python", "r")
>>> file.read()
'Hello from Python\012'
>>>
There are other modules to help spawn programs this way.
If you wish to do a lot of WinXX Python programming, you might want to
get Hammond&Robinson's _Python Programming on Win32_.
-Arcege
--
+----------------------------------+-----------------------------------+
| Michael P. Reilly | arcege@speakeasy.net |
From NHYTRO@compuserve.com Fri Jun 1 12:48:11 2001
From: NHYTRO@compuserve.com (Sharriff Aina)
Date: Fri, 1 Jun 2001 07:48:11 -0400
Subject: [Tutor] Thanks
Message-ID: <200106010748_MC3-D3EC-C6FD@compuserve.com>
I would like to thank all the members of this list that helped me through=
the bumpy ride of coding an online HTML editor, I hope one day to be a
proficient as you all in order to help others as you have helped me.
My application is still "Raw", it its far from being finished, but its
something I can show my boss to underline Pythons feasibility in such a
project.
Best regards
Sharriff
From alan.gauld@bt.com Fri Jun 1 13:18:42 2001
From: alan.gauld@bt.com (alan.gauld@bt.com)
Date: Fri, 1 Jun 2001 13:18:42 +0100
Subject: [Tutor] bitwise operations
Message-ID: <5104D4DBC598D211B5FE0000F8FE7EB20751D7F1@mbtlipnt02.btlabs.bt.co.uk>
> Could anyone tell me all there is to know about bit
> manipulation;
No, I doubt it. I don'ty think anyone has figured
that out yet... Some things you might like to do
a search on the net for are 'Boolean Algenra'
and 'Bitmasks'
> why a person would want to be fiddling with bits.
Bits are a compact way of storing a lot of data which
is boolean by nature.
For example software used for bulk processing of a
long list of items might keep a note of which items
have changed(and hence need reprocessing) by adding
a boolean value flag to the reords - but that (a)
changes the records and (b) takes up a byte per
record. An altrernative solution is to store a block
of memory with a single bit representing each record,
then simply switch that bit on if the reord changes.
The bulk processor then scans the bits and processes
the records with a bit set.
This scheme is what is used in practice for
synchronising mirrored hard disks in large
data centres etc... the bits represent the
raw sectors of the disk and the OS updates
the bit image after every write.
> bitwise operators are but don't tell me how
> I would use them, or in what cases such use
> would be benificial.
But there are myriad other uses for these,
usually in a low level systems context and
often in situations where storage space is
expensive - like networking protocols etc.
I'll leave explaining how to use "bit masks"
to read/write individual bits within a block
of storage to someone else... :-)
Alan G.
From shalehperry@home.com Fri Jun 1 15:14:49 2001
From: shalehperry@home.com (Sean 'Shaleh' Perry)
Date: Fri, 01 Jun 2001 07:14:49 -0700 (PDT)
Subject: [Tutor] String puzzle...
In-Reply-To:
Message-ID:
>###
>>>> myform = '''this is a test form
>
> with some carriage\r\n returns in it.'''
>>>> myform = myform.replace('\r', '')
>###
>
or simply use strip(), which will remove leading and trailing whitespace of any
kind. Which, in this instance seems like the right thing to do. There is also
rstrip() which only strips from the right.
From BlakeW@rpmtec.com Fri Jun 1 14:53:24 2001
From: BlakeW@rpmtec.com (Blake Winton (Screaming))
Date: Fri, 1 Jun 2001 09:53:24 -0400
Subject: [Tutor] bitwise operations
Message-ID: <8551136CB6F6D311811B00508B8B92E0C897C0@mail.rpmtec.com>
> > Could anyone tell me all there is to know about bit
> > manipulation;
> No, I doubt it. I don'ty think anyone has figured
> that out yet... Some things you might like to do
> a search on the net for are 'Boolean Algenra'
> and 'Bitmasks'
Okay, but surely we could give Craig a short overview...
(See the bottom of the message for descriptions of
setting bits, clearing bits, and checking if bits are
set.)
> > why a person would want to be fiddling with bits.
> Bits are a compact way of storing a lot of data which
> is boolean by nature.
[ some good examples snipped... ]
> But there are myriad other uses for these,
> usually in a low level systems context and
> often in situations where storage space is
> expensive - like networking protocols etc.
I also saw a neat application of them in a financial
application I'm looking at. Basically, you can set
up Pre-Authorized Cash Transfers to happen once or
twice a month, on any days you choose. As a compact
(and easy?) way of representing those pieces of
information, the coders chose to use an integer, as
a bit mask. So, if we look at some examples of the
individual bits, we can see what's going on.
If you wanted the transfers to occur on the 3rd and
the 7th, you would set those bits to one, and leave
the rest as 0, to get:
01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 ...
0 0 1 0 0 0 1 0 0 0 0 0 0 0 0 ...
(which I've wrote backwards, so we'll flip it to
be 1000100 (base 2) which equals 68 (base 10).)
Or, if you only wanted stuff transfered on the 5th
of each month, you you set the 5th bit to one, and
the rest to 0, to get:
01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 ...
0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 ...
(which I've wrote backwards, so we'll flip it to
be 10000 (base 2) which equals 16 (base 10).)
Then, to see if a current day has any scheduled
transfers, all the calling program has to do is
take that day number, and check if the bit is set.
> I'll leave explaining how to use "bit masks"
> to read/write individual bits within a block
> of storage to someone else... :-)
I'll try it...
First, we'll need a short course in hexadecimal numbers,
because they're easier to print out.
If you take a binary number, like 100100 (which equals
36), we can break the digits of it up into groups of 4,
to get 10 0100, and add a couple of 0s at the front to
make 4 digits, and we get 0010 0100. Now, each of these
groups can be turned into a number with the following
chart:
0000 = 0 1000 = 8
0001 = 1 1001 = 9
0010 = 2 1010 = A (10)
0011 = 3 1011 = B (11)
0100 = 4 1100 = C (12)
0101 = 5 1101 = D (13)
0110 = 6 1110 = E (14)
0111 = 7 1111 = F (15)
These are the hexadecimal numbers. And if we look them
up, we find that our number 0010 0100 turns into 24 (hex).
To make it easy for us to tell the difference between 24
(decimal) and 24 (hex), we stick a "0x" onto the front of
the hex number, to get "0x24". And if we start python,
we can see that it works.
>>> print hex(36)
0x24
So, from here on in, I'm just going to print out the hex
numbers. If you want to know the binary, you can look it
up...
I should probably also tell you about the << operator.
It takes a number, and shifts it left by another number.
So, if we have 1 << 4, in binary, it makes 1 turn into
10000 (think of adding 4 0s onto the end of the number
in binary). This gives us an easy way of selecting the
4th bit, just use 1<<3. (Because 1<<0 is the first bit.)
Now, on to the actual stuff...
To set a bit in a bit mask, you use the "or" operator,
(written "|"). But then we need to assign it back to
the variable we're testing. So, lets start with an x
of 0, and set some bits in it.
Jython 2.0 on java1.2.2 (JIT: symcjit)
Type "copyright", "credits" or "license" for more information.
>>> x = 0
>>> print hex(x)
0x0
>>> x = x | 1 << 4
>>> print hex(x)
0x10
>>> # in binary 0001 0000, so the 5th bit is set.
>>> x = x | 1 << 2
>>> print hex(x)
0x14
>>> # in binary 0001 0100, so the 5th and 3rd bits are set.
It sort of looks like we're just adding here, but if
we try to set the second bit again, we get:
>>> x = x | 1 << 2
>>> print hex(x)
0x14
If we want to clear a bit, it's a little more complicated.
We want to use the "and" operator, written "&", but with
all the bits set except for the one we want. To get that,
we need the "not" operator, written "~". So, to clear the
3rd bit, we use x = x & ~(1 << 2)
>>> x = x & ~(1 << 2)
>>> print hex(x)
0x10
>>> # And we're back to 0001 0000, so the 5th bit is set.
Finally, to test if the 5th bit is set, we again use the
"and" operator ("&"), but this time, we check that the
result is not equal to 0.
>>> print (x & (1<<4)) != 0
1
It's probably useful to you to make three functions.
def setBit( x, bitNum ):
return x | 1 << bitNum
def clearBit( x, bitNum ):
return x & ~( 1 << bitNum )
def checkBit( x, bitNum ):
return (x & (1<
Actually I had tried "stripping" even on both sides, before database acce=
ss
and after, no difference. This worked:
##
result =3D string.replace(myform,'\n', '')
it was a NEWLINE that tripped me up the whole time :-))
Thanks for the tip all the same
Best regards
Sharriff
Nachricht geschrieben von INTERNET:tutor@python.org
>>###
>>>> myform =3D '''this is a test form
> =
> with some carriage\r\n returns in it.'''
>>>> myform =3D myform.replace('\r', '')
>###
> =
or simply use strip(), which will remove leading and trailing whitespace =
of
any
kind. Which, in this instance seems like the right thing to do. There i=
s
also
rstrip() which only strips from the right.<
From clickron@webtv.net Fri Jun 1 23:32:23 2001
From: clickron@webtv.net (clickron@webtv.net)
Date: Fri, 1 Jun 2001 18:32:23 -0400 (EDT)
Subject: [Tutor] starting tcl? Thanks
Message-ID: <23824-3B1817F7-115@storefull-167.iap.bryant.webtv.net>
Thanks for the help. As I try to learn this stuff it can be kind of
confusing and frustrating, but it's coming slow but sure.
Ron
From lgwb@home.com Sat Jun 2 05:25:26 2001
From: lgwb@home.com (Michael Schmitt)
Date: Fri, 1 Jun 2001 23:25:26 -0500
Subject: [Tutor] Lists...
References: <5104D4DBC598D211B5FE0000F8FE7EB20751D7EA@mbtlipnt02.btlabs.bt.co.uk>
Message-ID: <00e901c0eb1c$0cb9aac0$0a0a0a0a@mntp1.il.home.com>
Just for fun I added a function using Alan G method to the Roeland's timing
code as follows:
def intersect1(l1, l2):
'''brute force intersection of two lists'''
if len(l1) > 1000:
print 'forget about it...\n brute force number invalid!'
return l1
return [item for item in l1 if item in l2]
def intersect2(l1, l2):
'''intersection of two lists, using dicts'''
dict = {}
for item in l2:
dict[item] = None
return [item for item in l1 if dict.has_key(item)]
def intersect2a(l1, l2):
'''using dicts with filter, thanks to Remco Gehrlich'''
dict = {}
for item in l2:
dict[item] = 1
return filter(dict.has_key, l1)
def intersect3(l1, l2):
'''intersection of two sorted lists of unique items'''
result = []
lo = 0
hi = len(l2)
for i in l1:
for j in xrange(lo, hi):
n = cmp(l2[j], i)
if n==-1:
lo = j
elif n==1:
break
else:
lo = j
result.append(i)
break
return result
def intersect_eas(L1, L2):
'''The easiest way for Alan G'''
return filter(lambda x: (x in L2), L1)
def make_list(n):
'''Make a sorted list of unique ints larger than 1'''
import random
l = []
x = 1
for i in xrange(n):
x = x+random.randrange(1, 5)
l.append(x)
return l
def time_func(intersect_func, l1, l2):
import time
t1 = time.time()
l = intersect_func(l1, l2)
t2 = time.time()-t1
# print l[0:10]
return t2
def test(n):
l1 = make_list(n)
l2 = make_list(n)
print 'Brute force (n=%i), t=%f' % (n, time_func(intersect1, l1,
l2))
print 'Dict lookup (n=%i), t=%f' % (n, time_func(intersect2, l1,
l2))
print 'Dict filter (n=%i), t=%f' % (n, time_func(intersect2a, l1,
l2))
print 'Sorted list (n=%i), t=%f' % (n, time_func(intersect3, l1,
l2))
print 'Sort easy (n=%i), t=%f' % (n, time_func(intersect_eas, l1,l2))
if __name__=='__main__':
test(10)
test(100)
test(1000)
test(10000)
and the results.....
Brute force (n=10), t=0.000000
Dict lookup (n=10), t=0.000000
Dict filter (n=10), t=0.000000
Sorted list (n=10), t=0.000000
Sort easy (n=10), t=0.000000
Brute force (n=100), t=0.000000
Dict lookup (n=100), t=0.010000
Dict filter (n=100), t=0.000000
Sorted list (n=100), t=0.000000
Sort easy (n=100), t=0.000000
Brute force (n=1000), t=0.631000
Dict lookup (n=1000), t=0.030000
Dict filter (n=1000), t=0.021000
Sorted list (n=1000), t=0.060000
Sort easy (n=1000), t=0.010000
forget about it...
brute force number invalid!
Brute force (n=10000), t=0.131000
Dict lookup (n=10000), t=0.270000
Dict filter (n=10000), t=0.210000
Sorted list (n=10000), t=0.681000
Sort easy (n=10000), t=0.210000
Thanks guys... that was cool.
Question regarding running the brute force method with values of 10000 for
n under IDLE, "how do I stop the code from running with out shuting down
IDLE?"
Michael Schmitt
From dyoo@hkn.eecs.berkeley.edu Sat Jun 2 06:39:47 2001
From: dyoo@hkn.eecs.berkeley.edu (Daniel Yoo)
Date: Fri, 1 Jun 2001 22:39:47 -0700 (PDT)
Subject: [Tutor] Lists... [book recommendation for Programming Pearls]
In-Reply-To: <00f101c0eb1c$724ffbf0$0a0a0a0a@mntp1.il.home.com>
Message-ID:
On Fri, 1 Jun 2001, Michael Schmitt wrote:
> So is the book programming language independent? Will I get anything
> out of it if I don't know C and only Python?
It uses a bit of C, C++, and pseudocode, but the ideas are very
transferable to Python. The focus of the book is conceptual. Here's part
of his Preface:
"""The columns in this book are about a more glamorous aspect of the
profession: programming pearls whose origins lie beyond solid engineering,
in the realm of insight and creativity. Just as natural pearls grow from
grains of sand that have irritated oysters, these programming pearls have
grown from real problems that have irritated real programmers. The
programs are fun, and they teach important programming techniques and
fundamental design principles.
Most of these essays originally appeared in my "Programming Pearls" column
in Communications of the Association for Computing Machinery. They were
collected, revised, and published as the first edition of this book in
1986. Twelve of the thirteen pieces in the first edition have been edited
substantially for this edition, and three new columns hav ebeen added.
The only backgorund the book assumes is programming experience in a
high-level language. Advanced techniques (such as templates in C++) show
up now and then, but the reader unfamiliar with such topics will be able
to skip to the next section with impunity.
Although each column may be read by itself, there is a logical grouping to
the complete set. columns 1 through 5 form Part I of the book. They
review programming fundamentals: problem definition, algorithms, data
structures and program verification and testing. Part II is built around
the theme of efficiency, which is sometimes important in itself and is
always a fine springboard into interesting programming problems. Part III
applies those techniques to several substantial problems in sorting,
searching and strings."""
Whew! Anyway, I recommend taking a look at it in your local bookstore,
and see if it's useful for you. It's one of the books I really wish
someone had recommended to me years ago, so that's why I'm recommending it
now. *grin*
Hope this helps!
From dyoo@hkn.eecs.berkeley.edu Sat Jun 2 06:55:28 2001
From: dyoo@hkn.eecs.berkeley.edu (Daniel Yoo)
Date: Fri, 1 Jun 2001 22:55:28 -0700 (PDT)
Subject: [Tutor] Re: [Python-Help] a number and control char stored in a single char.
!
In-Reply-To: <20010602052713.3595.qmail@web13607.mail.yahoo.com>
Message-ID:
On Fri, 1 Jun 2001, kaha aham wrote:
> I am running & capturing screen output of a command using os.popen as
> helped by tuto@python.org ppl. However the value i capture which
> should be a number like something like 22345 is displayed as
> '22345\012'
Yes, this means that what you're getting back is the string "21345"
followed by the newline, '\012'. What you'll need to do is convert it
with the int() function.
> I need to numerically compare this value later in program. I tried
> slicing it to remove the last control char using var[:-1], on which it
> prints []. I then trid using len(), it tells size as 1 char. I tried
> printing just 1st char using var[0], and it shows '22345\012'
Ah! You had the right idea: what you'll want to do is:
var[0][:-1]
instead. You want to get all but the last character from var[0], your
first line of the output. This is probably what was preventing you from
converting to integer. Try int()'ing with var[0][:-1], and you should be
ok. But if you're converting with int(), you don't need to strip out the
newline character; int() knows how to deal with it already.
Let's look at what happened before... I'm guessing that when you used
os.popen(), you used the readlines() method to get at all the lines of
output. What this means is that "var" stands for all the lines of input,
and "var[0]" stands for the first line. However, "var[:-1]" stands for
all but the last line --- but if your output only consists of one line,
that means you'll get the empty list, []. That should explain the weird
error messages.
> That's baffling me. How can it put all that number and control char in
> 1 char. I currently can't post to tutor maillist as I did earlier.
Hmmm... that's strange! Try posting your question again; perhaps the mail
host was down. In the meantime, I'll forward your message to
tutor@python.org.
I just checked, and from what I can tell, you're not subscribed to the
tutor list yet. You'll probably need to subscribe to post to tutor. You
can subscribe here:
http://mail.python.org/mailman/listinfo/tutor
If you run into difficulties again, feel free to email again. I'll talk
to you later!
From dyoo@hkn.eecs.berkeley.edu Sat Jun 2 06:55:39 2001
From: dyoo@hkn.eecs.berkeley.edu (Daniel Yoo)
Date: Fri, 1 Jun 2001 22:55:39 -0700 (PDT)
Subject: [Tutor] [Python-Help] a number and control char stored in a single char.
! (fwd)
Message-ID:
---------- Forwarded message ----------
Date: Fri, 1 Jun 2001 22:27:13 -0700 (PDT)
From: kaha aham
To: help@python.org
Subject: [Python-Help] a number and control char stored in a single char. !
hello,
I am running & capturing screen output of a command using os.popen
as helped by tuto@python.org ppl. However the value i capture which should
be a number like something like 22345 is displayed as '22345\012'
I need to numerically compare this value later in program.
I tried slicing it to remove the last control char using var[:-1],
on which it prints []. I then trid using len(), it tells size as 1 char.
I tried printing just 1st char using var[0], and it shows '22345\012'
That's baffling me. How can it put all that number and control char in 1 char.
I currently can't post to tutor maillist as I did earlier.
I tried int(var) and it says, object cant be converted to int.
Can you give a hint how do I resolve this and get the numeric out of it.
/psg
---------------------------------
Do You Yahoo!?
Yahoo! Mail Personal Address - Get email at your own domain with Yahoo! Mail.
From dyoo@hkn.eecs.berkeley.edu Sat Jun 2 07:01:50 2001
From: dyoo@hkn.eecs.berkeley.edu (Daniel Yoo)
Date: Fri, 1 Jun 2001 23:01:50 -0700 (PDT)
Subject: [Tutor] bitwise operations
In-Reply-To: <5104D4DBC598D211B5FE0000F8FE7EB20751D7F1@mbtlipnt02.btlabs.bt.co.uk>
Message-ID:
On Fri, 1 Jun 2001 alan.gauld@bt.com wrote:
> > Could anyone tell me all there is to know about bit
> > manipulation;
>
> No, I doubt it. I don'ty think anyone has figured that out yet... Some
> things you might like to do a search on the net for are 'Boolean
> Algenra' and 'Bitmasks'
>
> > why a person would want to be fiddling with bits.
>
> Bits are a compact way of storing a lot of data which is boolean by
> nature.
> For example software used for bulk processing of a long list of items
> might keep a note of which items have changed(and hence need
> reprocessing) by adding a boolean value flag to the reords - but that
> (a) changes the records and (b) takes up a byte per record. An
> altrernative solution is to store a block of memory with a single bit
> representing each record, then simply switch that bit on if the reord
> changes.
Using a bit-wise notation is also a natural way of representing sets.
For example, let's say that we'd like to find the intersection of two
lists of numbers. For example, let's try to find the intersection
between:
L1 = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
L2 = [2, 4, 6, 8, 10, 12]
Of course, we know that intersect(L1, L2) = [2, 4, 6, 8, 10], but let's
pretend that we didn't know that initially. A way that we can represent
L1 is as a list of bits:
---------------------------------------------------------
pos 0 1 2 3 4 5 6 7 8 9 10 11 12
---------------------------------------------------------
L1 = 0 1 1 1 1 1 1 1 1 1 1 0 0
L2 = 0 0 1 0 1 0 1 0 1 0 1 0 1
(Traditionally, the bits are listed in reverse order.)
The reason that representing L1 and L2 as a bunch of bits is useful is
because taking the intersection just involves looking for places where L1
and L2 both have 1: that is, we perform the AND logical operation:
---------------------------------------------------------
pos 0 1 2 3 4 5 6 7 8 9 10 11 12
---------------------------------------------------------
L1 = 0 1 1 1 1 1 1 1 1 1 1 0 0
L2 = 0 0 1 0 1 0 1 0 1 0 1 0 1
--------------------------------------------------------
L1 & L2 = 0 0 1 0 1 0 1 0 1 0 1 0 0
And that's exactly what we want to get: by doing the AND, we now know that
the intersection between L1 and L2 is [2, 4, 6, 8, 10].
To actually represent L1 in Python is where all those bit operations come
into play. The idea in bit manipulation is that we'll try to "pack" a
bunch of bits into a Python integer. Every Python integer is actually
made up of 32 bits --- that gives us 32 little switches to work with. If
we want more bits, we can use another integer to get a block of 32 more
bits.
Blake Winton's message talks a little more about bit-fiddling stuff, so
I'll stop here... *grin*
From r.b.rigilink@chello.nl Sat Jun 2 08:05:10 2001
From: r.b.rigilink@chello.nl (Roeland Rengelink)
Date: Sat, 02 Jun 2001 09:05:10 +0200
Subject: [Tutor] Lists...
References: <5104D4DBC598D211B5FE0000F8FE7EB20751D7EA@mbtlipnt02.btlabs.bt.co.uk> <00e901c0eb1c$0cb9aac0$0a0a0a0a@mntp1.il.home.com>
Message-ID: <3B189026.18DAFC5A@chello.nl>
Michael Schmitt wrote:
>
> Just for fun I added a function using Alan G method to the Roeland's timing
> code as follows:
>
Hi Michael,
I don't know why our numbers differ so much (you got 0.00000 in a lot of
your timing measurements)
Anyway, Alan's method is strictly brute force, just written somewhat
differently.
Here's what I get (Code follows at the end)
Brute force (n=10), t=0.000137
List filter (n=10), t=0.000212 # Alan's code
Dict lookup (n=10), t=0.000150
Dict filter (n=10), t=0.000119
Sorted list (n=10), t=0.000426
Brute force (n=100), t=0.006812
List filter (n=100), t=0.006745
Dict lookup (n=100), t=0.001056
Dict filter (n=100), t=0.000680
Sorted list (n=100), t=0.003793
Brute force (n=1000), t=0.831248
List filter (n=1000), t=0.837468
Dict lookup (n=1000), t=0.017591
Dict filter (n=1000), t=0.007191
Sorted list (n=1000), t=0.055949
Brute force (n=10000), t=92.381026
List filter (n=10000), t=92.870684
Dict lookup (n=10000), t=0.151935
Dict filter (n=10000), t=0.124802
Sorted list (n=10000), t=0.532801
i.e Quadratic time behaviour for brute force, linear time for
dictinonary based methods and using sorted lists.
-- the code
from __future__ import nested_scopes
def intersect1(l1, l2):
'''brute force intersection of two lists'''
return [item for item in l1 if item in l2]
def intersect2(l1, l2):
'''intersection of two lists, using dicts'''
dict = {}
for item in l2:
dict[item] = None
return [item for item in l1 if dict.has_key(item)]
def intersect2a(l1, l2):
'''using dicts with filter, thanks to Remco Gehrlich'''
dict = {}
for item in l2:
dict[item] = 1
return filter(dict.has_key, l1)
def intersect3(l1, l2):
'''intersection of two sorted lists of unique items'''
result = []
lo = 0
hi = len(l2)
for i in l1:
for j in xrange(lo, hi):
n = cmp(l2[j], i)
if n==-1:
lo = j
elif n==1:
break
else:
lo = j
result.append(i)
break
return result
def intersect_eas(L1, L2):
'''The easiest way for Alan G, requires nested_scopes'''
return filter(lambda x: (x in L2), L1)
def make_list(n):
'''Make a sorted list of unique ints larger than 1'''
import random
l = []
x = 1
for i in xrange(n):
x = x+random.randrange(1, 5)
l.append(x)
return l
def time_func(intersect_func, l1, l2):
import time
t1 = time.time()
l = intersect_func(l1, l2)
t2 = time.time()-t1
# print l[0:10]
return t2
def test(n):
l1 = make_list(n)
l2 = make_list(n)
print 'Brute force (n=%i), t=%f' % (n, time_func(intersect1, l1,
l2))
print 'List filter (n=%i), t=%f' % (n, time_func(intersect_eas, l1,
l2))
print 'Dict lookup (n=%i), t=%f' % (n, time_func(intersect2, l1,
l2))
print 'Dict filter (n=%i), t=%f' % (n, time_func(intersect2a, l1,
l2))
print 'Sorted list (n=%i), t=%f' % (n, time_func(intersect3, l1,
l2))
print
if __name__=='__main__':
test(10)
test(100)
test(1000)
test(10000)
--
r.b.rigilink@chello.nl
"Half of what I say is nonsense. Unfortunately I don't know which half"
From rickyp1@frontiernet.net Sat Jun 2 19:49:05 2001
From: rickyp1@frontiernet.net (Ricky Parks)
Date: Sat, 2 Jun 2001 13:49:05 -0500
Subject: [Tutor] Unsubsciption
Message-ID: <001c01c0eb94$b3ab2980$6601a8c0@Parks>
This is a multi-part message in MIME format.
------=_NextPart_000_0019_01C0EB6A.C9C89380
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
I thought this tuter thing would help me out, I am a beginner but =
instead I am getting alot of messages in my mail box that I dont want. =
Please give me the unsubscrition web address. You should add the =
unsubscrition address to off email sent.
Richard E Parks 2
RickyP1@frontiernet.net
=20
------=_NextPart_000_0019_01C0EB6A.C9C89380
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
I thought this tuter thing would help =
me out, I am=20
a beginner but instead I am getting alot of messages in my mail box that =
I dont=20
want. Please give me the unsubscrition web address. You should add the=20
unsubscrition address to off email sent.
=20
=
=20
=
=20
Richard E Parks 2
------=_NextPart_000_0019_01C0EB6A.C9C89380--
From rickyp1@frontiernet.net Sat Jun 2 19:54:18 2001
From: rickyp1@frontiernet.net (Ricky Parks)
Date: Sat, 2 Jun 2001 13:54:18 -0500
Subject: [Tutor] Please?
Message-ID: <003d01c0eb95$6e56a340$6601a8c0@Parks>
This is a multi-part message in MIME format.
------=_NextPart_000_003A_01C0EB6B.84C7F9A0
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
I am a beginner and I am unsubscribing to tuter because I am getting to =
many emails at once and none of them are helping me, could you posiblie =
try to teach personaly? I am realy eger to learn!
Richard E Parks 2
RickyP1@frontiernet.net
------=_NextPart_000_003A_01C0EB6B.84C7F9A0
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
I am a beginner and I am unsubscribing =
to tuter=20
because I am getting to many emails at once and none of them are helping =
me,=20
could you posiblie try to teach personaly? I am realy eger to=20
learn!
=20
=
=20
=
=20
Richard E Parks 2
------=_NextPart_000_003A_01C0EB6B.84C7F9A0--
From phil@xfr.co.uk Sat Jun 2 20:24:11 2001
From: phil@xfr.co.uk (Philip Kilner)
Date: Sat, 02 Jun 2001 20:24:11 +0100
Subject: [Tutor] Unsubsciption
In-Reply-To: <001c01c0eb94$b3ab2980$6601a8c0@Parks>
References: <001c01c0eb94$b3ab2980$6601a8c0@Parks>
Message-ID:
Ricky,
The unsubscribe info is in the header of every email!
In article <001c01c0eb94$b3ab2980$6601a8c0@Parks>, Ricky Parks wrote:
> List-Help:
> List-Post:
> List-Subscribe: ,
>
> List-Id: Discussion for learning programming with Python
> List-Unsubscribe: ,
>
> List-Archive:
>
You might be better staying on the list - you'll learn by watching others
learn, and others will learn watching you learn. It's a community thing -
it's also more efficient!
There are some v. Helpful people on this list, including authors of
introductory Python books. It's worth sticking around.
HTH,
PhilK
From sarnold@earthling.net Sat Jun 2 20:37:10 2001
From: sarnold@earthling.net (Stephen L Arnold)
Date: Sat, 2 Jun 2001 12:37:10 -0700
Subject: [Tutor] Unsubsciption
In-Reply-To: <001c01c0eb94$b3ab2980$6601a8c0@Parks>
Message-ID: <20010602193710.EC3FF1F62A@shiva.arnolds.bogus>
On 2 Jun 01, at 13:49, Ricky Parks wrote:
> I thought this tuter thing would help me out, I am a beginner
> but instead I am getting alot of messages in my mail box that I
> dont want. Please give me the unsubscrition web address. You
> should add the unsubscrition address to off email sent.
Tips:
1) keep the list option emails you receive when you sign up for a
list.
2) use a better mailer (like Pegasus) with straight-forward
filtering and other options to help you manage mail.
3) don't forget to turn off M$-richcrap-text or html mail (in your
mailer settings) - the RFCs define internet email as ASCII text
only.
4) stop whining and go here:
http://mail.python.org/mailman/listinfo/tutor
*************************************************************
Steve Arnold sarnold@earthling.net
http://arnolds.dhs.org
Java is for staying up late while you program in Python...
From sarnold@earthling.net Sat Jun 2 20:55:53 2001
From: sarnold@earthling.net (Stephen L Arnold)
Date: Sat, 2 Jun 2001 12:55:53 -0700
Subject: [Tutor] Unsubsciption
In-Reply-To: <20010602193710.EC3FF1F62A@shiva.arnolds.bogus>
References: <001c01c0eb94$b3ab2980$6601a8c0@Parks>
Message-ID: <20010602195554.0AB7D1F62A@shiva.arnolds.bogus>
On 2 Jun 01, at 12:37, Stephen L Arnold wrote:
> 1) keep the list option emails you receive when you sign up for a
> list.
>
> 2) use a better mailer (like Pegasus) with straight-forward
> filtering and other options to help you manage mail.
>
> 3) don't forget to turn off M$-richcrap-text or html mail (in your
> mailer settings) - the RFCs define internet email as ASCII text
> only.
>
> 4) stop whining and go here:
>
> http://mail.python.org/mailman/listinfo/tutor
Sorry, I didn't intend that last one to sound mean (I've been
dealing with a particularly recalcitrant 8 year old all morning).
However, the first three are still useful...
Steve
*************************************************************
Steve Arnold http://arnolds.dhs.org
"We've gotta protect our phony-balony jobs, gentlemen!"
- Mel Brooks
From rickyp1@frontiernet.net Sat Jun 2 20:57:06 2001
From: rickyp1@frontiernet.net (Ricky Parks)
Date: Sat, 2 Jun 2001 14:57:06 -0500
Subject: [Tutor] Ok
Message-ID: <003d01c0eb9e$341c3d80$6601a8c0@Parks>
This is a multi-part message in MIME format.
------=_NextPart_000_003A_01C0EB74.4A85F2C0
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Ok, I am going to stick with it, I will say this agian I am a =
beginer an know nothing about programming, so half the stuff that is =
sent I will not undersand! Thank you.
Richard E Parks 2
RickyP1@frontiernet.net
=20
------=_NextPart_000_003A_01C0EB74.4A85F2C0
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Ok, I am going to =
stick with it,=20
I will say this agian I am a beginer an know nothing about programming, =
so half=20
the stuff that is sent I will not undersand! Thank =
you.
=20
=
=20
=
=20
Richard E Parks 2
------=_NextPart_000_003A_01C0EB74.4A85F2C0--
From sarnold@earthling.net Sat Jun 2 21:18:24 2001
From: sarnold@earthling.net (Stephen L Arnold)
Date: Sat, 2 Jun 2001 13:18:24 -0700
Subject: [Tutor] Ok - here're some resources
In-Reply-To: <003d01c0eb9e$341c3d80$6601a8c0@Parks>
Message-ID: <20010602201825.3E5121F62A@shiva.arnolds.bogus>
On 2 Jun 01, at 14:57, Ricky Parks wrote:
> Ok, I am going to stick with it, I will say this agian I am a
> beginer an know nothing about programming, so half the stuff that
> is sent I will not undersand! Thank you.
If you're really starting from scratch, then Python is definitely
the language to start with (then later you could check out Ada :)
Try the Non-Programmers Tutorial For Python:
http://www.honors.montana.edu/~jjc/easytut/easytut/easytut.html
How to think like a computer scientist:
http://www.ibiblio.org/obp/thinkCSpy/
Learning to program:
http://www.crosswinds.net/~agauld/
(this guy is also on the Tutor list)
There's also the regular Python Tutorial:
http://www.python.org/doc/current/tut/tut.html
A Python Short Course:
http://www.wag.caltech.edu/home/rpm/python_course/
The What, Why, Who, and Where of Python:
http://www.networkcomputing.com/unixworld/tutorial/005/005.html
Programming Resources:
http://www.cyberramp.net/~fdavid/programming.html
and last but not least, John English's Brighton University Resource
Kit for Students of computer science (BURKS - its's both a website
and a set of inexpensive CD-ROMs). Highly recommended:
http://burks.brighton.ac.uk/
That ought to keep you busy for a while ;-)
Steve
--
Think of the Linux community as a niche economy isolated by its beliefs.
Kind of like the Amish, except that our religion requires us to use
_higher_ technology than everyone else.
-- Donald B. Marti Jr.
From r.b.rigilink@chello.nl Sat Jun 2 21:33:00 2001
From: r.b.rigilink@chello.nl (Roeland Rengelink)
Date: Sat, 02 Jun 2001 22:33:00 +0200
Subject: [Tutor] Ok
References: <003d01c0eb9e$341c3d80$6601a8c0@Parks>
Message-ID: <3B194D7C.F2936AED@chello.nl>
> Ricky Parks wrote:
>
> Ok, I am going to stick with it, I will say this agian I am a
> beginer an know nothing about programming, so half the stuff that is
> sent I will not undersand! Thank you.
> Richard E Parks 2
> RickyP1@frontiernet.net
>
Hi Ricky,
Glad you decided to stick with it.
If you run into anything specific you'd like to get help with I hope
you'll feel confident enough to send your questions to the list. In that
way others will benefit from our answers.
If you feel more comfortable with that, I for one don't mind if you send
questions privately.
Don't worry to much about the stuff that seems way over your head now
(we do get carried away sometimes) I think you'll find that things will
be much more comprehensible in a few months. Also, don't worry about
asking for explanations.
Have fun,
Roeland Rengelink
--
r.b.rigilink@chello.nl
"Half of what I say is nonsense. Unfortunately I don't know which half"
From sak@nwlink.com Sat Jun 2 18:38:42 2001
From: sak@nwlink.com (Sak)
Date: Sat, 2 Jun 2001 13:38:42 -0400
Subject: [Tutor] Ok
In-Reply-To: <003d01c0eb9e$341c3d80$6601a8c0@Parks>
References: <003d01c0eb9e$341c3d80$6601a8c0@Parks>
Message-ID: <01060213384200.02128@ci>
On Saturday 02 June 2001 15:57, Ricky Parks wrote:
> Ok, I am going to stick with it, I will say this agian I am a beginer
> an know nothing about programming, so half the stuff that is sent I will
> not undersand! Thank you. Richard E Parks 2
> RickyP1@frontiernet.net
I can relate Ricky, and I was just thinking about this earlier this morning.
I subscribed to this list a couple days ago, with equal fear that I wouldn't
understand what the heck was going on. But then I remembered that no
knowledge comes as easy as we would like it to.
My goal is to work through my Learning Python book (O'Reilly) the tutorial
from Python.org, and continue reading the posts to this list. Eventually,
it'll make sense. I just think what we complete newbies are feeling is akin
to culture-shock. After we immerse ourselves in the stuff for a while it'll
make more sense; and that will be a great sense of accomplishment.
Thanks,
--
Sak.
From rob@jam.rr.com Sat Jun 2 22:02:34 2001
From: rob@jam.rr.com (Rob Andrews)
Date: Sat, 02 Jun 2001 16:02:34 -0500
Subject: [Tutor] Ok
References: <003d01c0eb9e$341c3d80$6601a8c0@Parks>
Message-ID: <3B19546A.A98FA32@jam.rr.com>
> Ricky Parks wrote:
>
> Ok, I am going to stick with it, I will say this agian I am a
> beginer an know nothing about programming, so half the stuff that is
> sent I will not undersand! Thank you.
> Richard E Parks 2
> RickyP1@frontiernet.net
>
Even if learning sometimes takes time (certainly in my case), it's at
least always good to be exposed to really decent people. We have plenty
of 'em on this list.
my $.02 worth,
Rob
--
Useless Python!
Kinda like the AOL of the Open Source Community 3;->
http://www.lowerstandard.com/python/index.html
From Tutor@python.org Sat Jun 2 22:19:16 2001
From: Tutor@python.org (Tim Peters)
Date: Sat, 2 Jun 2001 17:19:16 -0400
Subject: [Tutor] Ok
In-Reply-To: <3B19546A.A98FA32@jam.rr.com>
Message-ID:
[Ricky Parks]
> Ok, I am going to stick with it, I will say this agian I am a
> beginer an know nothing about programming, so half the stuff that is
> sent I will not undersand! Thank you.
If you only see stuff you already understand, how would you learn? I've
been programming for decades, and I don't understand half of what I see
either: it's a very big world out there .
Questions at all levels are welcome here. So if the list goes through a
period where everything seems over your head, feel free to start new topics
on things *you're* wondering about! The biggest problem beginners have is
not that they ask "stupid questions", but that too many are nervous about
asking any questions at all. Programming is a lot of fun, but there's a lot
to learn too.
From budgester@budgester.com Sat Jun 2 22:54:39 2001
From: budgester@budgester.com (Martin Stevens)
Date: Sat, 2 Jun 2001 22:54:39 +0100
Subject: [Tutor] Mailing List.
Message-ID: <20010602225439.A17781@budgester.com>
Hi,
Probably should be mailing the admins directly but,
We use the Mailman software for this list ?
On another list I belong to they have set the Reply-to
address as the list address, is there a reason we don't
do this ?
I'm sure it would make things easier, when replying to queries
BTW I'm using Mutt on Debian, so there maybe a way of replying
to the list automatically.
Thanks
Martin Stevens a.k.a. Budgester
http://www.budgester.com
P.S. To all the newbies, keep at it, and have a look at the
useless python site, there is some of my code on it
that is really simple.
Rob, just an idea how about giving the scripts a grade of
simple to complex ?
From rick@niof.net Sat Jun 2 22:43:07 2001
From: rick@niof.net (Rick Pasotto)
Date: Sat, 2 Jun 2001 17:43:07 -0400
Subject: [Tutor] Mailing List.
In-Reply-To: <20010602225439.A17781@budgester.com>; from budgester@budgester.com on Sat, Jun 02, 2001 at 10:54:39PM +0100
References: <20010602225439.A17781@budgester.com>
Message-ID: <20010602174307.A2841@tc.niof.net>
On Sat, Jun 02, 2001 at 10:54:39PM +0100, Martin Stevens wrote:
>
> BTW I'm using Mutt on Debian, so there maybe a way of replying
> to the list automatically.
Put in your .muttrc
subscribe tutor
and then when you want to reply press 'L' (that's capital-L)
for List-reply.
--
If man were perfect, if he were infallible, society would present
a very different kind of harmony from that which we may actually
expect it to offer us. Our idea of harmony is not Fourier's. It
does not exclude the existence of evil; it leaves room for
discord; and yet we shall recognize that harmony nonetheless
exists, provided that discord serves to prepare the way and to
lead us back to harmony.
-- Frédéric Bastiat (1801-1850)
Rick Pasotto rickp@telocity.com http://www.niof.net
From rickyp1@frontiernet.net Sat Jun 2 22:50:37 2001
From: rickyp1@frontiernet.net (Ricky Parks)
Date: Sat, 2 Jun 2001 16:50:37 -0500
Subject: [Tutor] Prompt
Message-ID: <003401c0ebae$0fd618a0$6601a8c0@Parks>
This is a multi-part message in MIME format.
------=_NextPart_000_0031_01C0EB84.26615FA0
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Thank you all for the suport. My bigest problem right now is getiing the =
software to run. I downloaded python 2.0 Windows Installer from the =
python.org web site. I am still having a problem with the prompt screen =
closing too fast I can even read what is says! =20
------=_NextPart_000_0031_01C0EB84.26615FA0
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Thank you all for the suport. My bigest =
problem=20
right now is getiing the software to run. I downloaded python 2.0=20
Windows Installer from the python.org web site. I am still having a =
problem with the prompt screen closing too fast I can =
even read=20
what is says!
------=_NextPart_000_0031_01C0EB84.26615FA0--
From bdupire@seatech.fau.edu Sat Jun 2 23:10:47 2001
From: bdupire@seatech.fau.edu (Benoit Dupire)
Date: Sat, 02 Jun 2001 18:10:47 -0400
Subject: [Tutor] Prompt
References: <003401c0ebae$0fd618a0$6601a8c0@Parks>
Message-ID: <3B196467.D2A98C5A@seatech.fau.edu>
--------------A213E01662C4705C0DE07A03
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
I think we need some more indications to answer your question.....
What are you trying to do to get a prompt screen in Windows ?
if you have installed python 2.0 on Windows, you should have in Start >
Programs> Python 2.0 the following icons:
* IDLE (GUI)
* Command line
* Python manuals
* Uninstall Python
if you click on the first one, a windows pops up, where you can enter
Python commands interactively.
If you click on the second one, a MS DOS command windows pops up, where
you can enter Python commands interactively too.
But it's not closing when you enter a command, such as 3+5.
What have you done so far ?
Ricky Parks wrote:
> Thank you all for the suport. My bigest problem right now is getiing
> the software to run. I downloaded python 2.0 Windows Installer from
> the python.org web site. I am still having a problem with the prompt
> screen closing too fast I can even read what is says!
--
Benoit Dupire
--------------A213E01662C4705C0DE07A03
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit
I think we need some more indications to answer your question.....
What are you trying to do to get a prompt screen in Windows ?
if you have installed python 2.0 on Windows, you should have in Start
> Programs> Python 2.0 the following icons:
* IDLE (GUI)
* Command line
* Python manuals
* Uninstall Python
if you click on the first one, a windows pops up, where you can enter
Python commands interactively.
If you click on the second one, a MS DOS command windows pops up, where
you can enter Python commands interactively too.
But it's not closing when you enter a command, such as 3+5.
What have you done so far ?
Ricky Parks wrote:
Thank
you all for the suport. My bigest problem right now is getiing the software
to run. I downloaded python 2.0 Windows Installer from the python.org web
site. I am still having a problem with the prompt screen closing
too fast I can even read what is says!
--
Benoit Dupire
--------------A213E01662C4705C0DE07A03--
From bdupire@seatech.fau.edu Sat Jun 2 23:22:31 2001
From: bdupire@seatech.fau.edu (Benoit Dupire)
Date: Sat, 02 Jun 2001 18:22:31 -0400
Subject: [Tutor] Off Topic - tutor@pyhon.org FAQ?
References: <5104D4DBC598D211B5FE0000F8FE7EB20751D7EC@mbtlipnt02.btlabs.bt.co.uk>
Message-ID: <3B196727.7C4FA55D@seatech.fau.edu>
alan.gauld@bt.com wrote:
> > If one does not exist I would be willing to contribute my
> > time.
>
> You said the magic words.
> Feel free, I'm pretty sure there iusn't a tutor-faq yet
> and yes we do get a lot of duplication. Just nobody
> else has time...
>
> So I say go for it.
>
> Alan G.
yep.. i began to do such a faq !!!! (but i am late at reading the tutor
list!)
my first idea was to sumarize the most common threads..
and the best answers
but I quickly stopped, because i found that
http://python.faqts.com
looks a lot like what i was looking for......
the first draft (quite basic) of what i did is at
http://www.oe.fau.edu/~bdupire/python/index.html
but i figured out i wouldn't have enough time....
All suggestions are welcome...
Alan, you can of course use what i did if you want....
>
>
> _______________________________________________
> Tutor maillist - Tutor@python.org
> http://mail.python.org/mailman/listinfo/tutor
--
Benoit Dupire
From sarnold@earthling.net Sat Jun 2 23:25:37 2001
From: sarnold@earthling.net (Stephen L Arnold)
Date: Sat, 2 Jun 2001 15:25:37 -0700
Subject: [Tutor] Prompt
In-Reply-To: <003401c0ebae$0fd618a0$6601a8c0@Parks>
Message-ID: <20010602222538.4E8F11F62A@shiva.arnolds.bogus>
On 2 Jun 01, at 16:50, Ricky Parks wrote:
> Thank you all for the suport. My bigest problem right now is
> getiing the software to run. I downloaded python 2.0 Windows
> Installer from the python.org web site. I am still having a
> problem with the prompt screen closing too fast I can even read
> what is says!
Are you calling a script from the Start|Run menu, from a DOS box,
or IDLE? I'm not sure I can visualize what you're doing. If the
pythonwin interface is dying right away, then there's a problem.
You might have a corrupted installation, dll problems, etc. You
could try the old un-installing/re-installing trick...
You might want to try the ActiveState Python distribution for
win32. Check out:
http://aspn.activestate.com/ASPN/Downloads/ActivePython/
for nice windoze installers for both Python 2.0 and 2.1 (and their
Komodo IDE is pretty cool, but it needs some horsepower to run
well).
Steve
************************************************
Steve Arnold CLE (Certifiable Linux Evangelist)
http://arnolds.dhs.org
From budgester@budgester.com Sat Jun 2 23:54:05 2001
From: budgester@budgester.com (Martin Stevens)
Date: Sat, 2 Jun 2001 23:54:05 +0100
Subject: [Tutor] Mailing List.
In-Reply-To: <20010602174307.A2841@tc.niof.net>; from rick@niof.net on Sat, Jun 02, 2001 at 05:43:07PM -0400
References: <20010602225439.A17781@budgester.com> <20010602174307.A2841@tc.niof.net>
Message-ID: <20010602235405.A18003@budgester.com>
On Sat, Jun 02, 2001 at 05:43:07PM -0400, Rick Pasotto wrote:
> On Sat, Jun 02, 2001 at 10:54:39PM +0100, Martin Stevens wrote:
> >
> > BTW I'm using Mutt on Debian, so there maybe a way of replying
> > to the list automatically.
>
> Put in your .muttrc
>
> subscribe tutor
>
> and then when you want to reply press 'L' (that's capital-L)
> for List-reply.
>
That did the trick thanks !
From budgester@budgester.com Sun Jun 3 00:18:03 2001
From: budgester@budgester.com (Martin Stevens)
Date: Sun, 3 Jun 2001 00:18:03 +0100
Subject: [Tutor] Newbie Project
Message-ID: <20010603001803.A18034@budgester.com>
Hi all,
Okay I've had an idea and they are fairly rare !
A little while ago I was writing a python program
to update my diary entries on my website.
I'd got it 95% complete when my hard drive went down
and me with no backups (D'oh).
Whilst working on this project I learnt a bit about
python and found it quite a good project to learn on.
So when a few of the people on the list said they are new
to programming I thought about this project.
Now comes the idea, what i have done is put a bit of psuedo
code on my website that people learning python can contribute
to without getting overwhelmed by masses of code.
So anybody (even if you've just started) should be able to
contribute, but what I don't want to happen is the really good
people just pick it up and complete it in 2 hours :-) so how about
the Guru people adding to the Ideas section or adding a bit more
pseudo code to it so there are extra little challenges ?
Hopefully I'm not wasting peoples time with this. let me know
what you think.
Thanks
Martin Stevens.
BTW here's the URL http://www.budgester.com/diaryupdate.htm
From rickyp1@frontiernet.net Sun Jun 3 00:16:49 2001
From: rickyp1@frontiernet.net (Ricky Parks)
Date: Sat, 2 Jun 2001 18:16:49 -0500
Subject: [Tutor] Prompt 2
Message-ID: <002001c0ebba$1a4be600$6601a8c0@Parks>
This is a multi-part message in MIME format.
------=_NextPart_000_001D_01C0EB90.30DECE20
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
OK, I am going to tell you step by step what I do.I write an small =
program in a text editor, save it, there is a problem with my computer =
that make me have to associate these kinds of files every time I load it =
so I associate it with the Python (command line) and run it. That is =
when the prompt screen opens and then closes so fast that I can not read =
what is says. Could that have some thing to do with my properties =
setting? Python is so confusing to run compared to Qbasic, which I have =
been using.
Richard E. Parks 2 =20
------=_NextPart_000_001D_01C0EB90.30DECE20
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
OK, I am going to =
tell you step=20
by step what I do.I write an small program in a text editor, save it, =
there is a=20
problem with my computer that make me have to associate these kinds =
of=20
files every time I load it so I associate it with the Python (command =
line) and=20
run it. That is when the prompt screen opens and then closes so =
fast that I=20
can not read what is says. Could that have some thing to do with my =
properties=20
setting? Python is so confusing to run compared to Qbasic, which I have =
been=20
using.
=20
=
=20
=
=20
Richard E. Parks 2
------=_NextPart_000_001D_01C0EB90.30DECE20--
From tescoil@irtc.net Sun Jun 3 00:19:29 2001
From: tescoil@irtc.net (Tesla Coil)
Date: Sat, 02 Jun 2001 18:19:29 -0500
Subject: [Tutor] Prompt
References: <003401c0ebae$0fd618a0$6601a8c0@Parks>
Message-ID: <3B197481.CE8930C1@irtc.net>
On 2 June 2001, Ricky Parks wrote:
> I downloaded python 2.0 Windows Installer from the
> python.org web site. I am still having a problem
> with the prompt screen closing too fast I can even
> read what is says!
This would qualify for a Tutor FAQ, although I think
it's been a few months since it was last asked:
See:
http://mail.python.org/pipermail/tutor/2001-January/003073.html
and:
http://mail.python.org/pipermail/tutor/2001-January/003139.html
From cynic@mail.cz Sun Jun 3 00:17:33 2001
From: cynic@mail.cz (cynic@mail.cz)
Date: Sat, 2 Jun 2001 19:17:33 -0400
Subject: [Tutor] Newbie Project
Message-ID: <200106021917610.SM00784@m2w059>
what is the reasoning behing the idea of downloading the current webpage and
modifying it instead of interaction with a RDBMS or a flat file? Looks like the path suggested by you would require sort =
of an XML parser.
Original Message:
-----------------
From: Martin Stevens budgester@budgester.com
Date: Sun, 3 Jun 2001 00:18:03 +0100
To: tutor@python.org
Subject: [Tutor] Newbie Project
Hi all,
Okay I've had an idea and they are fairly rare !
A little while ago I was writing a python program
to update my diary entries on my website.
I'd got it 95% complete when my hard drive went down
and me with no backups (D'oh).
Whilst working on this project I learnt a bit about
python and found it quite a good project to learn on.
So when a few of the people on the list said they are new
to programming I thought about this project.
Now comes the idea, what i have done is put a bit of psuedo
code on my website that people learning python can contribute
to without getting overwhelmed by masses of code.
So anybody (even if you've just started) should be able to
contribute, but what I don't want to happen is the really good
people just pick it up and complete it in 2 hours :-) so how about
the Guru people adding to the Ideas section or adding a bit more
pseudo code to it so there are extra little challenges ?
Hopefully I'm not wasting peoples time with this. let me know
what you think.
Thanks
Martin Stevens.
BTW here's the URL http://www.budgester.com/diaryupdate.htm
_______________________________________________
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
--------------------------------------------------------------------
Mail2Web - Check your email from the web at
http://www.mail2web.com/ .
From budgester@budgester.com Sun Jun 3 00:59:42 2001
From: budgester@budgester.com (Martin Stevens)
Date: Sun, 3 Jun 2001 00:59:42 +0100
Subject: [Tutor] Newbie Project
In-Reply-To: <200106021917610.SM00784@m2w059>; from cynic@mail.cz on Sat, Jun 02, 2001 at 07:17:33PM -0400
References: <200106021917610.SM00784@m2w059>
Message-ID: <20010603005942.A18119@budgester.com>
On Sat, Jun 02, 2001 at 07:17:33PM -0400, cynic@mail.cz wrote:
> what is the reasoning behing the idea of downloading the current webpage and
> modifying it instead of interaction with a RDBMS or a flat file? Looks like the path suggested by you would require sort of an XML parser.
>
Ok, the way I had it working before was something along these lines.
The .htm file is basically a text file and I had a mark in it,
the .htm file was read in with readline(s) and the mark was replaced
with the new update and a new mark, then reuploaded, this was due to
not having any cgi availability on the web server, so while I was
downloading my e-mail I could run the program and update the diary.
The mark would be something like i.e. a html comment
that a browser would ignore.
The reason for using python was so that I could run it at work on
a windows machine, and at home on Linux, so it had to be cross
platform and the only place that I could guarantee had the most
recent version of my diary was the actual web page itself.
As for XML, I don't really know a great deal about it, I suppose
i should really look into it, but this solution worked fine for
my purposes and I thought it might be of use to other people.
(I also hate web based forms ;-)
From gman_95@hotmail.com Sun Jun 3 00:52:15 2001
From: gman_95@hotmail.com (Daryl G)
Date: Sat, 02 Jun 2001 23:52:15 -0000
Subject: [Tutor] Saving and loading data to/from files
Message-ID:
Hi, I am having difficulty in saving and loading data that I created in a
simple Address book program. I am using 3 list variables for First and Last
name and phone number and an interger that counts the total number of
entries. I first tried using the 'write' but that wouldn't work with lists.
I discovered the pickle module and
I am able to save my data, but when I load it back up and then try to view
it in my program, its not there.
variables
import pickle, string
F_Name=[]
L_Name=[]
PH_num=[]
total=0
#savedata method
def savedata():
filename= raw_input("Enter the name you wish to give this address book:
")
object=(F_Name, L_Name, PH_num, total)
file=open(filename, 'w')
pickle.dump(object, file)
#opendata method
def opendata():
filename=raw_input("Enter the name of the Addressbook you wish to open:
")
file = open(filename,'r')
(F_Name,L_Name, PH_num, total)=pickle.load(file)
What am I doing wrong?
Another question that I have is how do I format data that I want to display
in specific
columns in standerd output, like that can be done in C ?
Thanks
Daryl
_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com
From cynic@mail.cz Sun Jun 3 01:36:09 2001
From: cynic@mail.cz (cynic@mail.cz)
Date: Sat, 2 Jun 2001 20:36:09 -0400
Subject: [Tutor] Newbie Project
Message-ID: <200106022036909.SM00692@m2w033>
ok, that sounds reasonable. as long as you don't need to update anything previously inserted, I guess. but that wasn't th=
e goal, right?
Original Message:
-----------------
From: Martin Stevens budgester@budgester.com
Date: Sun, 3 Jun 2001 00:59:42 +0100
To: tutor@python.org
Subject: Re: [Tutor] Newbie Project
On Sat, Jun 02, 2001 at 07:17:33PM -0400, cynic@mail.cz wrote:
> what is the reasoning behing the idea of downloading the current webpage and
> modifying it instead of interaction with a RDBMS or a flat file? Looks like the path suggested by you would require sor=
t of an XML parser.
>
Ok, the way I had it working before was something along these lines.
The .htm file is basically a text file and I had a mark in it,
the .htm file was read in with readline(s) and the mark was replaced
with the new update and a new mark, then reuploaded, this was due to
not having any cgi availability on the web server, so while I was
downloading my e-mail I could run the program and update the diary.
The mark would be something like i.e. a html comment
that a browser would ignore.
The reason for using python was so that I could run it at work on
a windows machine, and at home on Linux, so it had to be cross
platform and the only place that I could guarantee had the most
recent version of my diary was the actual web page itself.
As for XML, I don't really know a great deal about it, I suppose
i should really look into it, but this solution worked fine for
my purposes and I thought it might be of use to other people.
(I also hate web based forms ;-)
_______________________________________________
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
--------------------------------------------------------------------
Mail2Web - Check your email from the web at
http://www.mail2web.com/ .
From deirdre@deirdre.net Sun Jun 3 01:36:46 2001
From: deirdre@deirdre.net (Deirdre Saoirse Moen)
Date: Sat, 2 Jun 2001 17:36:46 -0700
Subject: [Tutor] Mailing List.
In-Reply-To: <20010602225439.A17781@budgester.com>
References: <20010602225439.A17781@budgester.com>
Message-ID:
>On another list I belong to they have set the Reply-to
>address as the list address, is there a reason we don't
>do this ?
Yes -- because it's a bad idea.
http://www.unicom.com/pw/reply-to-harmful.html
http://marc.merlins.org/perso/listreplyto.txt
--
_Deirdre Stash-o-Matic: http://weirdre.com http://deirdre.net
Macintosh Developer (seeking work): Will work for Cocoa
"I love deadlines. I like the whooshing sound they make as they fly by."
- Douglas Adams
From budgester@budgester.com Sun Jun 3 02:07:14 2001
From: budgester@budgester.com (Martin Stevens)
Date: Sun, 3 Jun 2001 02:07:14 +0100
Subject: [Tutor] Mailing List.
In-Reply-To: ; from deirdre@deirdre.net on Sat, Jun 02, 2001 at 05:36:46PM -0700
References: <20010602225439.A17781@budgester.com>
Message-ID: <20010603020714.A18507@budgester.com>
On Sat, Jun 02, 2001 at 05:36:46PM -0700, Deirdre Saoirse Moen wrote:
> >On another list I belong to they have set the Reply-to
> >address as the list address, is there a reason we don't
> >do this ?
>
> Yes -- because it's a bad idea.
>
> http://www.unicom.com/pw/reply-to-harmful.html
>
> http://marc.merlins.org/perso/listreplyto.txt
>
Ooops, Ok read that, and I'll go back and hide under my rock again :-)
Found the group reply option in mutt now.
From budgester@budgester.com Sun Jun 3 02:12:36 2001
From: budgester@budgester.com (Martin Stevens)
Date: Sun, 3 Jun 2001 02:12:36 +0100
Subject: [Tutor] Newbie Project
In-Reply-To: <200106022036909.SM00692@m2w033>; from cynic@mail.cz on Sat, Jun 02, 2001 at 08:36:09PM -0400
References: <200106022036909.SM00692@m2w033>
Message-ID: <20010603021236.B18507@budgester.com>
On Sat, Jun 02, 2001 at 08:36:09PM -0400, cynic@mail.cz wrote:
> ok, that sounds reasonable. as long as you don't need to update anything previously inserted, I guess. but that wasn't the goal, right?
>
You've got it, probably didn't explain it right in the code, I'll add a bit
on the webpage.
BTW what do you think of the actual idea of helping newbies collaborate
on a basic project like this in pricipal ? If there are other small projects
like this that people think of I'd be happy to host them as something like
sourceforge always seems a bit intimidating, then when they are
completed/working we could transfer them over to robs useless python
site.
From cynic@mail.cz Sun Jun 3 02:00:47 2001
From: cynic@mail.cz (cynic@mail.cz)
Date: Sat, 2 Jun 2001 21:00:47 -0400
Subject: [Tutor] Prompt 2
Message-ID: <200106022100369.SM00824@m2w060>
I haven't read the previous thread, but this looks like it's not a prompt, but a console window. I suggest you start a co=
nsole _prior to_ starting the program (i. e. run command.com and type e. g. C:\>path\to\your\app>myapp.py), or create a b=
atch for it, and make sure the "close when finished" (I don't know the exact english desc., and the only win9x sytem I ha=
ve at reach is localized) checkbox is unchecked.
Original Message:
-----------------
From: Ricky Parks rickyp1@frontiernet.net
Date: Sat, 2 Jun 2001 18:16:49 -0500
To: Tutor@python.org
Subject: [Tutor] Prompt 2
OK, I am going to tell you step by step what I do.I write an small program in a text editor, save it, there is a prob=
lem with my computer that make me have to associate these kinds of files every time I load it so I associate it with the =
Python (command line) and run it. That is when the prompt screen opens and then closes so fast that I can not read what i=
s says. Could that have some thing to do with my properties setting? Python is so confusing to run compared to Qbasic, wh=
ich I have been using.
Richard E. Parks 2
--------------------------------------------------------------------
Mail2Web - Check your email from the web at
http://www.mail2web.com/ .
From cynic@mail.cz Sun Jun 3 02:03:44 2001
From: cynic@mail.cz (cynic@mail.cz)
Date: Sat, 2 Jun 2001 21:03:44 -0400
Subject: [Tutor] Newbie Project
Message-ID: <200106022103123.SM00776@m2w049>
I think it's a neat idea. After all, everybody's newcomer in some field through the whole life. And Python is probably th=
e best language to learn programming around.
Original Message:
-----------------
From: Martin Stevens budgester@budgester.com
Date: Sun, 3 Jun 2001 02:12:36 +0100
To: cynic@mail.cz, tutor@python.org
Subject: Re: Re: [Tutor] Newbie Project
On Sat, Jun 02, 2001 at 08:36:09PM -0400, cynic@mail.cz wrote:
> ok, that sounds reasonable. as long as you don't need to update anything previously inserted, I guess. but that wasn't =
the goal, right?
>
You've got it, probably didn't explain it right in the code, I'll add a bit
on the webpage.
BTW what do you think of the actual idea of helping newbies collaborate
on a basic project like this in pricipal ? If there are other small projects
like this that people think of I'd be happy to host them as something like
sourceforge always seems a bit intimidating, then when they are
completed/working we could transfer them over to robs useless python
site.
--------------------------------------------------------------------
Mail2Web - Check your email from the web at
http://www.mail2web.com/ .
From cynic@mail.cz Sun Jun 3 02:11:25 2001
From: cynic@mail.cz (cynic@mail.cz)
Date: Sat, 2 Jun 2001 21:11:25 -0400
Subject: [Tutor] Saving and loading data to/from files
Message-ID: <20010602211163.SM00804@m2w061>
Hi there,
I'm not very familiar with Python, but IIRC pickle is meant for serializing data, which is not the same as general persis=
tance using files, databases and alike. I'd suggest you use a csv file to save your addresses, read the file a line at a =
time, and split it into your variables. the file would look st. like this:
XXXXXXXXX start of file XXXXXXXXXXX
Doe;Joe;123456
Black;Tom;987654
Clinton;Bill;111222
XXXXXXXXX end of file XXXXXXXXXXX
Original Message:
-----------------
From: Daryl G gman_95@hotmail.com
Date: Sat, 02 Jun 2001 23:52:15 -0000
To: tutor@python.org
Subject: [Tutor] Saving and loading data to/from files
Hi, I am having difficulty in saving and loading data that I created in a
simple Address book program. I am using 3 list variables for First and Last
name and phone number and an interger that counts the total number of
entries. I first tried using the 'write' but that wouldn't work with lists.
I discovered the pickle module and
I am able to save my data, but when I load it back up and then try to view
it in my program, its not there.
variables
import pickle, string
F_Name=3D[]
L_Name=3D[]
PH_num=3D[]
total=3D0
#savedata method
def savedata():
filename=3D raw_input("Enter the name you wish to give this address book:
")
object=3D(F_Name, L_Name, PH_num, total)
file=3Dopen(filename, 'w')
pickle.dump(object, file)
#opendata method
def opendata():
filename=3Draw_input("Enter the name of the Addressbook you wish to open:
")
file =3D open(filename,'r')
(F_Name,L_Name, PH_num, total)=3Dpickle.load(file)
What am I doing wrong?
Another question that I have is how do I format data that I want to display
in specific
columns in standerd output, like that can be done in C ?
Thanks
Daryl
_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com
_______________________________________________
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
--------------------------------------------------------------------
Mail2Web - Check your email from the web at
http://www.mail2web.com/ .
From sarnold@earthling.net Sun Jun 3 02:12:37 2001
From: sarnold@earthling.net (Stephen L Arnold)
Date: Sat, 2 Jun 2001 18:12:37 -0700
Subject: [Tutor] Prompt 2
In-Reply-To: <002001c0ebba$1a4be600$6601a8c0@Parks>
Message-ID: <20010603011238.2500A1F62A@shiva.arnolds.bogus>
On 2 Jun 01, at 18:16, Ricky Parks wrote:
> Python is so confusing to run compared to Qbasic, which I
> have been using.
Have you guys tried running things from within PythonWin or Komodo
initially? At least until it's working to your satisfaction (then
you can call it with pythonw.exe). You should be able to run some
things inter-actively, as well as run script files directly. Of
course, I'm using the ActiveState Python 2.0 build 203, but it
works for me.
Steve
*************************************************************
Steve Arnold http://arnolds.dhs.org
Things go better with Linux and King Crimson.
From dyoo@hkn.eecs.berkeley.edu Sun Jun 3 02:33:35 2001
From: dyoo@hkn.eecs.berkeley.edu (Daniel Yoo)
Date: Sat, 2 Jun 2001 18:33:35 -0700 (PDT)
Subject: [Tutor] Ok
In-Reply-To:
Message-ID:
On Sat, 2 Jun 2001, Tim Peters wrote:
> [Ricky Parks]
> > Ok, I am going to stick with it, I will say this agian I am a
> > beginer an know nothing about programming, so half the stuff that is
> > sent I will not undersand! Thank you.
>
> If you only see stuff you already understand, how would you learn? I've
> been programming for decades, and I don't understand half of what I see
> either: it's a very big world out there .
>
> Questions at all levels are welcome here. So if the list goes through
> a period where everything seems over your head, feel free to start new
> topics on things *you're* wondering about! The biggest problem
And stop us when we start sounding really incomprehensible! That probably
means that we're not doing a good job in explaining things.
Good luck to you.
From gman_95@hotmail.com Sun Jun 3 02:47:32 2001
From: gman_95@hotmail.com (Daryl G)
Date: Sun, 03 Jun 2001 01:47:32 -0000
Subject: [Tutor] Saving and loading data to/from files
Message-ID:
Hi,
Unfortunatly, I don't know what a csv file is -sorry. I have tried the one
line at a time approach, but from I could tell python wouldn't allow this
wiht the list type. At least not with the file.write() .
It would give an error with list variable. It said it was a read only
character buffer. The write method only works with primitive types; not
lists, tuples, or dictionarys.
I have, however, discovered that it is infact reading in the data from a
file when I am using the pickle method. I verified this by adding a print
statement in my opendata method and it showed that it had read in the data.
The problem appears to be in my function that displays the information. I
can't figure out why it doesn't work
Thanks.
#listdata method to display contents of Address book
#will display info if just added, but will not display info if just
#loaded from a file
def listdata():
i=0
total=len(L_Name)
print total
print "Names and phone numbers in database so far"
print
print """Last Name First Name PH#"""
for i in range(total):
print L_Name[i],
print " ",F_Name[i],
print "\t\t",PH_num[i]
>From: "cynic@mail.cz"
>Reply-To: cynic@mail.cz
>To: "gman_95@hotmail.com" , "tutor@python.org"
>
>Subject: RE: [Tutor] Saving and loading data to/from files
>Date: Sat, 2 Jun 2001 21:11:25 -0400
>
>Hi there,
>
>I'm not very familiar with Python, but IIRC pickle is meant for serializing
>data, which is not the same as general persistance using files, databases
>and alike. I'd suggest you use a csv file to save your addresses, read the
>file a line at a time, and split it into your variables. the file would
>look st. like this:
>
>XXXXXXXXX start of file XXXXXXXXXXX
>Doe;Joe;123456
>Black;Tom;987654
>Clinton;Bill;111222
>XXXXXXXXX end of file XXXXXXXXXXX
>
>
>Original Message:
>-----------------
>From: Daryl G gman_95@hotmail.com
>Date: Sat, 02 Jun 2001 23:52:15 -0000
>To: tutor@python.org
>Subject: [Tutor] Saving and loading data to/from files
>
>
>Hi, I am having difficulty in saving and loading data that I created in a
>simple Address book program. I am using 3 list variables for First and
>Last
>name and phone number and an interger that counts the total number of
>entries. I first tried using the 'write' but that wouldn't work with
>lists.
>I discovered the pickle module and
>I am able to save my data, but when I load it back up and then try to view
>it in my program, its not there.
>
>variables
>import pickle, string
>
>F_Name=[]
>L_Name=[]
>PH_num=[]
>total=0
>
>#savedata method
>def savedata():
> filename= raw_input("Enter the name you wish to give this address
>book:
>")
> object=(F_Name, L_Name, PH_num, total)
> file=open(filename, 'w')
> pickle.dump(object, file)
>
>#opendata method
>def opendata():
> filename=raw_input("Enter the name of the Addressbook you wish to
>open:
>")
> file = open(filename,'r')
> (F_Name,L_Name, PH_num, total)=pickle.load(file)
>
>
>What am I doing wrong?
>Another question that I have is how do I format data that I want to display
>in specific
>columns in standerd output, like that can be done in C ?
>Thanks
>Daryl
>_________________________________________________________________
>Get your FREE download of MSN Explorer at http://explorer.msn.com
>
>
>_______________________________________________
>Tutor maillist - Tutor@python.org
>http://mail.python.org/mailman/listinfo/tutor
>
>--------------------------------------------------------------------
>Mail2Web - Check your email from the web at
>http://www.mail2web.com/ .
>
_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com
From rear@sirius.com Sun Jun 3 03:05:53 2001
From: rear@sirius.com (Bob Rea)
Date: Sat, 2 Jun 2001 19:05:53 -0700
Subject: [Tutor] Ok
In-Reply-To:
References:
Message-ID: <01060219055304.00987@gandalf>
On Saturday 02 June 2001 06:33 pm, Danny Yoo wrote:
> And stop us when we start sounding really incomprehensible! That
> probably means that we're not doing a good job in explaining
> things.
Hmmm, well...
sometimes references on a topic might be useful to a newbie like me
like some references on basic algorithms for beginners?
very basic, please
sorting, for instance
--
Bob Rea
Freedom is only privilege extended
unless enjoyed by one and all
--Billy Bragg
rear@sirius.com http://www.sirius.com/~rear
From rick@niof.net Sun Jun 3 03:41:20 2001
From: rick@niof.net (Rick Pasotto)
Date: Sat, 2 Jun 2001 22:41:20 -0400
Subject: [Tutor] Ok
In-Reply-To: <01060219055304.00987@gandalf>; from rear@sirius.com on Sat, Jun 02, 2001 at 07:05:53PM -0700
References: <01060219055304.00987@gandalf>
Message-ID: <20010602224120.B2841@tc.niof.net>
On Sat, Jun 02, 2001 at 07:05:53PM -0700, Bob Rea wrote:
> On Saturday 02 June 2001 06:33 pm, Danny Yoo wrote:
> > And stop us when we start sounding really incomprehensible! That
> > probably means that we're not doing a good job in explaining
> > things.
>
> Hmmm, well...
> sometimes references on a topic might be useful to a newbie like me
> like some references on basic algorithms for beginners?
> very basic, please
> sorting, for instance
But sorting is an advanced topic, more suited to a lower level
programming language. If you are in fact a newbie, python's builtin
sorting is more than adequate for any tasks you are likely to tackle.
This list should be for learning *python* with a little bit of
programming technique thrown in.
YMMV
--
Political economy has not been given the mission of finding out
what society would be like if it had pleased God to make man
different from what he is. It may be regrettable that Providence,
at the beginning, neglected to seek the advice of some of our
modern reformers... if He had not disregarded the advice of
Fourier, the social order would have borne no resemblance to the
one in which we are obliged to live, breathe, and move about. But,
since we are in it, since we of live, move, and have our being in
it, our only recourse is to study it and to understand its laws,
especially if the improvement of our condition essentially depends
upon such knowledge.
-- Frédéric Bastiat (1801-1850)
Rick Pasotto rickp@telocity.com http://www.niof.net
From python_newbei@hotmail.com Sun Jun 3 04:47:25 2001
From: python_newbei@hotmail.com (sean schroeder)
Date: Sun, 03 Jun 2001 03:47:25 -0000
Subject: [Tutor] new to python...
Message-ID:
Hello,
I am a heavy Perl programmer and very interested in learning how to use
Python - mainly for the following type of tasks:
- cgi scripting
- databases access (mysql, oracle, postgress)
- Reading and writing to files.
I have begun using Perl's OOP functionality, but believe that Python is
better suited for the UML and OOPD methodologies that I have embarked on.
Last Note: is there a Python compiler avaialable for either Linux or NT?
So, with the above information in mind. I am looking for a resource that
will help me easily make the transition. More specifically I am looking for
a PDF or book that basically shows/explains how to mvoe from Perl to Python
as painlessly as possible.
thanks
Sean Schroeder
_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com
From dyoo@hkn.eecs.berkeley.edu Sun Jun 3 06:37:38 2001
From: dyoo@hkn.eecs.berkeley.edu (Daniel Yoo)
Date: Sat, 2 Jun 2001 22:37:38 -0700 (PDT)
Subject: [Tutor] Please?
In-Reply-To: <003d01c0eb95$6e56a340$6601a8c0@Parks>
Message-ID:
On Sat, 2 Jun 2001, Ricky Parks wrote:
> I am a beginner and I am unsubscribing to tuter because I am getting
> to many emails at once and none of them are helping me, could you
> posiblie try to teach personaly? I am realy eger to learn!
Dear Ricky,
If you're getting overwhelmed by tutor email, you can set the mailing list
up so it bundles the messages up into larger "digests". Visit:
http://mail.python.org/mailman/listinfo/tutor
and at the bottom of the page, you'll see something about editing your own
options.
That page also allows you to unsubscribe if you want.
Good luck to you.
From dyoo@hkn.eecs.berkeley.edu Sun Jun 3 07:06:23 2001
From: dyoo@hkn.eecs.berkeley.edu (Daniel Yoo)
Date: Sat, 2 Jun 2001 23:06:23 -0700 (PDT)
Subject: [Tutor] new to python... [transition from perl->python]
In-Reply-To:
Message-ID:
On Sun, 3 Jun 2001, sean schroeder wrote:
> I am a heavy Perl programmer and very interested in learning how to
> use Python - mainly for the following type of tasks:
> - cgi scripting
> - databases access (mysql, oracle, postgress)
> - Reading and writing to files.
You'll definitely want to look at the topic pages on Web (CGI) scripting
and Databases here:
http://python.org/topics/web/
http://python.org/topics/database/
There are introductions there that will help get you up to speed on this.
> Last Note: is there a Python compiler avaialable for either Linux or NT?
Not yet. I believe that a compiler for Microsoft's .NET platform is being
developed, so you might want to ask on comp.lang.python for more details
on that.
> So, with the above information in mind. I am looking for a resource
> that will help me easily make the transition. More specifically I am
> looking for a PDF or book that basically shows/explains how to mvoe
> from Perl to Python as painlessly as possible.
Hmmm... try the official tutorial:
http://python.org/doc/current/tut/tut.html
It assumes experience with a programming language like Perl or C++. The
other tutorials on:
http://python.org/doc/Intros.html
should also be helpful for you. After you go through the official
tutorial, you should be ok.
Here are a list of some caveats in the transition from Perl to Python:
String interpolation --- Python doesn't automatically interpolate into
strings: there's a separate string formatting operator '%'. So, for
example, in Perl, we could do something like this:
###
$name = "sean";
$sentence = "Hello $name";
###
The equivalent in Python would be:
###
name = "sean"
sentence = "Hello %s" % (name)
###
The official tutorial touches on this under the "Fancier Output
Formatting" topic:
http://python.org/doc/current/tut/node9.html#SECTION009100000000000000000
Integer Division --- Python has a distinction between integer division and
floating point division. It's different in Perl, since Perl uses floating
point throughout.
###
half = 1 / 2
###
won't assign .5 to our 'half' variable in Python --- we'll get 0.
String manipulation --- Python's uses the idea that strings are immutable,
so, if we have something like:
###
myline = "Hello, I am a line with a trailing newline.\n"
###
to get rid of that last character, we don't have Perl's chomp() operator,
but we do have something similar:
###
myline = myline.strip() ### Take off the trailing newline.
###
An alternative way to take off that last character includes:
###
myline = myline[:-1] ## Keep all but the last character
###
which you can think of almost like chop().
When you're working with Python, keep the immutability of strings in mind.
The tutorial will cover how do to string manipulation, so we'll leave the
details there.
Those are the big ones I can think of at the moment.
Hope this helps!
From dyoo@hkn.eecs.berkeley.edu Sun Jun 3 07:26:03 2001
From: dyoo@hkn.eecs.berkeley.edu (Daniel Yoo)
Date: Sat, 2 Jun 2001 23:26:03 -0700 (PDT)
Subject: [Tutor] Ok
In-Reply-To: <01060219055304.00987@gandalf>
Message-ID:
On Sat, 2 Jun 2001, Bob Rea wrote:
> On Saturday 02 June 2001 06:33 pm, Danny Yoo wrote:
> > And stop us when we start sounding really incomprehensible! That
> > probably means that we're not doing a good job in explaining
> > things.
>
> Hmmm, well...
> sometimes references on a topic might be useful to a newbie like me
> like some references on basic algorithms for beginners?
> very basic, please
> sorting, for instance
Donald Knuth's "Art of Computer Programming" is the book I look at when I
want to look at a reference, but it's REALLY DENSE reading. I do not
recommend his book if you're just starting out on programming. His books
are very good (and they have beautiful typography), but the can also be a
little intimidating at first. *grin*
Hmmm... if you want to see some Computer Science ideas, there's a nice
book called "How to Think Like a Computer Scientist", by Allen Downey:
http://www.ibiblio.org/obp/
which introduces these ideas using Python; I've heard good things about
this book, so feel free to take a look at it.
Usually though, we don't focus on algorithms as much as on using Python
effectively. When a task looks like it needs an algorithm, we try to
direct people toward things that do most of the hard work for them. For
example, in sorting a list of names, we can take advantage of the sort()
that the list already knows about:
###
>>> stooges = ['larry', 'moe', 'curly']
>>> stooges.sort()
>>> stooges
['curly', 'larry', 'moe']
###
If you have any questions, feel free to ask us at tutor!
From sburr@mac.com Sun Jun 3 07:35:12 2001
From: sburr@mac.com (Steven Burr)
Date: Sat, 2 Jun 2001 23:35:12 -0700
Subject: [Tutor] bitwise operations
In-Reply-To: <8551136CB6F6D311811B00508B8B92E0C897C0@mail.rpmtec.com>
Message-ID: <20010603063340.FIRW12680.femail19.sdc1.sfba.home.com@localhost>
On Friday, June 1, 2001, at 06:53 AM, Blake Winton (Screaming) wrote:
>>> Could anyone tell me all there is to know about bit
>>> manipulation;
>> No, I doubt it. I don'ty think anyone has figured
>> that out yet... Some things you might like to do
>> a search on the net for are 'Boolean Algenra'
>> and 'Bitmasks'
>
> Okay, but surely we could give Craig a short overview...
I'm writing mostly to thank Craig for asking this question, which I've
also wondered about, and Blake for writing his "short" overview, which
was one of the clearest explanations of a difficult topic I've read on
this list. And that's saying something.
But I also wanted to mention that in making my way through the
wonderful 2nd ed. of "Programming Python," I came across another
interesting example of using bitwise operations. Some of the functions
in the os module, such as os.system, return a 2 byte (16 bit) integer
that packs the exit status of the function in the "high" (i.e.
left-hand) byte and the the number of the signal that killed the
function in the low byte. So if you need to know the exit status of a
process (which apparently can be useful in "inter-process
communications"), you nab this return value and shift it 8 bits to the
right.
Suppose for example you have the following script in a file named
graucho.py:
import sys
print "Hello, I must be going."
sys.exit(42)
You can call it, grab its return value and extract the exit status like
so:
>>> import os
>>> ret = os.system('python graucho.py')
Hello, I must be going.
>>> ret >> 8
42
From rob@jam.rr.com Sun Jun 3 07:41:55 2001
From: rob@jam.rr.com (Rob Andrews)
Date: Sun, 03 Jun 2001 01:41:55 -0500
Subject: [Tutor] new to python...
References:
Message-ID: <3B19DC33.AFAA0322@jam.rr.com>
sean schroeder wrote:
>
> Hello,
>
> I am a heavy Perl programmer and very interested in learning how to use
> Python - mainly for the following type of tasks:
> - cgi scripting
> - databases access (mysql, oracle, postgress)
> - Reading and writing to files.
>
> I have begun using Perl's OOP functionality, but believe that Python is
> better suited for the UML and OOPD methodologies that I have embarked on.
>
> Last Note: is there a Python compiler avaialable for either Linux or NT?
>
> So, with the above information in mind. I am looking for a resource that
> will help me easily make the transition. More specifically I am looking for
> a PDF or book that basically shows/explains how to mvoe from Perl to Python
> as painlessly as possible.
>
> thanks
> Sean Schroeder
>
You might want to check these out. This is a page of links to tutorials,
accompanied by brief descriptions of each. Some are designed with Perl
programmers and the like in mind:
http://www.lowerstandard.com/python/tutoriallinks.html
Python is great for working with CGI and other forms of web programming.
You may be interested in *Programming Python, 2nd edition* once you
become somewhat familiar with Python. It covers the areas you expressed
interest in with some considerable detail, in a tutorial style.
Rob
--
Useless Python!
Kinda like the AOL of the Open Source Community 3;->
http://www.lowerstandard.com/python/index.html
From dyoo@hkn.eecs.berkeley.edu Sun Jun 3 09:52:34 2001
From: dyoo@hkn.eecs.berkeley.edu (Daniel Yoo)
Date: Sun, 3 Jun 2001 01:52:34 -0700 (PDT)
Subject: [Tutor] Saving and loading data to/from files
In-Reply-To:
Message-ID:
On Sun, 3 Jun 2001, Daryl G wrote:
> Unfortunatly, I don't know what a csv file is -sorry. I have tried the one
A "csv" file is a file where all the fields as separated by commas. It's
nice to save data like this because it's fairly easy to separate a
comma-separated line back into its pieces:
###
>>> line = 'Daryl,gman_95@hotmail.com,tutor@python.org'
>>> user, email, mailing_list = string.split(line, ',')
>>> user, email, mailing_list
('Daryl', 'gman_95@hotmail.com', 'tutor@python.org')
###
I'm not quite sure what each of the letters stand for though. Comma
Separated... Vormat? *grin* Many programs know how to write their output
in csv format. For example, Microsoft Excel knows how to write
spreadsheets in csv.
This message will be long, but don't skip it because I think I found the
bug in your program.
> Unfortunatly, I don't know what a csv file is -sorry. I have tried the
> one line at a time approach, but from I could tell python wouldn't
> allow this wiht the list type. At least not with the file.write() . It
> would give an error with list variable. It said it was a read only
> character buffer. The write method only works with primitive types;
> not lists, tuples, or dictionarys.
Hmmm... can you show us how you're writing to the file? That'll help us
give advice on how to get things working.
> I have, however, discovered that it is infact reading in the data from
> a file when I am using the pickle method. I verified this by adding a
> print statement in my opendata method and it showed that it had read
> in the data.
Ah, good!
> The problem appears to be in my function that displays the
> information. I can't figure out why it doesn't work Thanks.
Ok, let's take a look.
> #listdata method to display contents of Address book
> #will display info if just added, but will not display info if just
> #loaded from a file
>
> def listdata():
> i=0
> total=len(L_Name)
> print total
> print "Names and phone numbers in database so far"
> print
> print """Last Name First Name PH#"""
>
> for i in range(total):
> print L_Name[i],
> print " ",F_Name[i],
> print "\t\t",PH_num[i]
>From what I can tell, this looks ok. It's using global variables, which
always make me involuntarily nervous, but that's ok. *grin*
What I think is going on is exactly global variable stuff. Let's take a
look at the loading part of your program.
###
import pickle, string
F_Name=[]
L_Name=[]
PH_num=[]
total=0
# [some code cut]
#opendata method
def opendata():
filename=raw_input("Enter the name of the Addressbook you wish to
open:
")
file = open(filename,'r')
(F_Name,L_Name, PH_num, total)=pickle.load(file)
###
Yes, the bug that you're running into has to do with local variable stuff.
What I mean is that, in your opendata() function, you have the line:
(F_Name,L_Name, PH_num, total)=pickle.load(file)
In functions, Python will expect the variables inside to be "local", and
that means that any changes you make to variables inside opendata() stay
isolated from the rest of the program. Usually, this is a good thing,
because this sort of sandboxing keeps us from messing with another part of
a program accidently. And you're seeing this because, as long as we're in
opendata(), we can see that the file loaded successfully. But those
variables "outside" the sandbox, in Global-land, haven't been touched, so
that's why the listdata() doesn't show any changes.
In this case, what you want is to make the change to F_Name, L_name,
PH_num, and total to be "global", so that the rest of the program knows
that those variables changed. What you'll need to do is add the line:
global F_Name, L_Name, PH_num, total
at the very beginning of your opendata() function, which tells Python to
take off the sandbox for those specific variables. With this change, your
opendata() will look like this:
###
def opendata():
global F_Name, L_Name, PH_num, total
filename=raw_input("Enter the name of the Addressbook you wish to
open:
")
file = open(filename,'r')
(F_Name,L_Name, PH_num, total)=pickle.load(file)
###
and that should fix the bug.
Having said that, it's usually a good idea to avoid global variables.
There are usually good ways of rearranging things so that globals aren't
necessary... but we can talk about that on another message.
Hope this helps! If you have more questions, feel free to ask us.
From lonetwin@yahoo.com Sun Jun 3 11:04:16 2001
From: lonetwin@yahoo.com (steve)
Date: Sun, 3 Jun 2001 15:34:16 +0530
Subject: [Tutor] Prompt 2
In-Reply-To: <002001c0ebba$1a4be600$6601a8c0@Parks>
References: <002001c0ebba$1a4be600$6601a8c0@Parks>
Message-ID: <01060315334600.10411@mercury.in.cqsl.com>
Hey there Ricky,
> > OK, I am going to tell you step by step what I do.I write an smal=
l
> program in a text editor, save it, there is a problem with my computer =
that
> make me have to associate these kinds of files every time I load it so =
I
> associate it with the Python (command line) and run it. That is when th=
e
> prompt screen opens and then closes so fast that I can not read what is
> says. Could that have some thing to do with my properties setting? Pyth=
on
> is so confusing to run compared to Qbasic, which I have been using. Ric=
hard
> E. Parks 2
I've been looking at u r mails since u joined in....looks like u r one o=
f=20
the as-new-as-can be newbie :)....ok here's the reply to u r question:
B'fore I go to the exact answer, lemme explain a few things...
Python is a intepreted language, (I know u knew that...just trying to=
be=20
complete...don't get offended if something sounds insulting to u r=20
knowledge)...but unlike qbasic it has an interactive prompt intepreter to=
o,=20
this helps u to try each python statement interactively b4 u put it all=20
together in a file and make a total working program out of it.
When u invoke this, what u see is a ">>>" prompt with the version and o=
ther=20
info in a small window, that "looks" like the dos command prompt....on th=
e=20
other hand after writing the whole program, if u want to execute it what=20
"should" do is open a MS-DOS commond prompt (Start>Program Files>MS-DOS=20
Prompt) and type in
c:\[path-to-wherever]> python myproggy.py
This will execute u r file (assuming that python.exe is in ur path=20
variable, and u r within the same directory where u have stored ur file=20
[myproggy.py].
This brings us to what "I think" U are doing...u are creating the fil=
e,=20
saving it as myproggy.py, associating it with pytyhon and "double-clickin=
g"=20
it....what this does is calls the intepreter (b'cos of the=20
association)....executes the proggy (b'cos it is a nice, working python=20
program)...and "closes" the intepreter window ('cos it has nothing else t=
o do=20
)...now if u do wanna check if this is what is happening....that's simple=
,=20
insert the statement=20
raw_input() somewhere in u r program...what this will do is wait for u to=
=20
enter some-input followed by an enter...b4 going to the next statement...=
=2E
U'll know whats happening....hope this helps....if it doesn't or if somet=
hing=20
strange happens (like u r hard-disk goes up in flames) feel free to ask t=
he=20
tutor list again :)
Peace
Steve
P.S: the guys on this list are "very" helpful....change u r attitude, be=20
positive 'bout learning ...an' they'll be more than glad to help u out.
--=20
||||||||||||||||||||||
|||||||||#####||||||||
||||||||#######|||||||
||||||||# O O #|||||||
||||||||#\ ~ /#|||||||
||||||##||\_/||##|||||
|||||#||||||||||##||||
||||#||||||||||||##|||
||||#|||||||||||||##||=09
|||/\##|||||||||##/\||=09
|/ \#########/ \=09
|\ \#######/ /=09
||\____/#######\____/|=09
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=09
Hello. Just walk along and try NOT to think about your INTESTINES
being almost FORTY YARDS LONG!!
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
From lumbricus@gmx.net Sun Jun 3 11:10:29 2001
From: lumbricus@gmx.net (lumbricus@gmx.net)
Date: Sun, 3 Jun 2001 12:10:29 +0200
Subject: [Tutor] Mailing List.
In-Reply-To: <20010602174307.A2841@tc.niof.net>; from rick@niof.net on Sat, Jun 02, 2001 at 05:43:07PM -0400
References: <20010602225439.A17781@budgester.com> <20010602174307.A2841@tc.niof.net>
Message-ID: <20010603121029.A1744@Laplace.localdomain>
On Sat, Jun 02, 2001 at 05:43:07PM -0400, Rick Pasotto wrote:
> On Sat, Jun 02, 2001 at 10:54:39PM +0100, Martin Stevens wrote:
> >
> > BTW I'm using Mutt on Debian, so there maybe a way of replying
> > to the list automatically.
>
> Put in your .muttrc
>
> subscribe tutor
there is a line where you can
switch on a _Subject:_
in your header, too
good luck!!
>
> and then when you want to reply press 'L' (that's capital-L)
> for List-reply.
>
HTH Joe!
--
In order to discover who you are, first learn who everybody else is;
you're what's left.
From craig@osa.att.ne.jp Sun Jun 3 11:43:37 2001
From: craig@osa.att.ne.jp (Craig Hagerman)
Date: Sun, 03 Jun 2001 19:43:37 +0900
Subject: [Tutor] bitwise operations
Message-ID:
Hi,
I want to say a big thank you to Alan Gauld, Blake Winton (GREAT explanation
Blake) and Daniel Yoo for the excellant responses to my question about using
bitwise operations. I now have a very general, overview kind of
understanding about how and why one deals with bits. But I will have to play
around and give myself some simple learning tasks to work through to really
get a handle on this stuff. You guys have given me enough of an
understanding that I now have a place to start. Ironically, I just got a new
order of books from Amazon and was fliping though "A programmers guide to
Java Certification" and came upon a couple more simple examples of bit usage
(different language but the principle is the same).
Again, thanks for taking the time to impart your knowledge.
Craig Hagerman
From tescoil@irtc.net Sun Jun 3 11:49:16 2001
From: tescoil@irtc.net (Tesla Coil)
Date: Sun, 03 Jun 2001 05:49:16 -0500
Subject: [Tutor] Saving and loading data to/from files
References:
Message-ID: <3B1A162C.E897E397@irtc.net>
On 3 Jun 2001, Daniel Yoo wrote:
> I'm not quite sure what each of the letters stand
> for though. Comma Separated... Vormat? *grin*
Comma Separated Variable, or,
Computer Spreadsheet Vomitus,
depending on who you ask...
From arcege@speakeasy.net Sun Jun 3 12:52:12 2001
From: arcege@speakeasy.net (Michael P. Reilly)
Date: Sun, 3 Jun 2001 07:52:12 -0400 (EDT)
Subject: [Tutor] Saving and loading data to/from files
In-Reply-To: from "Daryl G" at Jun 02, 2001 11:52:15 PM
Message-ID: <200106031152.f53BqDK07773@dsl092-074-184.bos1.dsl.speakeasy.net>
Daryl G wrote
>
> Hi, I am having difficulty in saving and loading data that I created in a
> simple Address book program. I am using 3 list variables for First and Last
> name and phone number and an interger that counts the total number of
> entries. I first tried using the 'write' but that wouldn't work with lists.
> I discovered the pickle module and
> I am able to save my data, but when I load it back up and then try to view
> it in my program, its not there.
>
> variables
> import pickle, string
>
> F_Name=[]
> L_Name=[]
> PH_num=[]
> total=0
>
> #savedata method
> def savedata():
> filename= raw_input("Enter the name you wish to give this address book:
> ")
> object=(F_Name, L_Name, PH_num, total)
> file=open(filename, 'w')
> pickle.dump(object, file)
>
> #opendata method
> def opendata():
> filename=raw_input("Enter the name of the Addressbook you wish to open:
> ")
> file = open(filename,'r')
> (F_Name,L_Name, PH_num, total)=pickle.load(file)
>
>
> What am I doing wrong?
You are assigning to local variables in opendata() when the variables
are global in savedata. However you might want to think about passing
values, especially removing the raw_input() calls from the functions.
def opendata(filename):
global F_Name, L_Name, PH_num, total
file = open(filename, 'r')
(F_Name, L_Name, PH_num, total) = pickle.load(file)
Or better yet, returning the values:
def opendata(filename):
file = open(filename, 'r')
# assigning to all values catches the error of invalid data format
(F_Name, L_Name, PH_num, total) = pickle.load(file)
return (F_Name, L_Name, PH_num, total)
Pickle is fine for outputting single values, but for a database of
values (like an address) you will want to look at the shelve module
(which uses pickle and the *dbm modules, see "anydbm") or a relational
database (which could be overkill for an address book application).
> Another question that I have is how do I format data that I want to display
> in specific
> columns in standerd output, like that can be done in C ?
This is done with the string % operator. With an order sequence:
print '''Name: %s %s; Phone: %s''' % (F_Name, L_Name, PH_num)
or with a dictionary:
print '''Name: %(first)s %(last)s; Phone: %(phone)s''' % {
'first': F_Name, 'last': L_Name, 'phone': PH_num
}
The Python Library documention has all this. Much of it is actually
like C's sprintf.
-Arcege
--
+----------------------------------+-----------------------------------+
| Michael P. Reilly | arcege@speakeasy.net |
From arcege@speakeasy.net Sun Jun 3 12:53:23 2001
From: arcege@speakeasy.net (Michael P. Reilly)
Date: Sun, 3 Jun 2001 07:53:23 -0400 (EDT)
Subject: [Tutor] Ok
In-Reply-To: from "Daniel Yoo" at Jun 02, 2001 06:33:35 PM
Message-ID: <200106031153.f53BrNP07783@dsl092-074-184.bos1.dsl.speakeasy.net>
Daniel Yoo wrote
> And stop us when we start sounding really incomprehensible! That probably
> means that we're not doing a good job in explaining things.
Guilty, sometimes. ;)
-Arcege
--
+----------------------------------+-----------------------------------+
| Michael P. Reilly | arcege@speakeasy.net |
From lha2@columbia.edu Sun Jun 3 15:21:40 2001
From: lha2@columbia.edu (Lloyd Hugh Allen)
Date: Sun, 03 Jun 2001 10:21:40 -0400
Subject: [Tutor] Something to tack on to "Useless Python" challenges
Message-ID: <3B1A47F4.72959659@mail.verizon.net>
http://www.rsasecurity.com/rsalabs/challenges/factoring/numbers.html
Python should be up to the task...
Anyone have a module lying around for torking with arbitrarily large
numbers (in Python)?
From gman_95@hotmail.com Sun Jun 3 15:39:22 2001
From: gman_95@hotmail.com (Daryl G)
Date: Sun, 03 Jun 2001 14:39:22 -0000
Subject: [Tutor] Saving and loading data to/from files
Message-ID:
Yup, it was the global/local problem. I thought that since I had those
varibles declared globally, they would be scene everywere, but local
varibles take precedence. Forgot about that
The %s doesn't quite work right. If a name is shorter than another, then the
positions wont be right in my simple table. I guess I have to see if that
center() method will work for me.
example
LastName FirstName Phone#
Stephanopolis George 900-856-2992
Jo Mary 800-328-6387
is what I end up getting.
Thanks. I'll check that api doc
Computer Spreadsheet Vomitus. I love that. :)
>From: "Michael P. Reilly"
>Reply-To: arcege@speakeasy.net
>To: gman_95@hotmail.com (Daryl G)
>CC: tutor@python.org
>Subject: Re: [Tutor] Saving and loading data to/from files
>Date: Sun, 3 Jun 2001 07:52:12 -0400 (EDT)
>
>Daryl G wrote
> >
> > Hi, I am having difficulty in saving and loading data that I created in
>a
> > simple Address book program. I am using 3 list variables for First and
>Last
> > name and phone number and an interger that counts the total number of
> > entries. I first tried using the 'write' but that wouldn't work with
>lists.
> > I discovered the pickle module and
> > I am able to save my data, but when I load it back up and then try to
>view
> > it in my program, its not there.
> >
> > variables
> > import pickle, string
> >
> > F_Name=[]
> > L_Name=[]
> > PH_num=[]
> > total=0
> >
> > #savedata method
> > def savedata():
> > filename= raw_input("Enter the name you wish to give this address
>book:
> > ")
> > object=(F_Name, L_Name, PH_num, total)
> > file=open(filename, 'w')
> > pickle.dump(object, file)
> >
> > #opendata method
> > def opendata():
> > filename=raw_input("Enter the name of the Addressbook you wish to
>open:
> > ")
> > file = open(filename,'r')
> > (F_Name,L_Name, PH_num, total)=pickle.load(file)
> >
> >
> > What am I doing wrong?
>
>You are assigning to local variables in opendata() when the variables
>are global in savedata. However you might want to think about passing
>values, especially removing the raw_input() calls from the functions.
>
>def opendata(filename):
> global F_Name, L_Name, PH_num, total
> file = open(filename, 'r')
> (F_Name, L_Name, PH_num, total) = pickle.load(file)
>
>Or better yet, returning the values:
>def opendata(filename):
> file = open(filename, 'r')
> # assigning to all values catches the error of invalid data format
> (F_Name, L_Name, PH_num, total) = pickle.load(file)
> return (F_Name, L_Name, PH_num, total)
>
>Pickle is fine for outputting single values, but for a database of
>values (like an address) you will want to look at the shelve module
>(which uses pickle and the *dbm modules, see "anydbm") or a relational
>database (which could be overkill for an address book application).
>
> > Another question that I have is how do I format data that I want to
>display
> > in specific
> > columns in standerd output, like that can be done in C ?
>
>This is done with the string % operator. With an order sequence:
> print '''Name: %s %s; Phone: %s''' % (F_Name, L_Name, PH_num)
>or with a dictionary:
> print '''Name: %(first)s %(last)s; Phone: %(phone)s''' % {
> 'first': F_Name, 'last': L_Name, 'phone': PH_num
> }
>
>The Python Library documention has all this. Much of it is actually
>like C's sprintf.
>
>
> -Arcege
>
>--
>+----------------------------------+-----------------------------------+
>| Michael P. Reilly | arcege@speakeasy.net |
_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com
From sheila@thinkspot.net Sun Jun 3 16:01:18 2001
From: sheila@thinkspot.net (Sheila King)
Date: Sun, 03 Jun 2001 08:01:18 -0700
Subject: [Tutor] Saving and loading data to/from files
In-Reply-To: <3B1A162C.E897E397@irtc.net>
References: <3B1A162C.E897E397@irtc.net>
Message-ID: <1A07617500E0@kserver.org>
I thought it was
Comma Separated Values
--
Sheila King
http://www.thinkspot.net/sheila/
http://www.k12groups.org/
On Sun, 03 Jun 2001 05:49:16 -0500, Tesla Coil wrote
about Re: [Tutor] Saving and loading data to/from files:
:On 3 Jun 2001, Daniel Yoo wrote:
:> I'm not quite sure what each of the letters stand
:> for though. Comma Separated... Vormat? *grin*
:
:Comma Separated Variable, or,
:Computer Spreadsheet Vomitus,
:depending on who you ask...
:
:
:_______________________________________________
:Tutor maillist - Tutor@python.org
:http://mail.python.org/mailman/listinfo/tutor
From scarblac@pino.selwerd.nl Sun Jun 3 16:07:55 2001
From: scarblac@pino.selwerd.nl (Remco Gerlich)
Date: Sun, 3 Jun 2001 17:07:55 +0200
Subject: [Tutor] Something to tack on to "Useless Python" challenges
In-Reply-To: <3B1A47F4.72959659@mail.verizon.net>; from vze2f978@mail.verizon.net on Sun, Jun 03, 2001 at 10:21:40AM -0400
References: <3B1A47F4.72959659@mail.verizon.net>
Message-ID: <20010603170755.A23389@pino.selwerd.nl>
On 0, Lloyd Hugh Allen wrote:
> http://www.rsasecurity.com/rsalabs/challenges/factoring/numbers.html
>
> Python should be up to the task...
>
> Anyone have a module lying around for torking with arbitrarily large
> numbers (in Python)?
No need for a module in Python, it has long integers itself:
>>> 1000000000000000000000000L
1000000000000000000000000L
The problem here of course isn't Python or long integers, but an algorithm
that doesn't take time measured in ages of the universe...
I'll help you on your way: 2 is not a factor in any of the numbers. So now
you have one fewer prime to check! ;-)
--
Remco Gerlich
From arcege@speakeasy.net Sun Jun 3 16:12:04 2001
From: arcege@speakeasy.net (Michael P. Reilly)
Date: Sun, 3 Jun 2001 11:12:04 -0400 (EDT)
Subject: [Tutor] Saving and loading data to/from files
In-Reply-To: from "Daryl G" at Jun 03, 2001 02:39:22 PM
Message-ID: <200106031512.f53FC4k04685@dsl092-074-184.bos1.dsl.speakeasy.net>
Daryl G wrote
> The %s doesn't quite work right. If a name is shorter than another, then the
> positions wont be right in my simple table. I guess I have to see if that
> center() method will work for me.
You need to put the width/length specifies in (just like with C).
> example
> LastName FirstName Phone#
> Stephanopolis George 900-856-2992
> Jo Mary 800-328-6387
> is what I end up getting.
For this, the formatting string would be:
fmt = '''%(L_Name)-15.15s %(F_Name)-15.15s %(PH_num)s'''
Last name ("(L_Name)"), left justified ("-"), 15 characters wide (max
and min, "15.15") string ("s"); same for first name; the phone number
is an unrestricted string.
> Computer Spreadsheet Vomitus. I love that. :)
Actually, CSV means "comma-separated values" and it is more complicated
than just splitting on a comma: if the data has a comma, then the value
is quoted with double-quotes, but what if the value has a double-quote?
It is also only a textual format, not a data retrieval system; it is
one means used to transfer data between database systems. Usually the
first line is the field names. If you're interested, look for "ASV"
in the Vaults of Parnassus .
-Arcege
--
+----------------------------------+-----------------------------------+
| Michael P. Reilly | arcege@speakeasy.net |
From rick@niof.net Sun Jun 3 16:14:20 2001
From: rick@niof.net (Rick Pasotto)
Date: Sun, 3 Jun 2001 11:14:20 -0400
Subject: [Tutor] Saving and loading data to/from files
In-Reply-To: ; from gman_95@hotmail.com on Sun, Jun 03, 2001 at 02:39:22PM -0000
References:
Message-ID: <20010603111420.A29372@tc.niof.net>
On Sun, Jun 03, 2001 at 02:39:22PM -0000, Daryl G wrote:
> The %s doesn't quite work right. If a name is shorter than another,
> then the positions wont be right in my simple table. I guess I have to
> see if that center() method will work for me.
>
> example
> LastName FirstName Phone#
> Stephanopolis George 900-856-2992
> Jo Mary 800-328-6387
Use a width modifier with your %s spec. "%-20s" means to left justify
using at least 20 columns. Just make sure the width you use is as long
as the longest value. You can also use "%-*s" % (width,string) if you
want the width to be dynamic, ie, if you scan the list first to
determine the maximum lengths.
--
Is there any need to prove that this odious perversion of the law
is a perpetual cause of hatred, discord, and even social disorder?
Look at the United States. There is no country in the world where
the law confines itself more rigorously to its proper role, which
is to guarantee everyone's liberty and property. Accordingly,
there is no country in which the social order seems to rest on a
more stable foundation. Nevertheless, even in the United States
there are two questions, and only two, which since it was founded,
have several times put the political order in danger. And what are
these two questions? The question of slavery and that of tariffs,
that is, precisely the only two questions concerning which,
contrary to the general spirit of this republic, the law has
assumed a spoiliative character. Slavery is a violation, sanctioned
by law, of the rights of the person. Protective tariffs are a
violation, perpetrated by the law, of the right to property; and
certainly it is remarkable that in the midst of so many other
disputes this twofold legal scourge, a sad heritage from the Old
World, should be the only one that can and perhaps will lead to
the dissolution of the Union. It is, in fact, impossible to
imagine any graver situation in a society than one in which the
law becomes an instrument of injustice. And if this fact gives
rise to such dreadful consequences in the United States, where it
is only exceptional, what must be its consequences in Europe where
it is a principle and a system?
-- Frédéric Bastiat (1801-1850)
Rick Pasotto rickp@telocity.com http://www.niof.net
From rob@jam.rr.com Sun Jun 3 16:17:56 2001
From: rob@jam.rr.com (Rob Andrews)
Date: Sun, 03 Jun 2001 10:17:56 -0500
Subject: [Tutor] Re: Useless Thanks!
References: <3B198806.41D90105@jam.rr.com> <3B198C26.DB1DC306@irtc.net>
Message-ID: <3B1A5524.E19E170D@jam.rr.com>
Tesla Coil wrote:
>
> > I've uploaded clippage.py
>
> Wow, what service!
>
> > Also, how do you like the new look of the site?
> > It's not quite as good as oreilly.com yet, but I
> > attack it freshly every few weeks or so these days.
>
> Think it really bad needs to feature a list of the
> "Top Ten Most Useless Python Programmers."
>
> You know people would really scramble to be able
> to put on *that* on their resume!
>
> Could announce to Tutor that you're planning this and
> will give honorable mention at the bottom to the one
> who writes the Useless Python Program to grab pages
> www.lowerstandard.com/python/uselesspython[1-6].html
> and generate the statistics.
>
> Of course, it'll hafta take into account that it'll
> soon have more than six pages to grab from all the
> responses resulting of its implementation...
>
> I'll disqualify myself for having the unfair lead
> of having thought it up. .
>
> Also: Perhaps an icon or something to designate a
> Useless contribution is specific to *nix or MS?
>
> Then you could include in Useless challenges:
> "Port an existing Useless Python program to an
> OS on which it does not currently operate."
I'm forwarding this messge in its entirety to the Tutor List to see if
anyone has any thoughts on the general subject. Thanks to your
collective generosity and creativity, Useless Python has begun to grow
into what I certainly hope is "far from useless" as one reviewer phrased
it.
What would make it even more handy? I'll certainly add the new
challenges suggested to me over the last few days, which seem to be
amusing some of you. I've been trying to work on my web programming
skills (in Python, of course), and would like to add more interactivity
to the site. Aside from coming up with a way for people to upload their
own source files and descriptions, I've thought it would be interesting
if viewers could vote on the uselessness of any script and/or mark
whether they think it's Newbie, Intermediate, Advanced, Guru, or Yoo
level. Oh, and as soon as I can figure out where we're keeping our log
files, I'll try to make some stats available.
It's your site. How do you want it to grow next?
Rob
--
Useless Python!
Kinda like the AOL of the Open Source Community 3;->
http://www.lowerstandard.com/python/index.html
From rob@jam.rr.com Sun Jun 3 16:22:33 2001
From: rob@jam.rr.com (Rob Andrews)
Date: Sun, 03 Jun 2001 10:22:33 -0500
Subject: [Tutor] Saving and loading data to/from files
References: <3B1A162C.E897E397@irtc.net> <1A07617500E0@kserver.org>
Message-ID: <3B1A5639.5CFA48CB@jam.rr.com>
Sheila King wrote:
>
> I thought it was
>
> Comma Separated Values
>
> --
> Sheila King
I remember the old days, when we called them comma-delimited files. It
took me forever to figure out that's what a .csv file was.
Rob
--
Useless Python!
Kinda like the AOL of the Open Source Community 3;->
http://www.lowerstandard.com/python/index.html
From pdiaz88@terra.es Sun Jun 3 18:24:36 2001
From: pdiaz88@terra.es (Pedro Diaz Jimenez)
Date: Sun, 3 Jun 2001 17:24:36 +0000
Subject: [Tutor] Something to tack on to "Useless Python" challenges
In-Reply-To: <3B1A47F4.72959659@mail.verizon.net>
References: <3B1A47F4.72959659@mail.verizon.net>
Message-ID: <01060317243600.07891@duero>
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On Sunday 03 June 2001 14:21, Lloyd Hugh Allen wrote:
> http://www.rsasecurity.com/rsalabs/challenges/factoring/numbers.html
>
> Python should be up to the task...
>
> Anyone have a module lying around for torking with arbitrarily large
> numbers (in Python)?
MPZ module should do the job, but...
This is (in my opinion) the type of job not suited python. A C program would
do the same job, faster
Cheers
Pedro
>
> _______________________________________________
> Tutor maillist - Tutor@python.org
> http://mail.python.org/mailman/listinfo/tutor
- --
/*
* Pedro Diaz Jimenez
* pdiaz88@terra.es
* pdiaz@acm.asoc.fi.upm.es
*
* Wanna see how 100000! looks like?:
* http://acm.asoc.fi.upm.es/~pdiaz/fact_100.000
*
* La sabiduria me persigue, pero yo soy mas rapido
*
* "Las artes marciales son parte de una filosofía,
* no deben ser consideradas un arma. Y por eso,
* recuerda: No hay nada como un buen revolver"
* Les Luthiers, Iniciacion a las Artes Marciales
*
*/
Random quote:
- -------------
You feel a whole lot more like you do now than you did when you used to.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.4 (GNU/Linux)
Comment: For info see http://www.gnupg.org
iD8DBQE7GnLcnu53feEYxlERAkgwAKCrJzqjfYDjUPmIwWVO0tdjqeBnwwCfY+VV
t1JfWWNdnmqg6BB8UYnnluQ=
=cSmp
-----END PGP SIGNATURE-----
From rob@jam.rr.com Sun Jun 3 16:40:14 2001
From: rob@jam.rr.com (Rob Andrews)
Date: Sun, 03 Jun 2001 10:40:14 -0500
Subject: [Tutor] Something to tack on to "Useless Python" challenges
References: <3B1A47F4.72959659@mail.verizon.net> <01060317243600.07891@duero>
Message-ID: <3B1A5A5E.D4D5E758@jam.rr.com>
Pedro Diaz Jimenez wrote:
>
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> On Sunday 03 June 2001 14:21, Lloyd Hugh Allen wrote:
> > http://www.rsasecurity.com/rsalabs/challenges/factoring/numbers.html
> >
> > Python should be up to the task...
> >
> > Anyone have a module lying around for torking with arbitrarily large
> > numbers (in Python)?
> MPZ module should do the job, but...
> This is (in my opinion) the type of job not suited python. A C program would
> do the same job, faster
>
> Cheers
>
> Pedro
> >
Almost certainly correct, which would make the Python version pretty
Useless. But aside from the pure joy of Uselessness, it would be
interesting to go as far as possible using Python for some of these
really hairy, advanced tasks. Then we'd have some great examples of
Python's current limits, and it would be easier for someone to take the
part already written in Python and code the remainder in C.
Rob
--
Useless Python!
Kinda like the AOL of the Open Source Community 3;->
http://www.lowerstandard.com/python/index.html
From deirdre@deirdre.net Sun Jun 3 17:02:54 2001
From: deirdre@deirdre.net (Deirdre Saoirse Moen)
Date: Sun, 3 Jun 2001 09:02:54 -0700
Subject: [Tutor] Re: Useless Thanks!
In-Reply-To: <3B1A5524.E19E170D@jam.rr.com>
References: <3B198806.41D90105@jam.rr.com> <3B198C26.DB1DC306@irtc.net>
<3B1A5524.E19E170D@jam.rr.com>
Message-ID:
> > Think it really bad needs to feature a list of the
>> "Top Ten Most Useless Python Programmers."
I love this idea!
Strangely enough, my own contribution came up on a job interview last
week when someone asked about whether I'd written network clients or
servers. I pointed out that my example of both had been up on the
useless python pages for some time. :)
>What would make it even more handy? I'll certainly add the new
>challenges suggested to me over the last few days, which seem to be
>amusing some of you. I've been trying to work on my web programming
>skills (in Python, of course), and would like to add more interactivity
>to the site. Aside from coming up with a way for people to upload their
>own source files and descriptions, I've thought it would be interesting
>if viewers could vote on the uselessness of any script and/or mark
>whether they think it's Newbie, Intermediate, Advanced, Guru, or Yoo
>level. Oh, and as soon as I can figure out where we're keeping our log
>files, I'll try to make some stats available.
My dislike of that kind of system is that then there tend to be
cliques (like in Advogato, where cliques of people can vote someone
up or down). How about someone votes on whether or not the example
was useful to them?
>It's your site. How do you want it to grow next?
But thanks for letting me know what I *really* should do (other than
submit it) with my simulation modeling homework examples. After all,
the bagel baker example DOES explain why the store might be out of
bagels....
--
_Deirdre Stash-o-Matic: http://weirdre.com http://deirdre.net
Macintosh Developer (seeking work): Will work for Cocoa
"I love deadlines. I like the whooshing sound they make as they fly by."
- Douglas Adams
From pdiaz88@terra.es Sun Jun 3 20:13:51 2001
From: pdiaz88@terra.es (Pedro Diaz Jimenez)
Date: Sun, 3 Jun 2001 19:13:51 +0000
Subject: Any volunteers ? (was: Re: [Tutor] Something to tack on to "Useless Python" challenges)
In-Reply-To: <3B1A5A5E.D4D5E758@jam.rr.com>
References: <3B1A47F4.72959659@mail.verizon.net> <01060317243600.07891@duero> <3B1A5A5E.D4D5E758@jam.rr.com>
Message-ID: <01060319135100.00334@duero>
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Well, you could build a computing module using libgmp in C, and then
build the rest of the app in python using that module. (modRSAchallenge ?).
Very, very interesting
We could do something ala distributed.net, but in python and focusing on the
factoring challenge. I would love to work on that project. Any volunteers?.
Unfortunatly I have exams on june. What about doing that in july/august?
I have cryptographic background, and I'm sure more people on this list have
too.
Any volunteers?
Cheers
Pedro
On Sunday 03 June 2001 15:40, Rob Andrews wrote:
> Pedro Diaz Jimenez wrote:
> > -----BEGIN PGP SIGNED MESSAGE-----
> > Hash: SHA1
> >
> > On Sunday 03 June 2001 14:21, Lloyd Hugh Allen wrote:
> > > http://www.rsasecurity.com/rsalabs/challenges/factoring/numbers.html
> > >
> > > Python should be up to the task...
> > >
> > > Anyone have a module lying around for torking with arbitrarily large
> > > numbers (in Python)?
> >
> > MPZ module should do the job, but...
> > This is (in my opinion) the type of job not suited python. A C program
> > would do the same job, faster
> >
> > Cheers
> >
> > Pedro
>
> Almost certainly correct, which would make the Python version pretty
> Useless. But aside from the pure joy of Uselessness, it would be
> interesting to go as far as possible using Python for some of these
> really hairy, advanced tasks. Then we'd have some great examples of
> Python's current limits, and it would be easier for someone to take the
> part already written in Python and code the remainder in C.
>
> Rob
- --
/*
* Pedro Diaz Jimenez
* pdiaz88@terra.es
* pdiaz@acm.asoc.fi.upm.es
*
* Wanna see how 100000! looks like?:
* http://acm.asoc.fi.upm.es/~pdiaz/fact_100.000
*
* La sabiduria me persigue, pero yo soy mas rapido
*
* "Las artes marciales son parte de una filosofía,
* no deben ser consideradas un arma. Y por eso,
* recuerda: No hay nada como un buen revolver"
* Les Luthiers, Iniciacion a las Artes Marciales
*
*/
Random quote:
- -------------
I bet Einstein turned himself all sorts of colors before he invented the
lightbulb.
-- Homer Simpson
Bart The Genius
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.4 (GNU/Linux)
Comment: For info see http://www.gnupg.org
iD8DBQE7Gox5nu53feEYxlERAgcdAJ4i/sRDI4S1K9R2mZjFHKGBfkcTjgCgtpZ3
oxsC0QezRkMC7uKy72SyT6w=
=7qJK
-----END PGP SIGNATURE-----
From gozin23@hotmail.com Sun Jun 3 18:17:34 2001
From: gozin23@hotmail.com (Dennis Willis)
Date: Sun, 03 Jun 2001 17:17:34 -0000
Subject: [Tutor] Async, RAS
Message-ID:
Hi,
I've discovered Python (just!) and have been given a task with Win RAS in
which I have to use it async. I'd like to try implement with Python. Does
anyone know of any Python RAS examples I can use as a starting point (or any
gotcha's they've already tripped over)? Target OS is W2k.
Thanks very much.
Dennis Willis
_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com
From lha2@columbia.edu Sun Jun 3 18:18:41 2001
From: lha2@columbia.edu (Lloyd Hugh Allen)
Date: Sun, 03 Jun 2001 13:18:41 -0400
Subject: [Tutor] Something to tack on to "Useless Python" challenges
Message-ID: <3B1A7171.ECBECD98@mail.verizon.net>
On 0?, Remco Gerlich wrote:
>On 0, Lloyd Hugh Allen wrote:
>> http://www.rsasecurity.com/rsalabs/challenges/factoring/numbers.html
>>
>> Python should be up to the task...
>>
>> Anyone have a module lying around for torking with arbitrarily large
>> numbers (in Python)?
>
>No need for a module in Python, it has long integers itself:
>>>> 1000000000000000000000000L
>1000000000000000000000000L
>
>The problem here of course isn't Python or long integers, but an algorithm
>that doesn't take time measured in ages of the universe...
>
>I'll help you on your way: 2 is not a factor in any of the numbers. So now
>you have one fewer prime to check! ;-)
Well, I know that for the first the number, the ones digits of the
factors end in either 3 and 3 or 1 and 9, but there are probably another
85 digits to find.
My question had my Pascal (and just enough c) background showing
through: I had assumed that there was a cap on Long Integers, just a
bigger one than with regular (short?) integers.
From alan.gauld@bt.com Sun Jun 3 20:44:02 2001
From: alan.gauld@bt.com (alan.gauld@bt.com)
Date: Sun, 3 Jun 2001 20:44:02 +0100
Subject: [Tutor] Off Topic - tutor@pyhon.org FAQ?
Message-ID: <5104D4DBC598D211B5FE0000F8FE7EB20751D7F8@mbtlipnt02.btlabs.bt.co.uk>
> Alan, you can of course use what i did if you want....
Not me, I was just encouraging the original poster.
In fact my time on python tutor duty is likely to
diminish to supporting my web tutor coz my publisher
just accepted my new book proposal but weith an
increased scope from my proposal - including twice
as many pages!...
I'm about to be a busy bee for a while!
Alan G
From alan.gauld@bt.com Sun Jun 3 20:54:26 2001
From: alan.gauld@bt.com (alan.gauld@bt.com)
Date: Sun, 3 Jun 2001 20:54:26 +0100
Subject: [Tutor] RE: [book recommendation for Programming Pearls]
Message-ID: <5104D4DBC598D211B5FE0000F8FE7EB20751D7F9@mbtlipnt02.btlabs.bt.co.uk>
I second the recommendation for Programming Pearls
In act there are 2 books 'PP' and 'More PP'
They don't use C much its nearly all awk(altho I
haven't seen the latest editions(c1999) I have
the late '80s editions. They are mines of gold on
anything to do with performant computation and
also representation of data and documentation.
The chapter on the unix 'spell' program is
wonderful! In fact they are all pretty good.
Alan G.
From alan.gauld@bt.com Sun Jun 3 21:00:34 2001
From: alan.gauld@bt.com (alan.gauld@bt.com)
Date: Sun, 3 Jun 2001 21:00:34 +0100
Subject: [Tutor] Lists...
Message-ID: <5104D4DBC598D211B5FE0000F8FE7EB20751D7FA@mbtlipnt02.btlabs.bt.co.uk>
> def intersect_eas(L1, L2):
> '''The easiest way for Alan G, requires nested_scopes'''
> return filter(lambda x: (x in L2), L1)
How does it require nested scopes?
lambda and filter are builtin,
and x,L1 and L2 are all locals.
But I accept its not highly performant - that wasn't part
of the original question... ;-)
Alan G
From scarblac@pino.selwerd.nl Sun Jun 3 21:08:08 2001
From: scarblac@pino.selwerd.nl (Remco Gerlich)
Date: Sun, 3 Jun 2001 22:08:08 +0200
Subject: [Tutor] Lists...
In-Reply-To: <5104D4DBC598D211B5FE0000F8FE7EB20751D7FA@mbtlipnt02.btlabs.bt.co.uk>; from alan.gauld@bt.com on Sun, Jun 03, 2001 at 09:00:34PM +0100
References: <5104D4DBC598D211B5FE0000F8FE7EB20751D7FA@mbtlipnt02.btlabs.bt.co.uk>
Message-ID: <20010603220808.A24174@pino.selwerd.nl>
On 0, alan.gauld@bt.com wrote:
> > def intersect_eas(L1, L2):
> > '''The easiest way for Alan G, requires nested_scopes'''
> > return filter(lambda x: (x in L2), L1)
>
> How does it require nested scopes?
> lambda and filter are builtin,
> and x,L1 and L2 are all locals.
L1 and L2 are not locals inside the lambda. They're only visible with nested
scopes.
--
Remco Gerlich
From alan.gauld@bt.com Sun Jun 3 21:07:23 2001
From: alan.gauld@bt.com (alan.gauld@bt.com)
Date: Sun, 3 Jun 2001 21:07:23 +0100
Subject: [Tutor] Ok
Message-ID: <5104D4DBC598D211B5FE0000F8FE7EB20751D7FB@mbtlipnt02.btlabs.bt.co.uk>
------_=_NextPart_001_01C0EC68.CD502730
Content-type: text/plain; charset="ISO-8859-1"
Ok, I am going to stick with it, I will say this agian I am a beginer an
know nothing about programming, so half the stuff that is sent I will not
undersand! Thank you.
Richard E Parks 2
RickyP1@frontiernet.net
Good. Now it might help if you went into posting mode
instead of reading(BTW you can cut the volume down by
getting the digest - that wraps about 12-15 messages
into a single one. Its an option on the tutor mail
web page.
How are you trying to learn? Are you using a book or online tutor?
If so which? How far thru' have you gotten. This list will try to answer
beginner questions of any standard(if thats not a contradiction in terms!)
Have fun,
Alan G
------_=_NextPart_001_01C0EC68.CD502730
Content-type: text/html; charset="ISO-8859-1"
Ok, I am going to stick with
it, I will say this agian I am a beginer an know nothing about programming, so
half the stuff that is sent I will not undersand! Thank you.
Richard E Parks 2
Good. Now it might help if you went into
posting mode
instead of reading(BTW you can cut the volume
down by
getting the digest - that wraps about 12-15
messages
into a single one. Its an option on the tutor
mail
web
page.
How are you trying to
learn? Are you using a book or online tutor?
If so
which? How far thru' have you gotten.
This list will try to answer
beginner questions of
any standard(if thats not a contradiction in
terms!)
Have
fun,
Alan
G
------_=_NextPart_001_01C0EC68.CD502730--
From gman_95@hotmail.com Sun Jun 3 21:20:03 2001
From: gman_95@hotmail.com (Daryl G)
Date: Sun, 03 Jun 2001 20:20:03 -0000
Subject: [Tutor] Saving and loading data to/from files
Message-ID:
AHA!
That was it, though I did have to do it a little differently.
The way you showed didn't seem to work with lists, so I just converted each
individual part of a list into a String and then it worked
for i in range(total):
LN=L_Name[i]
FN=F_Name[i]
PH=PH_num[i]
print"%-15.15s %-15.15s %-s" % (LN, FN, PH)
Thanks Again!
>From: "Michael P. Reilly"
>Reply-To: arcege@speakeasy.net
>To: gman_95@hotmail.com (Daryl G)
>CC: tutor@python.org
>Subject: Re: [Tutor] Saving and loading data to/from files
>Date: Sun, 3 Jun 2001 11:12:04 -0400 (EDT)
>
>Daryl G wrote
> > The %s doesn't quite work right. If a name is shorter than another, then
>the
> > positions wont be right in my simple table. I guess I have to see if
>that
> > center() method will work for me.
>
>You need to put the width/length specifies in (just like with C).
>
> > example
> > LastName FirstName Phone#
> > Stephanopolis George 900-856-2992
> > Jo Mary 800-328-6387
> > is what I end up getting.
>
>For this, the formatting string would be:
>fmt = '''%(L_Name)-15.15s %(F_Name)-15.15s %(PH_num)s'''
>
>Last name ("(L_Name)"), left justified ("-"), 15 characters wide (max
>and min, "15.15") string ("s"); same for first name; the phone number
>is an unrestricted string.
>
> > Computer Spreadsheet Vomitus. I love that. :)
>
>Actually, CSV means "comma-separated values" and it is more complicated
>than just splitting on a comma: if the data has a comma, then the value
>is quoted with double-quotes, but what if the value has a double-quote?
>It is also only a textual format, not a data retrieval system; it is
>one means used to transfer data between database systems. Usually the
>first line is the field names. If you're interested, look for "ASV"
>in the Vaults of Parnassus .
>
> -Arcege
>
>--
>+----------------------------------+-----------------------------------+
>| Michael P. Reilly | arcege@speakeasy.net |
_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com
From alan.gauld@bt.com Sun Jun 3 21:16:29 2001
From: alan.gauld@bt.com (alan.gauld@bt.com)
Date: Sun, 3 Jun 2001 21:16:29 +0100
Subject: [Tutor] Prompt
Message-ID: <5104D4DBC598D211B5FE0000F8FE7EB20751D7FC@mbtlipnt02.btlabs.bt.co.uk>
------_=_NextPart_001_01C0EC6A.13018890
Content-type: text/plain; charset="iso-8859-1"
Thank you all for the suport. My bigest problem right now is getiing the
software to run. I downloaded python 2.0 Windows Installer from the
python.org web site. I am still having a problem with the prompt screen
closing too fast I can even read what is says!
This seems to be common for beginners on windoze.
Try running the Python GUI(IDLE) instead of Python.
Or if you got the ActiveState version run Pythonwin.
Alternatively start a DOS box session and type python
at the C:> prompt. That way the DOS box stays put
after your program runs so you see the output!
Somebody should really write up in detail how to start
a program (and the interpreter) for non command-line
users.... I've been meaning to add it to my tutor
for months!
HTH,
Alan g
------_=_NextPart_001_01C0EC6A.13018890
Content-type: text/html; charset="iso-8859-1"
Thank you all for the suport. My bigest
problem right now is getiing the software to run. I downloaded python 2.0
Windows Installer from the python.org web site. I am still having a
problem with the prompt screen closing too fast I can
even read what is says!
This seems to be common for beginners on
windoze.
Try running the Python GUI(IDLE) instead of
Python.
Or if you got the ActiveState version run
Pythonwin.
Alternatively start a DOS box session and type
python
at the C:> prompt. That way the DOS box stays put
after your program runs so you see the
output!
Somebody should really write up in detail how to start
a program (and the interpreter) for non command-line
users.... I've been meaning to add it to my tutor
for months!
HTH,
Alan g
------_=_NextPart_001_01C0EC6A.13018890--
From alan.gauld@bt.com Sun Jun 3 21:30:47 2001
From: alan.gauld@bt.com (alan.gauld@bt.com)
Date: Sun, 3 Jun 2001 21:30:47 +0100
Subject: [Tutor] Saving and loading data to/from files
Message-ID: <5104D4DBC598D211B5FE0000F8FE7EB20751D7FD@mbtlipnt02.btlabs.bt.co.uk>
> A "csv" file is a file where all the fields as separated by
> commas. It's...
> I'm not quite sure what each of the letters stand for
> though. Comma Separated... Vormat?
Values...
Alan G
From arcege@speakeasy.net Sun Jun 3 22:09:07 2001
From: arcege@speakeasy.net (Michael P. Reilly)
Date: Sun, 3 Jun 2001 17:09:07 -0400 (EDT)
Subject: [Tutor] Saving and loading data to/from files
In-Reply-To: from "Daryl G" at Jun 03, 2001 08:20:03 PM
Message-ID: <200106032109.f53L97a01253@dsl092-074-184.bos1.dsl.speakeasy.net>
Daryl G wrote
> That was it, though I did have to do it a little differently.
> The way you showed didn't seem to work with lists, so I just converted each
> individual part of a list into a String and then it worked
>
> for i in range(total):
> LN=L_Name[i]
> FN=F_Name[i]
> PH=PH_num[i]
> print"%-15.15s %-15.15s %-s" % (LN, FN, PH)
Sorry, I hadn't quite gotten that they were lists (I haven't really been
feeling "with it" lately).
You might find it easier to keep things together. Create tuples with
the information, then arrays of those tuples.
NameInfo = [
('Guido', 'van Rossum', '703-555-1234'),
('Eric', 'Idle', '212-555-5346'),
]
for i in range(len(NameInfo)):
(FN, LN, PH) = NameInfo[i]
print "%-15.15s %-15.15s %s" % (LN, FN, PH)
This will allow for keeping things together later, and for better
looping structures: `for (FN, LN, PH) in NameInfo:'
Alternatively, you could use a dictionary for records of "named" fields:
NameInfo = [
{'first': 'Guido', 'last': 'van Rossum', 'phone': '703-555-1234'},
{'first': 'Eric', 'last': 'Idle', 'phone': '212-555-5346'},
]
for record in NameInfo:
print "%-15.15(last)s %-15.15(first)s %(phone)s" % record
Or maybe make a class:
class Record:
def __init__(self, first, last, phone):
self.first, self.last, self.phone = first, last, phone
def __str__(self):
return '%-15.15s %-15.15s %s' % (self.last, self.first, self.phone)
NameInfo = [
Record('Guido', 'van Rossum', '703-555-1234'),
Record('Eric', 'Idle', '212-555-5346'),
]
for record in NameInfo:
print record
There are a lot of choices for you, but separate lists for each field
probably isn't a good one. :) (Incidently, the pickle and shelve modules
handle all these structures)
-Arcege
--
+----------------------------------+-----------------------------------+
| Michael P. Reilly | arcege@speakeasy.net |
From tescoil@irtc.net Sun Jun 3 23:13:47 2001
From: tescoil@irtc.net (Tesla Coil)
Date: Sun, 03 Jun 2001 17:13:47 -0500
Subject: [Tutor] Random Words.
Message-ID: <3B1AB69B.DB3C37E1@irtc.net>
Way to read the file more efficiently if it were
larger? (/usr/share/dict/words has 45,424 entries;
I also have /usr/dict/words with 79,339 entries,
and /usr/dict/words.ott with 172,822).
Where would be preferable to filter out undesired
words? Remove them from the list before choosing,
or, reject them if chosen and replace them? I'm
inclined toward the latter, but wonder if that's
best when there's fair chance of rejection, say,
refusing len(words) <=3 and >=9.
And just interested in any different approach...
#!/usr/bin/env python
# randword.py -- Quick and Dirty
# return a list of random words.
import random
def readfile(lexfile):
file = open(lexfile)
lexlist = file.readlines()
file.close()
return lexlist
def choosewords(lexlist):
randwords = []
entries = len(lexlist)
for iteration in range(20):
word = random.randint(0, entries)
randwords.append(wordlist[word])
return randwords
wordsource = '/usr/share/dict/words'
wordlist = readfile(wordsource)
randlist = choosewords(wordlist)
for word in randlist: print word,
From tescoil@irtc.net Sun Jun 3 23:15:29 2001
From: tescoil@irtc.net (Tesla Coil)
Date: Sun, 03 Jun 2001 17:15:29 -0500
Subject: [Tutor] Saving and loading data to/from files
References: <3B1A162C.E897E397@irtc.net> <1A07617500E0@kserver.org>
Message-ID: <3B1AB701.38A6FCE1@irtc.net>
On 3 Jun 2001, Sheila King replied:
>> Comma Separated Variable, or,
>> Computer Spreadsheet Vomitus,
>> depending on who you ask...
>
> I thought it was
>
> Comma Separated Values
That's the real "depending on who you ask."
I'd say "Comma Separated Values" is more
popular and makes more sense, but "Comma
Separated Variable" was the answer received
first time I asked, and you'll get plenty
of hits searching the net for either phrase.
From rick@niof.net Sun Jun 3 23:48:50 2001
From: rick@niof.net (Rick Pasotto)
Date: Sun, 3 Jun 2001 18:48:50 -0400
Subject: [Tutor] Random Words.
In-Reply-To: <3B1AB69B.DB3C37E1@irtc.net>; from tescoil@irtc.net on Sun, Jun 03, 2001 at 05:13:47PM -0500
References: <3B1AB69B.DB3C37E1@irtc.net>
Message-ID: <20010603184850.B29372@tc.niof.net>
How about:
import random,string,os
stat = os.stat('/usr/share/dict/words')
# the filesize if the 7th element of the array
flen = stat[6]
f = open('/usr/share/dict/words')
words = []
while len(words) < 5:
# seek to a random offset in the file
f.seek(int(random.random() * flen))
# do a single read with sufficient characters
chars = f.read(50)
# split it on white space
wrds = string.split(chars)
# the first element may be only a partial word so use the second
# you can also make other tests on the word here
if len(wrds[1]) > 3 and len(wrds[1]) < 9:
words.append(wrds[1])
print words
This uses minimal memory and I suspect is about as fast as you're
going to get.
On Sun, Jun 03, 2001 at 05:13:47PM -0500, Tesla Coil wrote:
> Way to read the file more efficiently if it were
> larger? (/usr/share/dict/words has 45,424 entries;
> I also have /usr/dict/words with 79,339 entries,
> and /usr/dict/words.ott with 172,822).
>
> Where would be preferable to filter out undesired
> words? Remove them from the list before choosing,
> or, reject them if chosen and replace them? I'm
> inclined toward the latter, but wonder if that's
> best when there's fair chance of rejection, say,
> refusing len(words) <=3 and >=9.
>
> And just interested in any different approach...
>
> #!/usr/bin/env python
> # randword.py -- Quick and Dirty
> # return a list of random words.
> import random
>
> def readfile(lexfile):
> file = open(lexfile)
> lexlist = file.readlines()
> file.close()
> return lexlist
>
> def choosewords(lexlist):
> randwords = []
> entries = len(lexlist)
> for iteration in range(20):
> word = random.randint(0, entries)
> randwords.append(wordlist[word])
> return randwords
>
> wordsource = '/usr/share/dict/words'
> wordlist = readfile(wordsource)
> randlist = choosewords(wordlist)
> for word in randlist: print word,
>
--
When under the pretext of fraternity, the legal code imposes
mutual sacrifices on the citizens, human nature is not thereby
abrogated. Everyone will then direct his efforts toward
contributing little to, and taking much from, the common fund of
sacrifices. Now, is it the most unfortunate who gains from this
struggle? Certainly not, but rather the most influential and
calculating.
-- Frédéric Bastiat (1801-1850)
Rick Pasotto rickp@telocity.com http://www.niof.net
From gman_95@hotmail.com Mon Jun 4 00:05:11 2001
From: gman_95@hotmail.com (Daryl G)
Date: Sun, 03 Jun 2001 23:05:11 -0000
Subject: [Tutor] Saving and loading data to/from files
Message-ID:
Whoever is "with it" on a Sunday? ;)
I originally had it set up as a dictionary, but when I was displaying them,
it wasn't coming out right and I see why now.
I will eventually use classes, I'm just getting the basic functionality down
first.
I was trying the dictionary example in a seperate script, but I get a
traceback error
File "C:\Python20\dict.py", line 7, in ?
print "%-15.15(last)s %-15.15(first)s %(phone)s" % record
ValueError: unsupported format character '(' (0x28)
Python ver 2.0
The tuple example works.
I like this one, but tuples aren't mutable, thats why I -reluctantly- chose
lists when I couldn't get the dictionary to display how I wanted to. That
way if say a phone number changes, I just need to edit the phone number and
not have to delete that record and reenter it all in
But I'll implement that later
Cool!
Daryl
>From: "Michael P. Reilly"
>Reply-To: arcege@speakeasy.net
>To: gman_95@hotmail.com (Daryl G)
>CC: tutor@python.org
>Subject: Re: [Tutor] Saving and loading data to/from files
>Date: Sun, 3 Jun 2001 17:09:07 -0400 (EDT)
>
>Daryl G wrote
> > That was it, though I did have to do it a little differently.
> > The way you showed didn't seem to work with lists, so I just converted
>each
> > individual part of a list into a String and then it worked
> >
> > for i in range(total):
> > LN=L_Name[i]
> > FN=F_Name[i]
> > PH=PH_num[i]
> > print"%-15.15s %-15.15s %-s" % (LN, FN, PH)
>
>Sorry, I hadn't quite gotten that they were lists (I haven't really been
>feeling "with it" lately).
>
>You might find it easier to keep things together. Create tuples with
>the information, then arrays of those tuples.
>NameInfo = [
> ('Guido', 'van Rossum', '703-555-1234'),
> ('Eric', 'Idle', '212-555-5346'),
>]
>for i in range(len(NameInfo)):
> (FN, LN, PH) = NameInfo[i]
> print "%-15.15s %-15.15s %s" % (LN, FN, PH)
>
>This will allow for keeping things together later, and for better
>looping structures: `for (FN, LN, PH) in NameInfo:'
>
>
>Alternatively, you could use a dictionary for records of "named" fields:
>NameInfo = [
> {'first': 'Guido', 'last': 'van Rossum', 'phone': '703-555-1234'},
> {'first': 'Eric', 'last': 'Idle', 'phone': '212-555-5346'},
>]
>for record in NameInfo:
> print "%-15.15(last)s %-15.15(first)s %(phone)s" % record
>
>
>Or maybe make a class:
>class Record:
> def __init__(self, first, last, phone):
> self.first, self.last, self.phone = first, last, phone
> def __str__(self):
> return '%-15.15s %-15.15s %s' % (self.last, self.first, self.phone)
>NameInfo = [
> Record('Guido', 'van Rossum', '703-555-1234'),
> Record('Eric', 'Idle', '212-555-5346'),
>]
>for record in NameInfo:
> print record
>
>There are a lot of choices for you, but separate lists for each field
>probably isn't a good one. :) (Incidently, the pickle and shelve modules
>handle all these structures)
>
> -Arcege
>
>--
>+----------------------------------+-----------------------------------+
>| Michael P. Reilly | arcege@speakeasy.net |
_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com
From rick@niof.net Mon Jun 4 00:20:53 2001
From: rick@niof.net (Rick Pasotto)
Date: Sun, 3 Jun 2001 19:20:53 -0400
Subject: [Tutor] Saving and loading data to/from files
In-Reply-To: ; from gman_95@hotmail.com on Sun, Jun 03, 2001 at 11:05:11PM -0000
References:
Message-ID: <20010603192053.C29372@tc.niof.net>
On Sun, Jun 03, 2001 at 11:05:11PM -0000, Daryl G wrote:
>
> I was trying the dictionary example in a seperate script, but I get a
> traceback error
>
> File "C:\Python20\dict.py", line 7, in ?
> print "%-15.15(last)s %-15.15(first)s %(phone)s" % record
> ValueError: unsupported format character '(' (0x28)
Try:
print "%(last)-15.15s %(first)-15.15s %(phone)s" % record
--
When under the pretext of fraternity, the legal code imposes
mutual sacrifices on the citizens, human nature is not thereby
abrogated. Everyone will then direct his efforts toward
contributing little to, and taking much from, the common fund of
sacrifices. Now, is it the most unfortunate who gains from this
struggle? Certainly not, but rather the most influential and
calculating.
-- Frédéric Bastiat (1801-1850)
Rick Pasotto rickp@telocity.com http://www.niof.net
From tescoil@irtc.net Mon Jun 4 01:35:52 2001
From: tescoil@irtc.net (Tesla Coil)
Date: Sun, 03 Jun 2001 19:35:52 -0500
Subject: [Tutor] Random Words.
References: <3B1AB69B.DB3C37E1@irtc.net> <20010603184850.B29372@tc.niof.net>
Message-ID: <3B1AD7E8.5CF59DFF@irtc.net>
On 3 Jun 2001, Rick Pasotto replied:
> This uses minimal memory and I suspect is
> about as fast as you're going to get.
That completely smokes! I narrowed the criteria
to only words of 8 characters, tried it on a list
of around 235,000 entries--it still doesn't blink.
From gman_95@hotmail.com Mon Jun 4 02:06:07 2001
From: gman_95@hotmail.com (Daryl G)
Date: Mon, 04 Jun 2001 01:06:07 -0000
Subject: [Tutor] Saving and loading data to/from files
Message-ID:
Ok, I figured out the dictionary problem
Change the print statement
for record in NameInfo:
print "%-15.15s %-15.15s %s" % (record['first'], record['last'],
record['phone'])
now I don't get that error, however I am having difficulty in figuring out
how to add data to the dictionary.
This seems to be a sequence directory because of the brackets, correct? Plus
in some of my attempts I get a TypeError loop non-sequence
Accessing the values inside is different then a non-sequence directionary.
Any insight?
Daryl
>From: "Michael P. Reilly"
>Reply-To: arcege@speakeasy.net
>To: gman_95@hotmail.com (Daryl G)
>CC: tutor@python.org
>Subject: Re: [Tutor] Saving and loading data to/from files
>Date: Sun, 3 Jun 2001 17:09:07 -0400 (EDT)
>
>Daryl G wrote
> > That was it, though I did have to do it a little differently.
> > The way you showed didn't seem to work with lists, so I just converted
>each
> > individual part of a list into a String and then it worked
> >
> > for i in range(total):
> > LN=L_Name[i]
> > FN=F_Name[i]
> > PH=PH_num[i]
> > print"%-15.15s %-15.15s %-s" % (LN, FN, PH)
>
>Sorry, I hadn't quite gotten that they were lists (I haven't really been
>feeling "with it" lately).
>
>You might find it easier to keep things together. Create tuples with
>the information, then arrays of those tuples.
>NameInfo = [
> ('Guido', 'van Rossum', '703-555-1234'),
> ('Eric', 'Idle', '212-555-5346'),
>]
>for i in range(len(NameInfo)):
> (FN, LN, PH) = NameInfo[i]
> print "%-15.15s %-15.15s %s" % (LN, FN, PH)
>
>This will allow for keeping things together later, and for better
>looping structures: `for (FN, LN, PH) in NameInfo:'
>
>
>Alternatively, you could use a dictionary for records of "named" fields:
>NameInfo = [
> {'first': 'Guido', 'last': 'van Rossum', 'phone': '703-555-1234'},
> {'first': 'Eric', 'last': 'Idle', 'phone': '212-555-5346'},
>]
>for record in NameInfo:
> print "%-15.15(last)s %-15.15(first)s %(phone)s" % record
>
>
>Or maybe make a class:
>class Record:
> def __init__(self, first, last, phone):
> self.first, self.last, self.phone = first, last, phone
> def __str__(self):
> return '%-15.15s %-15.15s %s' % (self.last, self.first, self.phone)
>NameInfo = [
> Record('Guido', 'van Rossum', '703-555-1234'),
> Record('Eric', 'Idle', '212-555-5346'),
>]
>for record in NameInfo:
> print record
>
>There are a lot of choices for you, but separate lists for each field
>probably isn't a good one. :) (Incidently, the pickle and shelve modules
>handle all these structures)
>
> -Arcege
>
>--
>+----------------------------------+-----------------------------------+
>| Michael P. Reilly | arcege@speakeasy.net |
_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com
From sarnold@earthling.net Mon Jun 4 02:44:03 2001
From: sarnold@earthling.net (Stephen L Arnold)
Date: Sun, 3 Jun 2001 18:44:03 -0700
Subject: [Tutor] command prompt HOWTO
Message-ID: <20010604014404.36F841F62A@shiva.arnolds.bogus>
Howdy:
I have (semi-coherent rambling) mini-HOWTO for running Python
programs at the DOS and Linux command prompts. It's got some
environment stuff, examples, etc.
If I get some questions/feedback/flames I'll try and make the
appropriate changes. It's kinda long; should I post it to the list
anyway?
Steve
From GADGILP@INFOTECH.ICICI.com Mon Jun 4 04:47:55 2001
From: GADGILP@INFOTECH.ICICI.com (GADGIL PRASAD /INFRA/INFOTECH)
Date: Mon, 4 Jun 2001 09:17:55 +0530
Subject: [Tutor] Re: [Python-Help] a number and control char stored in
a single char. !
Message-ID: <718A0962DFC2D4119FF80008C7289E4701032D44@ICICIBACK3>
This message is in MIME format. Since your mail reader does not understand
this format, some or all of this message may not be legible.
------_=_NextPart_001_01C0ECA9.238B6520
Content-Type: text/plain;
charset="iso-8859-1"
hello,
daniel, u r a life saver! Thanks.
well what i meant when i said, i cant post to tutor list, is that, I was
posting
from cybercafe, couldn't change sender's addr to my subscribed
id. I thought non subscribers can't post.
/regards
prasad
> -----Original Message-----
> From: Daniel Yoo [mailto:dyoo@hkn.eecs.berkeley.edu]
> Sent: Saturday, June 02, 2001 11:25 AM
> Cc: help@python.org; tutor@python.org
> Subject: [Tutor] Re: [Python-Help] a number and control char
> stored in a
> single char. !
>
>
> On Fri, 1 Jun 2001, kaha aham wrote:
>
>
> > I am running & capturing screen output of a command using
> os.popen as
> > helped by tuto@python.org ppl. However the value i capture which
> > should be a number like something like 22345 is displayed as
> > '22345\012'
>
> Yes, this means that what you're getting back is the string "21345"
> followed by the newline, '\012'. What you'll need to do is convert it
> with the int() function.
>
>
>
> > I need to numerically compare this value later in program. I tried
> > slicing it to remove the last control char using var[:-1],
> on which it
> > prints []. I then trid using len(), it tells size as 1 char. I tried
> > printing just 1st char using var[0], and it shows '22345\012'
>
> Ah! You had the right idea: what you'll want to do is:
>
> var[0][:-1]
>
> instead. You want to get all but the last character from var[0], your
> first line of the output. This is probably what was
> preventing you from
> converting to integer. Try int()'ing with var[0][:-1], and
> you should be
> ok. But if you're converting with int(), you don't need to
> strip out the
> newline character; int() knows how to deal with it already.
>
>
> Let's look at what happened before... I'm guessing that when you used
> os.popen(), you used the readlines() method to get at all the lines of
> output. What this means is that "var" stands for all the
> lines of input,
> and "var[0]" stands for the first line. However, "var[:-1]"
> stands for
> all but the last line --- but if your output only consists of
> one line,
> that means you'll get the empty list, []. That should
> explain the weird
> error messages.
>
>
> > That's baffling me. How can it put all that number and
> control char in
> > 1 char. I currently can't post to tutor maillist as I did earlier.
>
> Hmmm... that's strange! Try posting your question again;
> perhaps the mail
> host was down. In the meantime, I'll forward your message to
> tutor@python.org.
>
> I just checked, and from what I can tell, you're not subscribed to the
> tutor list yet. You'll probably need to subscribe to post to
> tutor. You
> can subscribe here:
>
> http://mail.python.org/mailman/listinfo/tutor
>
>
> If you run into difficulties again, feel free to email again.
> I'll talk
> to you later!
>
>
> _______________________________________________
> Tutor maillist - Tutor@python.org
> http://mail.python.org/mailman/listinfo/tutor
>
.
------_=_NextPart_001_01C0ECA9.238B6520
Content-Type: text/html;
charset="iso-8859-1"
RE: [Tutor] Re: [Python-Help] a number and control char stored in a single char. !
hello,
daniel, u r a life saver! Thanks.
well what i meant when i said, i cant post to tutor list, is that, I was posting
from cybercafe, couldn't change sender's addr to my subscribed
id. I thought non subscribers can't post.
/regards
prasad
> -----Original Message-----
> From: Daniel Yoo [mailto:dyoo@hkn.eecs.berkeley.edu]
> Sent: Saturday, June 02, 2001 11:25 AM
> Cc: help@python.org; tutor@python.org
> Subject: [Tutor] Re: [Python-Help] a number and control char
> stored in a
> single char. !
>
>
> On Fri, 1 Jun 2001, kaha aham wrote:
>
>
> > I am running & capturing screen output of a command using
> os.popen as
> > helped by tuto@python.org ppl. However the value i capture which
> > should be a number like something like 22345 is displayed as
> > '22345\012'
>
> Yes, this means that what you're getting back is the string "21345"
> followed by the newline, '\012'. What you'll need to do is convert it
> with the int() function.
>
>
>
> > I need to numerically compare this value later in program. I tried
> > slicing it to remove the last control char using var[:-1],
> on which it
> > prints []. I then trid using len(), it tells size as 1 char. I tried
> > printing just 1st char using var[0], and it shows '22345\012'
>
> Ah! You had the right idea: what you'll want to do is:
>
> var[0][:-1]
>
> instead. You want to get all but the last character from var[0], your
> first line of the output. This is probably what was
> preventing you from
> converting to integer. Try int()'ing with var[0][:-1], and
> you should be
> ok. But if you're converting with int(), you don't need to
> strip out the
> newline character; int() knows how to deal with it already.
>
>
> Let's look at what happened before... I'm guessing that when you used
> os.popen(), you used the readlines() method to get at all the lines of
> output. What this means is that "var" stands for all the
> lines of input,
> and "var[0]" stands for the first line. However, "var[:-1]"
> stands for
> all but the last line --- but if your output only consists of
> one line,
> that means you'll get the empty list, []. That should
> explain the weird
> error messages.
>
>
> > That's baffling me. How can it put all that number and
> control char in
> > 1 char. I currently can't post to tutor maillist as I did earlier.
>
> Hmmm... that's strange! Try posting your question again;
> perhaps the mail
> host was down. In the meantime, I'll forward your message to
> tutor@python.org.
>
> I just checked, and from what I can tell, you're not subscribed to the
> tutor list yet. You'll probably need to subscribe to post to
> tutor. You
> can subscribe here:
>
> http://mail.python.org/mailman/listinfo/tutor
>
>
> If you run into difficulties again, feel free to email again.
> I'll talk
> to you later!
>
>
> _______________________________________________
> Tutor maillist - Tutor@python.org
> http://mail.python.org/mailman/listinfo/tutor
>
..
------_=_NextPart_001_01C0ECA9.238B6520--
From r.b.rigilink@chello.nl Mon Jun 4 07:40:39 2001
From: r.b.rigilink@chello.nl (Roeland Rengelink)
Date: Mon, 04 Jun 2001 08:40:39 +0200
Subject: [Tutor] Saving and loading data to/from files
References:
Message-ID: <3B1B2D67.7EF35199@chello.nl>
Hi Daryl,
Daryl G wrote:
>
> Ok, I figured out the dictionary problem
> Change the print statement
> for record in NameInfo:
>
> print "%-15.15s %-15.15s %s" % (record['first'], record['last'],
> record['phone'])
>
> now I don't get that error, however I am having difficulty in figuring out
> how to add data to the dictionary.
> This seems to be a sequence directory because of the brackets, correct? Plus
> in some of my attempts I get a TypeError loop non-sequence
> Accessing the values inside is different then a non-sequence directionary.
> Any insight?
>
NameInfo is a list (sequence). Each element in this list is a
dictionary.
The trick is to know when you are dealing with the list, and when you're
dealing with an item (a dictionary in this case) in the list. Just some
examples to help you on your way:
Here a two-element list of dictionaries is build
NameInfo = [
{'first': 'Guido', 'last': 'van Rossum', 'phone': '703-555-1234'},
{'first': 'Eric', 'last': 'Idle', 'phone': '212-555-5346'}]
You can access a list-element by indexing with an integer, i.e the first
element with:
print "%(first)-15.15s %(last)-15.15s %s" % NameInfo[0]
Guido van Rossum 703-555-1234
(Maybe you're surprised that the first item in a list has index 0. Think
of it as an offset)
You can add a new element using something like:
NameInfo.append({'first':'Basil', 'last':'Fawlty',
'phone':'111-222-33333'}
You can change an element by replacing it with a new dictionary
NameInfo[0] = {'first':'Tim', 'last':'Peters', 'phone':'333-111-22222'}
You can also address items inside each dictionary, for example
print NameInfo[1]['first']
Eric
(i.e. get the second item in the list and from that item het the value
of 'first')
Use that to add some info to a dict
NameInfo[2]['birth'] = '01 Apr 1933' # Date of birth for Basil Fawlty
The summary:
Lists are indexed with integers.
Dictionaries are indexed with a key, which can be pretty much anything
List items are added using the_list.append(item)
Dict items are changed/added using the_dict[key] = value
if you have a list of dicts, you can access an item in a dict with
value = alist[index][key]
which is pretty much equivalent to
record = alist[index]
value = record[key]
Hope this helps,
Roeland Rengelink
--
r.b.rigilink@chello.nl
"Half of what I say is nonsense. Unfortunately I don't know which half"
From alan.gauld@bt.com Mon Jun 4 11:17:17 2001
From: alan.gauld@bt.com (alan.gauld@bt.com)
Date: Mon, 4 Jun 2001 11:17:17 +0100
Subject: [Tutor] Lists...
Message-ID: <5104D4DBC598D211B5FE0000F8FE7EB20751D7FE@mbtlipnt02.btlabs.bt.co.uk>
> > > def intersect_eas(L1, L2):
> > > '''The easiest way for Alan G, requires nested_scopes'''
> > > return filter(lambda x: (x in L2), L1)
> >
> > How does it require nested scopes?
> L1 and L2 are not locals inside the lambda. They're only
> visible with nested scopes.
Ah, of course. Although the lambda definition is inside
the function the call to it isn't. Rats!
Alan G
From alan.gauld@bt.com Mon Jun 4 11:38:02 2001
From: alan.gauld@bt.com (alan.gauld@bt.com)
Date: Mon, 4 Jun 2001 11:38:02 +0100
Subject: [Tutor] Lists...
Message-ID: <5104D4DBC598D211B5FE0000F8FE7EB20751D7FF@mbtlipnt02.btlabs.bt.co.uk>
> > def intersect_eas(L1, L2):
> > '''The easiest way for Alan G, requires nested_scopes'''
> > return filter(lambda x: (x in L2), L1)
OK a version not requiring nested scopes...
def intersect(L1,L2):
return filter(lambda x,y=L2:(x in y), L1)
Still not fast tho'... :-)
Alan g.
PS I needed something similar for a web page that
has to run on py 1.5.1 so nested scopes were no use to me...
From gman_95@hotmail.com Mon Jun 4 14:07:03 2001
From: gman_95@hotmail.com (Daryl G)
Date: Mon, 04 Jun 2001 13:07:03 -0000
Subject: [Tutor] Saving and loading data to/from files
Message-ID:
Thanks Roeland!
Thats what I needed.
I should have thought of that; NameInfo[0]['first']. Ah well, I was
working on this part late last night anyway
Thanks for everyones help!
Daryl
>From: Roeland Rengelink
>To: Daryl G
>CC: tutor@python.org
>Subject: Re: [Tutor] Saving and loading data to/from files
>Date: Mon, 04 Jun 2001 08:40:39 +0200
>
>Hi Daryl,
>
>Daryl G wrote:
> >
> > Ok, I figured out the dictionary problem
> > Change the print statement
> > for record in NameInfo:
> >
> > print "%-15.15s %-15.15s %s" % (record['first'], record['last'],
> > record['phone'])
> >
> > now I don't get that error, however I am having difficulty in figuring
>out
> > how to add data to the dictionary.
> > This seems to be a sequence directory because of the brackets, correct?
>Plus
> > in some of my attempts I get a TypeError loop non-sequence
> > Accessing the values inside is different then a non-sequence
>directionary.
> > Any insight?
> >
>
>NameInfo is a list (sequence). Each element in this list is a
>dictionary.
>
>The trick is to know when you are dealing with the list, and when you're
>dealing with an item (a dictionary in this case) in the list. Just some
>examples to help you on your way:
>
>Here a two-element list of dictionaries is build
>
>NameInfo = [
> {'first': 'Guido', 'last': 'van Rossum', 'phone': '703-555-1234'},
> {'first': 'Eric', 'last': 'Idle', 'phone': '212-555-5346'}]
>
>You can access a list-element by indexing with an integer, i.e the first
>element with:
>
>print "%(first)-15.15s %(last)-15.15s %s" % NameInfo[0]
>Guido van Rossum 703-555-1234
>
>(Maybe you're surprised that the first item in a list has index 0. Think
>of it as an offset)
>
>You can add a new element using something like:
>
>NameInfo.append({'first':'Basil', 'last':'Fawlty',
>'phone':'111-222-33333'}
>
>You can change an element by replacing it with a new dictionary
>
>NameInfo[0] = {'first':'Tim', 'last':'Peters', 'phone':'333-111-22222'}
>
>You can also address items inside each dictionary, for example
>
>print NameInfo[1]['first']
>Eric
>
>(i.e. get the second item in the list and from that item het the value
>of 'first')
>
>Use that to add some info to a dict
>
>NameInfo[2]['birth'] = '01 Apr 1933' # Date of birth for Basil Fawlty
>
>
>The summary:
>
>Lists are indexed with integers.
>Dictionaries are indexed with a key, which can be pretty much anything
>
>List items are added using the_list.append(item)
>Dict items are changed/added using the_dict[key] = value
>
>if you have a list of dicts, you can access an item in a dict with
>
>value = alist[index][key]
>
>which is pretty much equivalent to
>
>record = alist[index]
>value = record[key]
>
>
>Hope this helps,
>
>Roeland Rengelink
>--
>r.b.rigilink@chello.nl
>
>"Half of what I say is nonsense. Unfortunately I don't know which half"
_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com
From GBunting864@Worldsavings.com Mon Jun 4 20:23:43 2001
From: GBunting864@Worldsavings.com (Bunting, Glen, IG (x))
Date: Mon, 4 Jun 2001 14:23:43 -0500
Subject: [Tutor] ActivePython
Message-ID: <97E9FA3149D0D311BE5800008349BB27016463DF@ok1ems1.worldsavings.com>
What is the difference between ActivePython and the regular python from
www.python.org for windows?
Thanks
Glen
*****************************************************************************
If you are not the intended recipient of this e-mail, please notify
the sender immediately. The contents of this e-mail do not amend
any existing disclosures or agreements unless expressly stated.
*****************************************************************************
From hall@phyast.nhn.ou.edu Mon Jun 4 20:25:38 2001
From: hall@phyast.nhn.ou.edu (Isaac Hall)
Date: Mon, 04 Jun 2001 14:25:38 -0500
Subject: [Tutor] small (I hope) questions
Message-ID: <3B1BE0B2.5D744AF8@mail.nhn.ou.edu>
first, let me introduce myself a little as I am new to this list (but
I may well be widely known as the guy with all the dumb questions
soon...I hope not) Ive just begun working with Python and Tkinter in
physics applications, and Im getting stuck in some fairly minor aspects
of this. I have previously only programmed in C/C++. anyway my
question(s) are:
a) I am trying to produce a pie chart of just random numbers in a
list to get started with this, however Im confused as to how to call up
a canvas, and draw the chart.
b) in addition to the pie chart, I also need to put these numbers in
a table (which I have figured out, however I would like to be able to
create this so that the pie chart comes up first, and then clicking on
the pie chart will display the table.
If anyone can help it would be greatly appreciated...my main problem is
in which commands do this, and their syntax, which I am not yet used
to...the logic part of this, I am so far ok with.
From dsh8290@rit.edu Mon Jun 4 20:37:53 2001
From: dsh8290@rit.edu (D-Man)
Date: Mon, 4 Jun 2001 15:37:53 -0400
Subject: [Tutor] ActivePython
In-Reply-To: <97E9FA3149D0D311BE5800008349BB27016463DF@ok1ems1.worldsavings.com>; from GBunting864@worldsavings.com on Mon, Jun 04, 2001 at 02:23:43PM -0500
References: <97E9FA3149D0D311BE5800008349BB27016463DF@ok1ems1.worldsavings.com>
Message-ID: <20010604153753.C11144@harmony.cs.rit.edu>
On Mon, Jun 04, 2001 at 02:23:43PM -0500, Bunting, Glen, IG (x) wrote:
| What is the difference between ActivePython and the regular python from
| www.python.org for windows?
ActivePython comes with the win32all extensions and an IDE. "Regular"
python is just the interpreter, and IDLE bundled up with it (a
simplistic IDE).
Personally, I use the interpreter shipped with cygwin in conjunction
with (g)vim.
-D
From mikebacks@yahoo.com Mon Jun 4 20:48:21 2001
From: mikebacks@yahoo.com (Michael Bacayo)
Date: Mon, 4 Jun 2001 12:48:21 -0700 (PDT)
Subject: [Tutor] Help with Process Commands
Message-ID: <20010604194821.55492.qmail@web10402.mail.yahoo.com>
I want to learn how to use system(), spawnv(), and
spawnve() the right way. When I use this in a program
of mine, these commands seem to be inconsistent in the
manner that the arguments are sent to the called
program. Sometimes, you need to include the arguments
in the list or tuple with spaces before and after the
"'s and sometimes it's not need. The arguments are not
passed correctly to the called program if not written
a certain way.
Thanks!
__________________________________________________
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail - only $35
a year! http://personal.mail.yahoo.com/
From rob@jam.rr.com Mon Jun 4 20:56:21 2001
From: rob@jam.rr.com (Rob Andrews)
Date: Mon, 4 Jun 2001 14:56:21 -0500
Subject: [Tutor] ActivePython
References: <97E9FA3149D0D311BE5800008349BB27016463DF@ok1ems1.worldsavings.com>
Message-ID: <002901c0ed30$6da1b060$de00a8c0@planhouse5>
> What is the difference between ActivePython and the regular python from
> www.python.org for windows?
>
> Thanks
>
> Glen
>
I'm sure someone can answer this better, but ActivePython comes with a
slightly different bundle including PythonWin, which is similar to IDLE. For
most purposes, there appears to be little difference, and I like both.
Rob
Useless Python
It's not just for breakfast anymore!
http://www.lowerstandard.com/python/index.html
From ak@silmarill.org Mon Jun 4 21:04:56 2001
From: ak@silmarill.org (ak@silmarill.org)
Date: Mon, 04 Jun 2001 16:04:56 -0400
Subject: [Tutor] Help with Process Commands
In-Reply-To: <"from mikebacks"@yahoo.com>
References: <20010604194821.55492.qmail@web10402.mail.yahoo.com>
Message-ID: <20010604160456.A19445@sill.silmarill.org>
On Mon, Jun 04, 2001 at 12:48:21PM -0700, Michael Bacayo wrote:
> I want to learn how to use system(), spawnv(), and
> spawnve() the right way. When I use this in a program
> of mine, these commands seem to be inconsistent in the
> manner that the arguments are sent to the called
> program. Sometimes, you need to include the arguments
> in the list or tuple with spaces before and after the
> "'s and sometimes it's not need. The arguments are not
> passed correctly to the called program if not written
> a certain way.
>
> Thanks!
Here's the os.system() syntax:
os.system('ls -al')
or
os.system('ls -a -l')
IOW, everything inside quotes is passed on to the shell for processing,
so you just use the command the way you'd type it in the shell.
Sometimes you will need to do this:
args = ' -al'
cmd = 'ls'
os.system(cmd + args)
or
args = [' -a',' -l']
cmd = 'ls'
os.system(cmd + args[0] + args[1])
--
Shine on you crazy diamond
- Roger
From curtis.larsen@Covance.Com Mon Jun 4 22:10:36 2001
From: curtis.larsen@Covance.Com (Curtis Larsen)
Date: Mon, 04 Jun 2001 16:10:36 -0500
Subject: [Tutor] De-CSV-ing?
Message-ID:
What would be the easiest (or simplest) way to convert a line from a CSV
file into a list or tuple? Sure, you can use ".split(',')" to break the
line into a list -- that's the easy part. For example, if each read
line in a CSV file were represented by string "s":
s = "1,2,3,5.5,3.95,dog,cat,ferret"
s1 = s.split(",")
s1 now equals ['1', '2', '3', '5.5', '3.95', 'dog', 'cat', 'ferret']
That's great as far as it goes -- you have each value as a
uniquely-addressable item again. But is there an easy way to convert
the numbers-as-strings field values back to being numbers? Also, how
would you handle a CSV file where the strings were actually delimited by
(double or single) quotes? (e.g. the record would look like:
1,2,3,"dog","cat","ferret",7.95 ) Do you have to loop through each
value in each line, or is there an easier/faster conversion approach?
Thanks!
Curtis
-----------------------------------------------------
Confidentiality Notice: This e-mail transmission
may contain confidential or legally privileged
information that is intended only for the individual
or entity named in the e-mail address. If you are not
the intended recipient, you are hereby notified that
any disclosure, copying, distribution, or reliance
upon the contents of this e-mail is strictly prohibited.
If you have received this e-mail transmission in error,
please reply to the sender, so that we can arrange
for proper delivery, and then please delete the message
from your inbox. Thank you.
From ak@silmarill.org Mon Jun 4 22:35:34 2001
From: ak@silmarill.org (ak@silmarill.org)
Date: Mon, 04 Jun 2001 17:35:34 -0400
Subject: [Tutor] De-CSV-ing?
In-Reply-To: <"from curtis.larsen"@Covance.Com>
References:
Message-ID: <20010604173534.A19943@sill.silmarill.org>
On Mon, Jun 04, 2001 at 04:10:36PM -0500, Curtis Larsen wrote:
> What would be the easiest (or simplest) way to convert a line from a CSV
> file into a list or tuple? Sure, you can use ".split(',')" to break the
> line into a list -- that's the easy part. For example, if each read
> line in a CSV file were represented by string "s":
>
> s = "1,2,3,5.5,3.95,dog,cat,ferret"
> s1 = s.split(",")
> s1 now equals ['1', '2', '3', '5.5', '3.95', 'dog', 'cat', 'ferret']
>
> That's great as far as it goes -- you have each value as a
> uniquely-addressable item again. But is there an easy way to convert
> the numbers-as-strings field values back to being numbers? Also, how
Yeah, int() and float(). If value isn't convertable, they raise exceptions.
> would you handle a CSV file where the strings were actually delimited by
> (double or single) quotes? (e.g. the record would look like:
> 1,2,3,"dog","cat","ferret",7.95 ) Do you have to loop through each
> value in each line, or is there an easier/faster conversion approach?
Well, I guess one way is to see if the first and last characters are quotes
and then strip them.
for item in list:
if item[0] == '"' and item[-1] == '"':
item = item[1:-1]
>
> Thanks!
> Curtis
>
>
>
> -----------------------------------------------------
> Confidentiality Notice: This e-mail transmission
> may contain confidential or legally privileged
> information that is intended only for the individual
> or entity named in the e-mail address. If you are not
> the intended recipient, you are hereby notified that
> any disclosure, copying, distribution, or reliance
> upon the contents of this e-mail is strictly prohibited.
>
> If you have received this e-mail transmission in error,
> please reply to the sender, so that we can arrange
> for proper delivery, and then please delete the message
> from your inbox. Thank you.
>
> _______________________________________________
> Tutor maillist - Tutor@python.org
> http://mail.python.org/mailman/listinfo/tutor
--
The point of philosophy is to start with something so simple as not
to seem worth stating, and to end with something so paradoxical
that no one will believe it.
From sarnold@earthling.net Tue Jun 5 03:54:47 2001
From: sarnold@earthling.net (Stephen L Arnold)
Date: Mon, 4 Jun 2001 19:54:47 -0700
Subject: [Tutor] small (I hope) questions
In-Reply-To: <3B1BE0B2.5D744AF8@mail.nhn.ou.edu>
Message-ID: <20010605025448.C4D9C1F62A@shiva.arnolds.bogus>
On 4 Jun 01, at 14:25, Isaac Hall wrote:
[snip]
> a) I am trying to produce a pie chart of just random numbers in
> a list to get started with this, however Im confused as to how to
> call up a canvas, and draw the chart.
[snip]
Are you sure you want to code this yourself, as opposed to calling
a graphics lib or using an external app? I think the WXPython
package comes with a basic plotting lib. I know gnuplot works well
with Python, and a windows version even comes with the ActiveState
Python (gnuplot is standard on pretty much every Linux
distribution). I've only used gnuplot on Linux, and it works fine;
I fired up the above windows version and it worked with the demos.
The gnuplot syntax is pretty straightforward; there's an example on
one of my cheesy screenshots below (the last one on the page):
http://arnolds.dhs.org/screenshots.html
If you have your data in an ASCII file (in column vectors) then
from within gnuplot you could plot the second and third columns:
plot "this_file" using 2:3 with linespoints
I never tried a pie chart, but it shouldn't be too hard.
I also saw some cool visualization stuff at the last Python
conference using VTK, but it's a commercial package (there may be
something available for download).
Steve
From sarnold@earthling.net Tue Jun 5 04:18:11 2001
From: sarnold@earthling.net (Stephen L Arnold)
Date: Mon, 4 Jun 2001 20:18:11 -0700
Subject: [Tutor] command prompt HOWTO (long)
Message-ID: <20010605031811.707C11F62A@shiva.arnolds.bogus>
Howdy:
Judging from the lone response I got, I guess I've been expunged
from the list, consigned to the bit-bucket, redirected to /dev/null
8-o
Here it is, but it needs some work (some of the longer lines may
get wrapped in transit). I'm open to suggestions...
Python Command Prompt mini-HOWTO
Steve Arnold 06-03-2001
sarnold@earthling.net
Introduction
This is an introduction to running Python programs from the command
prompt in both DOS/Windows and X-Windows environments. You should be
familiar with using a basic text editor, creating and saving files,
knowing where they go when you save them, etc. Detailed info on
these topics can be found elsewhere on the web (and is beyond the
scope of this document). However, we will discuss some editing tips,
setting up your environment, and various ways to run Python
programs and capture the output.
The DOS Command Prompt
Most of my win32 experience is with Windows 9x and a little bit of NT4.
The main difference is that NT has a more useful NT command prompt,
as well as the DOS box, where you can actually set the size of the
scroll buffer (among other things), but they are very similar as
well. NT allows setting user-specific environment stuff, but 9x
requires a login profile on a server for this. We'll assume the
Windows box is not connected to a network in this case (except for a
dial-up Internet connection).
Setting up Your Environment
All programs run inside an environment of some kind, and in this
case there are both global settings and some that are specific to
the DOS-shortcut you start from. The easiest place to put your
global environment settings is in your autoexec.bat file. A DOS
batch file is just a text file (with a .bat extension) that contains
a sequence of DOS commands to run, and autoexec.bat is a special
batch file that runs when DOS starts up (and before Windows starts).
You should find autoexec.bat in the root of your C:\ drive (this
file was more widely used back in the Windows 3x days, so you may
not even have one). If you don't have one, just create one with a
text editor.
Tip: The basic Windows text editor is called Notepad.exe and is
really not good for much at all (it can't even load or work with
files bigger than 64k). Although you can use something like Word or
Wordpad to edit text files, I wouldn't recommend it. If you don't
already have some kind of programmer's editor, then here's the best
free one (and it's way better than Notepad):
http://www.winsite.com/info/pc/win95/misc/pfe101i.zip
It's called Programmer's File Editor, and although it's no longer
under development, the file above can be found on numerous ftp
archives. The website for PFE used to be here:
http://www.lancs.ac.uk/people/cpaap/pfe/
If you already have an autoexec.bat file, then just add some of the
settings below. Here is an example file, with each line explained
below (most non-Python stuff has already been removed):
************************ begin C:\autoexec.bat ***********************
@C:\UTILS\NAV\NAVDX.EXE /Startup
SET PATH=%PATH%;C:\DOS_STUF;C:\USR\GNAT\BIN;C:\PYTHON20
SET ADA_INCLUDE_PATH=c:\usr\gnat\asis;c:\usr\gnat\POSIX\src;c:\usr\gnat\Booch\components
SET ADA_OBJECTS_PATH=c:\usr\gnat\asis;c:\usr\gnat\POSIX\src;c:\usr\gnat\Booch\components
SET HOME=C:\HOME\STEVE
c:\windows\command\doskey.com dird=dir /ad $*
************************ end C:\autoexec.bat ***********************
Line 1: @C:\UTILS\NAV\NAVDX.EXE /Startup
This line is for Norton Antivirus for Win95. If you don't have it,
don't worry (but you should probably have some form of virus
protection).
Line 2: SET PATH=%PATH%;C:\DOS_STUF;C:\USR\GNAT\BIN;C:\PYTHON20
This line sets the path, which is where Windows looks for programs
to run when you type the program name at a command prompt. The
%PATH% is a variable that means "whatever the path was already set
to". The default path for Windows 9x is usually
"C:\windows;C:\windows\command" (notice that semicolons are used to
separate entries in the path) so my complete path would be:
PATH=C:\WINDOWS;C:\WINDOWS\COMMAND;C:\DOS_STUF;C:\USR\GNAT\BIN;C:\PYTHON20
To see what your path is, open a DOS prompt and type "set", which
will show all your DOS environment variables. The first two entries
above are where Windows and DOS programs reside, the DOS_STUF
directory is where I put some additional DOS programs, next is where
the GNU Ada compiler programs reside, and finally the DOS Python
tools. You need this if you want to call the Python interpreter from
anywhere on your hard drive.
Lines 3 & 4:
SET ADA_INCLUDE_PATH=c:\usr\gnat\asis;c:\usr\gnat\POSIX\src;c:\usr\gnat\Booch\components
SET ADA_OBJECTS_PATH=c:\usr\gnat\asis;c:\usr\gnat\POSIX\src;c:\usr\gnat\Booch\components
Extra junk telling the Ada compiler where to find things (this
should be phased out soon and stored in the registry instead).
Line 5: SET HOME=C:\HOME\STEVE
This is a handy way to set a home directory (where you can keep your
personal Python files, etc). It also helps with some programs that
look for this variable.
Line 6: c:\windows\command\doskey.com dird=dir /ad $*
If you want to have a command history in your DOS box, i.e., where
you can use the Up-arrow key to recall previous commands, then you
need to load this program (it comes with Windows).
So, unless you have other settings already in your autoexec.bat
file, the basic settings for running Python programs would be:
SET PATH=%PATH%;C:\PYTHON20
SET HOME=C:\HOME\STEVE
c:\windows\command\doskey.com dird=dir /ad $*
And don't forget to download the PFE editor above. If you installed
Python to a different directory than the default shown above, then
change it accordingly.
The default DOS prompt shortcut is on your Start Menu under Start ->
Programs -> MS-DOS Prompt. This is a special type of Windows
shortcut that points to command.com, and allows you to set several
other custom parameters for a given DOS session. I'd recommend
making your own shortcut for Python; you might want to put it with
the other Python menus (right-click on the Start menu and click
Explore). Once you've started your Python-DOS box, select the
Properties button on the toolbar at the top of the window. You
should see several tabs of configuration options, some of which can
make things more convenient. You may have noticed that your DOS box
opened in the C:\Windows directory (if it takes over your whole
screen, then press Alt-Tab to make a window). You can change this to
point to wherever you keep your working Python files. For example, I
would make a directory under my home directory above, such as:
C:\HOME\STEVE\SRC\PYTHON
Then on the Program tab in the MS-DOS Prompt Properties, I would
enter the above path for the "Working" directory. That way, this
particular DOS shortcut will always open in my Python source
directory. Feel free to use the Change Icon button to give your DOS
box a more appealing Python-esque icon (there are several .ico files
in the main Python directory). You don't really need to change
anything else, however, you may want to increase the Initial
Environment size on the Memory tab to at least 1024. You can also
play with the options on the Font tab to change the size of the
window/fonts. However, you can't increase the size of your scroll
buffer, so if the text output of your program scrolls off the top of
your screen, about the only options you have are to pipe the output
to the More command, or redirect it to a file (which we'll cover in
just a minute).
Running Python Programs
Start your customized DPS prompt and type "set" to check your
environment. You should see something like the following:
TMP=C:\WINDOWS\TEMP
TEMP=C:\WINDOWS\TEMP
PROMPT=$p$g
winbootdir=C:\WINDOWS
COMSPEC=C:\COMMAND.COM
ADA_INCLUDE_PATH=c:\usr\gnat\asis;c:\usr\gnat\POSIX\src;c:\usr\gnat\Booch\components
ADA_OBJECTS_PATH=c:\usr\gnat\asis;c:\usr\gnat\POSIX\src;c:\usr\gnat\Booch\components
HOME=C:\HOME\STEVE
PGPPATH=C:\INTERNET\PGP
TZ=PST8PDT
DIRCMD=/O
BLASTER=A220 I5 D0 P300
windir=C:\WINDOWS
PATH=C:\USR\GNAT\BIN;C:\WINDOWS;C:\WINDOWS\COMMAND;C:\DOS_STUF;C:\PYTHON20
Including the C:\PYTHON20 directory in your path allows Windows to
find both the DOS and win Python interpreters. For text-mode
programs, you would call the PYTHON.EXE interpreter like this:
C:\home\steve\src>python which.py pythonw.exe
\PYTHON20\pythonw.exe
The which.py program implements a version of the 'which' command
that looks for a program in your PATH (in this case PYTHONW.EXE). If
your program has more output than will fit on one screen, then you
can pipe it (the pipe symbol is above your backslash key) to the
More command, which will let you page down through the output one
screen at a time:
python which.py pythonw.exe|more
The other option is to redirect the output to a file (which will end
up in the current directory unless you specify a path):
python which.py pythonw.exe > output.txt
Starting PYTHON.EXE with no arguments will launch the Python
interpreter. If you double click on PYTHONW.EXE, you will see that
nothing (apparently) happens. PYTHON.EXE is the console version of
Python, and is useful when you want to see what Python writes to the
standard output. PYTHONW.EXE is the non-console version of Python,
and does not show a console window. You would normally use it to run
Python programs which create their own windows, programs running as
server processes, etc.
If you want to run a GUI program, then you would use PYTHONW.EXE
(you would probably want to write a short DOS batch file to start
your program). Most Python GUI programs you'll find floating around
require the TCL/Tk package (Tkinter under Windows) for creating the
windows, buttons, etc, however, more people are starting to use the
GTK-based WXPython package. Both TCL/Tk and WXPython programs should
run under both Linux/X-Windows and MS-Windows, provided you have all
required packages installed. More info on this as available on the
Python and ActiveState web sites:
http://www.python.org/
http://www.ActiveState.com/index.html
The Linux Command Prompt
One of the major differences between DOS/NT and Linux command
prompts (or shells) is that Linux/UNIX shells provide full-featured
scripting languages to use within the shell environment. There are
also several different shells to choose from such as the Bash shell,
C shell, and Korn shell. Most Linux distributions seem to default to
Bash, but you can always choose another. The syntax varies from one
shell to the next (although they seem to fall into two main camps)
so we will use the Bash shell syntax in the following examples.
Setting up Your Environment
Your Linux or UNIX environment should already be setup for you (for
the most part). You can see your environment variables as before, by
typing the 'set' command. You should see something like this:
[sarnold@ptolemy sarnold]$ set
BASH=/bin/bash
BASH_ENV=/home/sarnold/.bashrc
BASH_VERSINFO=([0]="2" [1]="04" [2]="11" [3]="1" [4]="release" [5]="i386-redhat-linux-gnu")
BASH_VERSION='2.04.11(1)-release'
COLORS=/etc/DIR_COLORS
COLUMNS=103
DIRSTACK=()
DISPLAY=:2.0
EUID=501
GROUPS=()
HISTFILE=/home/sarnold/.bash_history
HISTFILESIZE=1000
HISTSIZE=1000
HOME=/home/sarnold
HOSTNAME=ptolemy
HOSTTYPE=i386
IFS='
'
INPUTRC=/etc/inputrc
KDEDIR=/usr
LANG=en_US
LESSOPEN='|/usr/bin/lesspipe.sh %s'
LINES=62
LOGNAME=sarnold
LS_COLORS='no=00:fi=00:di=01;34:ln=01;36:pi=40;33:so=01;35:bd=40;33;01:cd=40;33;01:or=01;05;37...
MACHTYPE=i386-redhat-linux-gnu
MAIL=/var/spool/mail/sarnold
MAILCHECK=60
OPTERR=1
OPTIND=1
OSTYPE=linux-gnu
PATH=/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin:/home/sarnold/bin
PIPESTATUS=([0]="0")
PPID=13536
PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME}: ${PWD}\007"'
PS1='[\u@\h \W]\$ '
PS2='> '
PS4='+ '
PWD=/home/sarnold
QTDIR=/usr/lib/qt-2.2.0
REMOTE_HOSTNAME=rama.arnolds.bogus
REMOTE_IPADDRESS=192.168.0.7
SHELL=/bin/bash
SHELLOPTS=braceexpand:hashall:histexpand:monitor:history:interactive-comments:emacs
SHLVL=4
SSH_ASKPASS=/usr/libexec/openssh/gnome-ssh-askpass
TERM=xterm
TZ=PST8PDT
UID=501
USER=sarnold
USERNAME=sarnold
VNCDESKTOP=X
WINDOWID=8388622
_=PATH
i=/etc/profile.d/which-2.sh
langfile=/home/sarnold/.i18n
sourced=1
mc=()
{
mkdir -p ~/.mc/tmp 2>/dev/null;
chmod 700 ~/.mc/tmp;
MC=~/.mc/tmp/mc-$$;
/usr/bin/mc -P "$@" >"$MC";
cd "`cat $MC`";
/bin/rm "$MC";
unset MC
}
As you can see, there's much more information here than in the
previous example. Don't worry if you don't know what it all means
(I certainly don't) but you can check your path to make sure it has
the right directories in it. One slight difference though: DOS will
look in the current directory for programs first, then the path,
whereas Linux will not look in the current directory unless you
explicitly add it to your path using the '.' notation (which is not
a very good idea). If you want a place to put your working Python
scripts (as well as shell scripts) then you should make a bin
directory under your home directory (as above) and then add it to
your path. To modify your personal path setting, as well as other
shell settings, then you should edit your .bash_profile in your
home directory (it starts with a '.' so it's hidden, like the DOS
Hidden file attribute). Here is my modified .bash_profile:
[sarnold@ptolemy sarnold]$ cat .bash_profile
# .bash_profile
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
# User specific environment and startup programs
PATH=$PATH:$HOME/bin
BASH_ENV=$HOME/.bashrc
USERNAME="sarnold"
export USERNAME BASH_ENV PATH
Notice that in Bash syntax, you must first SET the variables, then
EXPORT them. Your Linux distribution should have come with Python
already installed, so you would probably find the Python interpreter
in /usr/bin. Use the 'which' command to locate it (you could also
try the 'locate' command, but you might have to create the locatedb
first if your machine doesn't run all night) like so:
[sarnold@ptolemy sarnold]$ which python
/usr/bin/python
You can run your python programs exactly the same way as under
Windows, except there's no distinction between running a text-mode
program or a GUI program. Of course, you need to be running X to run
most GUI programs, but that's beyond the scope of this HOWTO.
From cynic@mail.cz Tue Jun 5 05:15:03 2001
From: cynic@mail.cz (Cynic)
Date: Tue, 05 Jun 2001 06:15:03 +0200
Subject: [Tutor] command prompt HOWTO (long)
In-Reply-To: <20010605031811.707C11F62A@shiva.arnolds.bogus>
Message-ID: <5.1.0.14.2.20010605053249.026df008@mail.cz>
At 20:18 4.6. 2001 -0700, Stephen L Arnold wrote:
>Howdy:
>
>Judging from the lone response I got, I guess I've been expunged
>from the list, consigned to the bit-bucket, redirected to /dev/null
>8-o
>
>Here it is, but it needs some work (some of the longer lines may
>get wrapped in transit). I'm open to suggestions...
>
>Python Command Prompt mini-HOWTO
I think you should be more to the point -- strip anything not related
to python, namely stuff like this:
>Line 1: @C:\UTILS\NAV\NAVDX.EXE /Startup
>
>This line is for Norton Antivirus for Win95. If you don't have it,
>don't worry (but you should probably have some form of virus
>protection).
If I were looking for a quick guide to setting up my machine for Python,
and found a 14kB of stuff largely OT, I wouldn't be very happy.
Well, hmm, I'd call this anything but _mini_-HOWTO. I think it's
actually pretty much of a _maxi_-HOWTO considering you're tutoring
people not how to _program_ (be it in Python or any other lingo), but
basic usage of their oh-so-friendly windows (linux) computers. As it is,
it should be called windows-and-linux-for-dummies-HOWTO
I don't want to sound sarcastic or something, but you could have
save yourself some time if you made it a true mini-HOWTO saying
"Read your Windows User's Manual" or "type 'man bash' (without
quotes)". :)
Or, if you prefer this longer version (windoze only):
"""If you had associated .py files with python.exe, and, upon double-
clicking foo.py file, a dos window (well, it's not a dos window, it's
a 32-bit console window) flashes on your screen, and disappears, your
options are:
win9x: create a batch invoking the foo.py program, and uncheck the "close
when finished" checkbox on the "program" card in its properties.
both win9x and NT: create a batch invoking another cmd instance with /k
switch, that will invoke your foo.py
both win9x and NT: start an instance of shell, and invoke foo.py from
there.
"""
using batches is the approach Perl has taken with it's standard programs,
and has the advantage that you can type just the name of the program
(sans extension), and have it executed. I seem to recall reading somewhere
in Perl's doc-set that it also has a disadvantage -- something about
command.com/cmd.exe being dumb enough about passing arguments, but dunno
what exactly it was.
I've only skimmed the Linux part, but it looked similar to the windows half.
Oh, BTW, I found a terrific set of win32 ports of common unix commands,
which, among others, contains which. :)) http://unxutils.sourceforge.net/
an idea, maybe stupid:
what about a wrapper which would take care of the cmd x command /k
invokation? something you could import into your script, something that
would require one or two lines of code per use?
would this be possible with python?
cynic@mail.cz
-------------
And the eyes of them both were opened and they saw that their files
were world readable and writable, so they chmoded 600 their files.
- Book of Installation chapt 3 sec 7
From ak@silmarill.org Tue Jun 5 06:09:04 2001
From: ak@silmarill.org (ak@silmarill.org)
Date: Tue, 05 Jun 2001 01:09:04 -0400
Subject: [Tutor] command prompt HOWTO (long)
In-Reply-To: <"from cynic"@mail.cz>
References: <20010605031811.707C11F62A@shiva.arnolds.bogus>
<5.1.0.14.2.20010605053249.026df008@mail.cz>
Message-ID: <20010605010904.A20631@sill.silmarill.org>
On Tue, Jun 05, 2001 at 06:15:03AM +0200, Cynic wrote:
> At 20:18 4.6. 2001 -0700, Stephen L Arnold wrote:
> >Howdy:
> >
> >Judging from the lone response I got, I guess I've been expunged
> >from the list, consigned to the bit-bucket, redirected to /dev/null
> >8-o
> >
> >Here it is, but it needs some work (some of the longer lines may
> >get wrapped in transit). I'm open to suggestions...
> >
> >Python Command Prompt mini-HOWTO
>
> I think you should be more to the point -- strip anything not related
> to python, namely stuff like this:
>
> >Line 1: @C:\UTILS\NAV\NAVDX.EXE /Startup
> >
> >This line is for Norton Antivirus for Win95. If you don't have it,
> >don't worry (but you should probably have some form of virus
> >protection).
>
> If I were looking for a quick guide to setting up my machine for Python,
> and found a 14kB of stuff largely OT, I wouldn't be very happy.
I'd like to second that - when I was learning linux ~3 years ago, this was
the major stumbling block for me - most of written help is overwhelming.
I think the problem is that when a large company like adobe or ms write
help, they take real-life dumb newbies and try various approaches to
see what works best. When it comes to linux online docs, those who write
them don't really understand what newbies need, so they either write terse
man pages, or get tired of getting frequently asked questions and just
write everything (we don't know what happened before big bang, but [...]).
It's sad how every newbie is disgusted by lack of good optimized for the common
case docs, and naively promises to himself to correct that as soon as he gets
the hang of things (i know i did), and then when he does, he no longer
remembers what would be helpful to him when he was a newbie.
--
True sailing is dead
- Jim
From sarnold@earthling.net Tue Jun 5 06:27:27 2001
From: sarnold@earthling.net (Stephen L Arnold)
Date: Mon, 4 Jun 2001 22:27:27 -0700
Subject: [Tutor] command prompt HOWTO (shorter)
In-Reply-To: <20010605010904.A20631@sill.silmarill.org>
References: <"from cynic"@mail.cz>
Message-ID: <20010605052727.E05EC1F62A@shiva.arnolds.bogus>
On 5 Jun 01, at 1:09, sill@optonline.net wrote:
> On Tue, Jun 05, 2001 at 06:15:03AM +0200, Cynic wrote:
[snip]
> > If I were looking for a quick guide to setting up my machine for Python,
> > and found a 14kB of stuff largely OT, I wouldn't be very happy.
>
> I'd like to second that
[snip]
Okay, it lost 5k of non-Python specific stuff, but I'm having
trouble figuring out what to cut next. Anybody want to see the new
version, or would it be too much clogging up your mailbox?
Steve
From r.b.rigilink@chello.nl Tue Jun 5 07:09:33 2001
From: r.b.rigilink@chello.nl (Roeland Rengelink)
Date: Tue, 05 Jun 2001 08:09:33 +0200
Subject: [Tutor] De-CSV-ing?
References:
Message-ID: <3B1C779D.78BB6D2B@chello.nl>
Curtis Larsen wrote:
>
> What would be the easiest (or simplest) way to convert a line from a CSV
> file into a list or tuple? Sure, you can use ".split(',')" to break the
> line into a list -- that's the easy part. For example, if each read
> line in a CSV file were represented by string "s":
>
> s = "1,2,3,5.5,3.95,dog,cat,ferret"
> s1 = s.split(",")
> s1 now equals ['1', '2', '3', '5.5', '3.95', 'dog', 'cat', 'ferret']
>
> That's great as far as it goes -- you have each value as a
> uniquely-addressable item again. But is there an easy way to convert
> the numbers-as-strings field values back to being numbers? Also, how
> would you handle a CSV file where the strings were actually delimited by
> (double or single) quotes? (e.g. the record would look like:
> 1,2,3,"dog","cat","ferret",7.95 ) Do you have to loop through each
> value in each line, or is there an easier/faster conversion approach?
>
Hi Curtis,
How about this:
def float_it(item):
'''try to change item to float, if that's not possible return item
itself'''
try:
return float(item)
except ValueError:
return item
line = "1,2,3,5.5,3.95,dog,cat,ferret"
items = line.split(',')
items = map(float_it, items) # call float_it for each item
print items
gives
[1.0, 2.0, 3.0, 5.5, 3.9500000000000002, 'dog', 'cat', 'ferret']
Hope this helps,
Roeland
--
r.b.rigilink@chello.nl
"Half of what I say is nonsense. Unfortunately I don't know which half"
From SBrunning@trisystems.co.uk Tue Jun 5 09:21:14 2001
From: SBrunning@trisystems.co.uk (Simon Brunning)
Date: Tue, 5 Jun 2001 09:21:14 +0100
Subject: [Tutor] De-CSV-ing?
Message-ID: <31575A892FF6D1118F5800600846864D78BCCD@intrepid>
> From: Curtis Larsen [SMTP:curtis.larsen@Covance.Com]
> What would be the easiest (or simplest) way to convert a line from a CSV
> file into a list or tuple?
Well, the usual way of decoding csv files is to use a finite state machine -
see
.
Don't worry, that aren't as complicated as this page makes them sound!
But before writing anything yourself, it's often worth seeing if anyone else
has written something useful. After all, csv file processing is pretty
common, so someone else is *bound* to have done this before.
The first place to look is the Vaults of Parnassus -
. Searching there for 'csv' takes me to a
link to the 'ASV' module.
Hmmm. The ASV page seems to be down. But the module can still be downloaded
- . See here -
for google's cache of the ASV page.
Hope this helps...
Cheers,
Simon Brunning
TriSystems Ltd.
sbrunning@trisystems.co.uk
-----------------------------------------------------------------------
The information in this email is confidential and may be legally privileged.
It is intended solely for the addressee. Access to this email by anyone else
is unauthorised. If you are not the intended recipient, any disclosure,
copying, distribution, or any action taken or omitted to be taken in
reliance on it, is prohibited and may be unlawful. TriSystems Ltd. cannot
accept liability for statements made which are clearly the senders own.
From karimy@nipltd.com Tue Jun 5 09:35:58 2001
From: karimy@nipltd.com (Karim Yaici)
Date: Tue, 5 Jun 2001 09:35:58 +0100
Subject: [Tutor] small (I hope) questions
References: <3B1BE0B2.5D744AF8@mail.nhn.ou.edu>
Message-ID: <009c01c0ed9a$8b74ad80$a5020a0a@private.nipltd.com>
> a) I am trying to produce a pie chart of just random numbers in a
> list to get started with this, however Im confused as to how to call up
> a canvas, and draw the chart.
Just to answer to this question. I have used sometime ago a library called
GDChart which allows the creation of charts (lines, pie...) as PNG,
GIF...which you can then used with GUI. I though you might find it useful.
Here is the link http://athani.pair.com/msteed/software/gdchart/
Cheers
Karim
From unsubscribe@virtualgamblinghouse.com Tue Jun 5 10:19:40 2001
From: unsubscribe@virtualgamblinghouse.com (Orbital casino)
Date: Tue, 5 Jun 2001 11:19:40 +0200
Subject: [Tutor] Orbital casino
Message-ID: <200106050919.LAA03240@smtp.fol.nl>
This is a multi-part message in MIME format.
--orbitalcasino991732780
Content-Type: multipart/alternative;
boundary="orbitalcasino991732780xx"
--orbitalcasino991732780xx
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
--------------------------------------
$ 10 FREE - NO PURCHASE NECESSARY!!!
--------------------------------------
Orbital Online Casino offers new Players
-- $10 FREE - NO PURCHASE NECESSARY!--
All you have to do is download the FREE
software and open a Real Account. On top
of this great DEAL, they are offering
you a 100% First Purchase Bonus!!!!!
That`s right, whatever your first Deposit
into your Real account is, Orbital Online
Casino will match your purchase up to
$100!! See for yourself why Orbital Online
Casino is the SAFEST BET on the NET
::CLICK HERE::
http://www.virtualgamblinghouse.com
--------------------------------------
To claim your FREE cash!!
--------------------------------------
If you no longer wish to receive further
e-mails from Virtualgamblinghouse, please
reply to:
--unsubscribe@virtualgamblinghouse.com--
with the single word "unsubscribe" as the
subject of the message. Your name will
then be removed from our mailing list.
--orbitalcasino991732780xx
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: Base64
PCFET0NUWVBFIEhUTUwgUFVCTElDICItLy9XM0MvL0RURCBIVE1MIDQuMCBUcmFuc2l0aW9u
YWwvL0VOIj4KCjxodG1sPgo8aGVhZD4KCTx0aXRsZT5vIHIgYiBpIHQgYSBsICZuYnNwO28g
biBsIGkgbiBlICZuYnNwO2MgYSBzIGkgbiBvPC90aXRsZT4KPC9oZWFkPgoKPGJvZHkgYmdj
b2xvcj0iV2hpdGUiIGFsaW5rPSJCbGFjayIgdmxpbms9IkJsYWNrIiBsaW5rPSJCbGFjayI+
Cgo8dGFibGUgYm9yZGVyPSIwIiBjZWxscGFkZGluZz0iMCIgY2VsbHNwYWNpbmc9IjAiIHdp
ZHRoPSI2MDciPgo8dHI+Cgk8dGQgYWxpZ249ImNlbnRlciIgdmFsaWduPSJ0b3AiIHdpZHRo
P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PGZvbnQgc2l6ZT0iMSIgZmFjZT0iQXJpYWwsIEhlbHZldGlj
YSwgc2Fucy1zZXJpZiIgY29sb3I9ImJsYWNrIj4KCUlmIHlvdSBubyBsb25nZXIgd2lzaCB0
byByZWNlaXZlIGZ1cnRoZXIgZS1tYWlscyBmcm9tIFZpcnR1YWxnYW1ibGluZ2hvdXNlLCBw
bGVhc2UgcmVwbHkgdG8gPGEgaHJlZj0ibWFpbHRvOnVuc3Vic2NyaWJlQHZpcnR1YWxnYW1i
bGluZ2hvdXNlLmNvbSI+dW5zdWJzY3JpYmVAdmlydHVhbGdhbWJsaW5naG91c2UuY29tPC9h
Pgp3aXRoIHRoZSBzaW5nbGUgd29yZCAidW5zdWJzY3JpYmUiIGFzIHRoZSBzdWJqZWN0IDxi
cj5vZiB0aGUgbWVzc2FnZS4gWW91ciBuYW1lIHdpbGwgdGhlbiBiZSByZW1vdmVkIGZyb20g
b3VyIG1haWxpbmcgbGlzdC48YnI+PC9mb250Pgo8L3RkPgo8L3RyPgo8L3RhYmxlPgo8aW1n
IHNyYz0iaHR0cDovL3d3dy52aXJ0dWFsZ2FtYmxpbmdob3VzZS5jb20vc3AuZ2lmIj4KCjwv
Ym9keT4KPC9odG1sPgoK
--orbitalcasino991732780xx--
--orbitalcasino991732780
Content-Type: image/gif;
name="bg_01.jpg
"
Content-Transfer-Encoding: base64
Content-Location: bg_01.jpg
/9j/4AAQSkZJRgABAgAAZABkAAD/7AARRHVja3kAAQAEAAAAGwAA/+4ADkFkb2JlAGTAAAAA
Af/bAIQAEQwMDA0MEQ0NERkQDhAZHRYRERYdIhcXFxcXIiEaHRwcHRohISYoKygmITQ0ODg0
NEFBQUFBQUFBQUFBQUFBQQESEBATFRMXFBQXFhIVEhYcFhgYFhwpHBweHBwpNSYhISEhJjUv
MisrKzIvOTk1NTk5QUFBQUFBQUFBQUFBQUFB/8AAEQgBMgDIAwEiAAIRAQMRAf/EAJsAAAID
AQEAAAAAAAAAAAAAAAIDAAEEBQY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3HWcmzS+Wcx9x3Xw97zCnyzmfDY7r4e75heP0Zvsz12/7Y3Jo07bf3LK0yrKHQR8
q5p7huvh7vmAvlPNfcN18Pd8wrrn4E9mLmbT7tUeaQnOri1RYGTc7q5uMJvyVlHoLXKea1x2
G6+Hu+YX/tXNfcN18Pd8wJpj4avutmLtGKSowo4o1y5VzRr/AOBuvh7vmFR5VzVZ7DdfD3fM
HFYzrnrPuyPAtS6cTXLlXNHlsN18Pd8wr/aebe4br4e75hYq8p3n3ZWo0TjnxQNDauVc19w3
Xw93zC3yrmmf8Buq/wD17vmDijy17xixL7TX/tPNPcN18Pd8wv8A2rmnuG6+Hu+YWF5TvPuy
aegmk2LlfNPcN18Pd8wJcs5nx2O6+Hu+YWKfLXvPuyJF6KdhrXLeZe47r4e75gS5dzHjsd18
Pe8wcLy17z7s0Ymuzb6yLl/MV/od18Pe8wZDacyi8Nluvh73mGozbO8a7VvBEDsw3cUtez3S
/wDGv+zIaYzM9XvyEIZc0IQhJCEISQhCEkIQhJCEISQhCEkIQhJCEISQhCEkIQhJCEISQhCE
n//Z
--orbitalcasino991732780
Content-Type: image/gif;
name="bg_02.jpg
"
Content-Transfer-Encoding: base64
Content-Location: bg_02.jpg
/9j/4AAQSkZJRgABAgAAZABkAAD/7AARRHVja3kAAQAEAAAAGwAA/+4ADkFkb2JlAGTAAAAA
Af/bAIQAEQwMDA0MEQ0NERkQDhAZHRYRERYdIhcXFxcXIiEaHRwcHRohISYoKygmITQ0ODg0
NEFBQUFBQUFBQUFBQUFBQQESEBATFRMXFBQXFhIVEhYcFhgYFhwpHBweHBwpNSYhISEhJjUv
MisrKzIvOTk1NTk5QUFBQUFBQUFBQUFBQUFB/8AAEQgBMgGXAwEiAAIRAQMRAf/EALAAAAID
AQEBAAAAAAAAAAAAAAACAQMEBQYHAQADAQEBAAAAAAAAAAAAAAAAAQIDBAUQAAICAQEEBQcG
CQkIAwAAAAABAgMRBCExEgVBURPTBmEik1SUtBZxgZEy0hShY6NEdIQ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juhyuojiW1tZM0lw7Ude3T3yezSap/qt/
dmWei1j+rotV7Nd3YSuqGm5kyws6y1STIfL+Yb1otV7Nd9gI6PmS36HVez3fYMrVXJnZh7mN
LcBs9Ro01koTWJcKKlpeYeo6r2a77BP3XX+o6r2a77BEQzsWfHZQ71Xieho1Vah50vpEv5tp
4bIvil1I4fYcyxh6PV46vu932Bfuuu9S1Xs13dlO7gx2YJl3p/cjVfzS+zKi+CPkMcpuTzJ5
b6XtG+66/wBS1Xs132BJaXmWNmg1T/V7fsEPczZZMNVpeq8RXIqsvhFbX9BFmj5zLYuX6pL9
Ht+wUvlfN3v0Gq9nt+wNV6mV+8qlFWVWamct2xFDedpr/ZPNv/X6r2e37Afsnm3/AK/Vez2/
YKWhx2y2txZjwyUjX+yea7/2fqs/o9v2CY8p5q352g1SX6Pb9gGyUl5l7zHtexLLL6tPlpy3
myvlevh+Y6r2e77BdHQ67p0Wq9mu+wZWtZ8mdWKmJa2vSf8AkiiEMIsUS5aPXepar2a7ux1p
dZ6nqvZru7Mmrv5X7jrrkwpRvp/cilRY2C37trfU9V7Nd3Zv5d4d5jr5RlqIS0Wjb8+U/N1E
47dkIb4Z65YfkJVLNxDHbuMVVO+r+hybuQwlX4Z5lqJ+bVqHfbXJtba41Rq4vkzW8eTaB6T7
ppvun3Ls1917Psey6Oy4eDh+jYB1bfh2+yDyPU/F9SPn3/XJcAAUZgAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAH//2Q==
--orbitalcasino991732780
Content-Type: image/gif;
name="clickhere.gif
"
Content-Transfer-Encoding: base64
Content-Location: clickhere.gif
R0lGODlhuQAhAMQQAHFvmJiWtEtIfMzL2vLy9rKxx4uJq+Xl7FhVhtjY42Vij6Wkvn58or++
0P///z47c////wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
ACH5BAEAABAALAAAAAC5ACEAAAX/ICSOZGmeaKqubOu+cCzPdG3feK7vfO//wKDIQSwaj8ik
cslsOp/QqHQKhREf2Kx2y+16v+CweEwum89kYsuBbrvf8Lhc7lix5/i8fs/v1lF3fYKDhIVe
fyaBhlsARABbAVdojQ6PaEQBi4uIJIqaWZSWWZGeZKFtmJ+GnEOqjI5bCACiZqeXDpmug6wQ
pXkCAQMDCwhctqABubELwgECxrDAyWm4CgXDxVzAwsRdyQAGA8pZBg0DBbR7vL5zCAdGBNmg
sFqkXAwERgnQlQ8DDgQUUEsA75kWAQSLBORC5J+DfVoKHDEgaJ2gBgAN4HNQ4FW/epK05EvA
gBRFLaEk/zo4OaZIAAAqWWKRSEAjwQMMiRxIsECLAUwAMDqQp8ciHwGpHgRoMO7BMSz2tDAg
IvBBgQIynRIRmjVMQyxIcW1JqoBeFp3PDGL5NyBLvqZ4jO55yi9d1FEhvVAqks6rWCxJsVAq
kIxUUyIdc4pL9q4tH7l66Hq0m1dpZX4AHTimpiyw1iSH/45Nsrlooj5lV2JB8FLtZ8qeSGUD
8NIjOiJdvwT2nJqBX7gP8vVcdbpP45lEXNO9uzrpO4jz+kk84BrMbtFY3jWAqrm65yzTnzVK
0HcOZD0/HewkMjw6bC4qE7xz4BtltLecz2K3rD7h9tHApUaAQ9T1cZ4eAeTDXn5dkFwmwAIK
dWVLJPG0JNp3SinIUXUPYCjYfJpV9Vhxg8zC4RsCzKKLMQCcSIYCABA1YgnsrGjjjZucUCOO
PPZoHiA+Binkj0AOaeSRLdmB5JJMnrXGjk1GqYoaL1Bh5ZVYZqnlllcK4eWXYIYp5phklmnm
mWimqeaabLb5ZQgAOw==
--orbitalcasino991732780
Content-Type: image/gif;
name="invisible.gif
"
Content-Transfer-Encoding: base64
Content-Location: invisible.gif
R0lGODlhCgAKAIAAAP///wAAACH5BAEAAAAALAAAAAAKAAoAAAIIhI+py+0PYysAOw==
--orbitalcasino991732780
Content-Type: image/gif;
name="logo.gif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SKEQR+EWIGPC5CJb7Q5wH
QQEUhk0UOHCSBdxM5jOkwchvDiIhEIBCQZShAyvyA5575Yc5TOwQRZhiIfKAgzNUsBBkCPIg
DP20P6zhDWkWhAbs1wFNh2ILP7BAHArh44IRYgdTELXP2kg3CAmkaA3KznMUfsBnQ1AgDHAg
hATOs4ZO/8ECcPA2Bfjs4y2QmRBwgMMR6Jzjdrv73fCOt7znTe962/ve+M63vvfN7367IhAA
Ow==
--orbitalcasino991732780--
From unsubscribe@virtualgamblinghouse.com Tue Jun 5 10:19:44 2001
From: unsubscribe@virtualgamblinghouse.com (Orbital casino)
Date: Tue, 5 Jun 2001 11:19:44 +0200
Subject: [Tutor] Orbital casino
Message-ID: <200106050919.LAA03253@smtp.fol.nl>
This is a multi-part message in MIME format.
--orbitalcasino991732784
Content-Type: multipart/alternative;
boundary="orbitalcasino991732784xx"
--orbitalcasino991732784xx
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
--------------------------------------
$ 10 FREE - NO PURCHASE NECESSARY!!!
--------------------------------------
Orbital Online Casino offers new Players
-- $10 FREE - NO PURCHASE NECESSARY!--
All you have to do is download the FREE
software and open a Real Account. On top
of this great DEAL, they are offering
you a 100% First Purchase Bonus!!!!!
That`s right, whatever your first Deposit
into your Real account is, Orbital Online
Casino will match your purchase up to
$100!! See for yourself why Orbital Online
Casino is the SAFEST BET on the NET
::CLICK HERE::
http://www.virtualgamblinghouse.com
--------------------------------------
To claim your FREE cash!!
--------------------------------------
If you no longer wish to receive further
e-mails from Virtualgamblinghouse, please
reply to:
--unsubscribe@virtualgamblinghouse.com--
with the single word "unsubscribe" as the
subject of the message. Your name will
then be removed from our mailing list.
--orbitalcasino991732784xx
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: Base64
PCFET0NUWVBFIEhUTUwgUFVCTElDICItLy9XM0MvL0RURCBIVE1MIDQuMCBUcmFuc2l0aW9u
YWwvL0VOIj4KCjxodG1sPgo8aGVhZ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PSacsKVWx8bKzeYuCSlWtUMd+SwUQv0a1xOotLihcp1
wKldlLN4AZ8SkV27JRslCUZWIsrx6CVImy8H1EULVOihKULSJCUesZCMioo0W41NSM1dpXIZ
ZPgQ12raIawPJ2OcWpW+d7uM1T+I7u/af6UFbhZdOtSt49q6Tm33ajg8+hHsuc8pjzOxHRPu
t1Zq7F3gtVNUJrjGVFX6GsUeP3fKua7aei/s7snjpnYjLcW5JcU7cXJf3oxMXTNy6er3yaTX
t3Zo73usEtVMuwq5ze7VaYpJcAZbDfPLZbr4a97MW+Xcx9y3Xw97zA8J2a/f/wCoC7zPdXHg
1HsRmneu3HWcmzS+Wcx9x3Xw97zCnyzmfDY7r4e75heP0Zvsz12/7Y3Jo07bf3LK0yrKHQR8
q5p7huvh7vmAvlPNfcN18Pd8wrrn4E9mLmbT7tUeaQnOri1RYGTc7q5uMJvyVlHoLXKea1x2
G6+Hu+YX/tXNfcN18Pd8wJpj4avutmLtGKSowo4o1y5VzRr/AOBuvh7vmFR5VzVZ7DdfD3fM
HFYzrnrPuyPAtS6cTXLlXNHlsN18Pd8wr/aebe4br4e75hYq8p3n3ZWo0TjnxQNDauVc19w3
Xw93zC3yrmmf8Buq/wD17vmDijy17xixL7TX/tPNPcN18Pd8wv8A2rmnuG6+Hu+YWF5TvPuy
aegmk2LlfNPcN18Pd8wJcs5nx2O6+Hu+YWKfLXvPuyJF6KdhrXLeZe47r4e75gS5dzHjsd18
Pe8wcLy17z7s0Ymuzb6yLl/MV/od18Pe8wZDacyi8Nluvh73mGozbO8a7VvBEDsw3cUtez3S
/wDGv+zIaYzM9XvyEIZc0IQhJCEISQhCEkIQhJCEISQhCEkIQhJCEISQhCEkIQhJCEISQhCE
n//Z
--orbitalcasino991732784
Content-Type: image/gif;
name="bg_02.jpg
"
Content-Transfer-Encoding: base64
Content-Location: bg_02.jpg
/9j/4AAQSkZJRgABAgAAZABkAAD/7AARRHVja3kAAQAEAAAAGwAA/+4ADkFkb2JlAGTAAAAA
Af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DyPU/F9SPn3/XJcAAUZgAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAH//2Q==
--orbitalcasino991732784
Content-Type: image/gif;
name="clickhere.gif
"
Content-Transfer-Encoding: base64
Content-Location: clickhere.gif
R0lGODlhuQAhAMQQAHFvmJiWtEtIfMzL2vLy9rKxx4uJq+Xl7FhVhtjY42Vij6Wkvn58or++
0P///z47c////wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
ACH5BAEAABAALAAAAAC5ACEAAAX/ICSOZGmeaKqubOu+cCzPdG3feK7vfO//wKDIQSwaj8ik
cslsOp/QqHQKhREf2Kx2y+16v+CweEwum89kYsuBbrvf8Lhc7lix5/i8fs/v1lF3fYKDhIVe
fyaBhlsARABbAVdojQ6PaEQBi4uIJIqaWZSWWZGeZKFtmJ+GnEOqjI5bCACiZqeXDpmug6wQ
pXkCAQMDCwhctqABubELwgECxrDAyWm4CgXDxVzAwsRdyQAGA8pZBg0DBbR7vL5zCAdGBNmg
sFqkXAwERgnQlQ8DDgQUUEsA75kWAQSLBORC5J+DfVoKHDEgaJ2gBgAN4HNQ4FW/epK05EvA
gBRFLaEk/zo4OaZIAAAqWWKRSEAjwQMMiRxIsECLAUwAMDqQp8ciHwGpHgRoMO7BMSz2tDAg
IvBBgQIynRIRmjVMQyxIcW1JqoBeFp3PDGL5NyBLvqZ4jO55yi9d1FEhvVAqks6rWCxJsVAq
kIxUUyIdc4pL9q4tH7l66Hq0m1dpZX4AHTimpiyw1iSH/45Nsrlooj5lV2JB8FLtZ8qeSGUD
8NIjOiJdvwT2nJqBX7gP8vVcdbpP45lEXNO9uzrpO4jz+kk84BrMbtFY3jWAqrm65yzTnzVK
0HcOZD0/HewkMjw6bC4qE7xz4BtltLecz2K3rD7h9tHApUaAQ9T1cZ4eAeTDXn5dkFwmwAIK
dWVLJPG0JNp3SinIUXUPYCjYfJpV9Vhxg8zC4RsCzKKLMQCcSIYCABA1YgnsrGjjjZucUCOO
PPZoHiA+Binkj0AOaeSRLdmB5JJMnrXGjk1GqYoaL1Bh5ZVYZqnlllcK4eWXYIYp5phklmnm
mWimqeaabLb5ZQgAOw==
--orbitalcasino991732784
Content-Type: image/gif;
name="invisible.gif
"
Content-Transfer-Encoding: base64
Content-Location: invisible.gif
R0lGODlhCgAKAIAAAP///wAAACH5BAEAAAAALAAAAAAKAAoAAAIIhI+py+0PYysAOw==
--orbitalcasino991732784
Content-Type: image/gif;
name="logo.gif
"
Content-Transfer-Encoding: base64
Content-Location: logo.gif
R0lGODlhhQBIAOZ/APXHV7CxtJhuB9GqT+eqFu7Kd3WIr3Fwa7rE2al6CbWDCfPTiNWZC29R
B4aVseSlDseucCI1WvX08v735ujr83F6itXb5ixBbLW8yee0O9zh7OetIykrLJqt08/Iuq2S
TcyTC/bis//+/ExRWui4RfW5KkdTaHFlSeixK62ccBs1aoJ2U8TGyY5xKsWYKqm41vz58+7w
9a+li/PaoMTK1cSNCZmcn0Q3FfH0+V1rhbykZ8vU5+e8VPC9ROvr6tLW3P79+ZekvaaGOMq7
muTj4fX4/Nzc3M3S2++5OpiPdaayyIKEhdHS0lxiadyfDtirPkZBM/j4+PvEPvf394aKlnOQ
ydjUx/KyF8uUFODl8GJRJeXo7+/r4lNtpOSvMoReBdSbINXY3zBLgEddiaGsw/v9/8OeSK++
2/Hw7/f6/5SRhr/L4ZWAStDBnF1ECvz7+t3f4+bm5mRcR4ucv3hlNWp9pIU6a8/P0NjX1dbf
8L6JCeKhBjQ6Rdy6Zf///////yH5BAEAAH8ALAAAAACFAEgAAAf/gH+Cg4SFhoeIiYqLjI2O
j5CRkpOUlZaXmJmam5ydnp+goaKjpKWmp6ipqqusra6vsLGys7SjMhA8BTMACwsFAH0QtcOI
YwdCLhslUlIAADMhITPQMwsAFcTZfystXw1u4F8KKD0FIVzR1QB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QDZjkbV9VENLePgOvyHtDb0X6LATwxLkEheoEWOIFnVUEVdL4H3Ua4QI/TXR52sSvZHm4X
p45pgQucgIWqLMUbWSFveRvRgqlYtbVUqYpx3csY+HLEDiZogIIVDI787rcSX7Cv/6kmTOCr
wDcC+rWDClRgT/0+OBJ2uEEDvnBQxtAlK1rx8IdBYQcO8IEDKOYDhldM4xrb+MY4NsQbXkAD
OxHCD2UQRIMGkYchgw8HhCiDH7zTpEFUwQ87sN0hFMfBQZTBB3kIGQICaOWUDQJoQi7E2aYw
CiBYMA/3GkQRqPSHBv5hB0UoxBqO92UqPTlFgniyBaqsYy8X4ngSKEQR+EWIGPC5CJb7Q5wH
QQEUhk0UOHCSBdxM5jOkwchvDiIhEIBCQZShAyvyA5575Yc5TOwQRZhiIfKAgzNUsBBkCPIg
DP20P6zhDWkWhAbs1wFNh2ILP7BAHArh44IRYgdTELXP2kg3CAmkaA3KznMUfsBnQ1AgDHAg
hATOs4ZO/8ECcPA2Bfjs4y2QmRBwgMMR6Jzjdrv73fCOt7znTe962/ve+M63vvfN7367IhAA
Ow==
--orbitalcasino991732784--
From arcege@speakeasy.net Tue Jun 5 12:50:53 2001
From: arcege@speakeasy.net (Michael P. Reilly)
Date: Tue, 5 Jun 2001 07:50:53 -0400 (EDT)
Subject: [Tutor] small (I hope) questions
In-Reply-To: <3B1BE0B2.5D744AF8@mail.nhn.ou.edu> from "Isaac Hall" at Jun 04, 2001 02:25:38 PM
Message-ID: <200106051150.f55BorL03332@dsl092-074-184.bos1.dsl.speakeasy.net>
Isaac Hall wrote
> first, let me introduce myself a little as I am new to this list (but
Welcome.
> I may well be widely known as the guy with all the dumb questions
> soon...I hope not) Ive just begun working with Python and Tkinter in
> physics applications, and Im getting stuck in some fairly minor aspects
> of this. I have previously only programmed in C/C++. anyway my
> question(s) are:
> a) I am trying to produce a pie chart of just random numbers in a
> list to get started with this, however Im confused as to how to call up
> a canvas, and draw the chart.
All you need is a little math to get the values properly set up (but then
this will be the same with just about any package.
Here is a segment to help you start:
size = (200, 200)
graph = Canvas(graphicframe, height=size[0], width=size[1])
# get the total representing the circumference
sum = reduce(operator.add, values)
# starting angle
lastangle = 0.0
for i in range(len(values)):
item = values[i]
# how much of the pie do we eat up
percentage = (item / sum)
# calculate ending angle based on that percentage
newangle = lastangle + (percentage * 360.0)
# create a new pie arc in the circle
# the "get_indexed_color()" function is something you'll need to
# write, you should get a unique color for each value, probably
# not repeat the colors, and likely start with the primary colors
# (red, yellow, blue) first
graph.create_arc(0, 0, size[0], size[1],
start=lastangle, extent=newangle,
fill=get_indexed_color(i),
style='pieslice'
)
lastangle=newangle
You probably have to tweek things to get the details to work (I'm not
feeling well, so not going to fully debug this, sorry), but all you need
is a little geometry.
> b) in addition to the pie chart, I also need to put these numbers in
> a table (which I have figured out, however I would like to be able to
> create this so that the pie chart comes up first, and then clicking on
> the pie chart will display the table.
Do you want a new window with the table (look at Toplevel)? Do you
want a new area of the window (with the pie chart) to display the table
(you can just use pack for this)? The methods for these are different.
-Arcege
--
+----------------------------------+-----------------------------------+
| Michael P. Reilly | arcege@speakeasy.net |
From curtis.larsen@Covance.Com Tue Jun 5 15:23:05 2001
From: curtis.larsen@Covance.Com (Curtis Larsen)
Date: Tue, 05 Jun 2001 09:23:05 -0500
Subject: [Tutor] De-CSV-ing Resolved
Message-ID:
Thanks to everyone who replied I now have:
o A further understanding of exception usage
o A nice little function to test with, and
o A site that "high-level" explains such algorithms
Thanks again!
Curtis
-----------------------------------------------------
Confidentiality Notice: This e-mail transmission
may contain confidential or legally privileged
information that is intended only for the individual
or entity named in the e-mail address. If you are not
the intended recipient, you are hereby notified that
any disclosure, copying, distribution, or reliance
upon the contents of this e-mail is strictly prohibited.
If you have received this e-mail transmission in error,
please reply to the sender, so that we can arrange
for proper delivery, and then please delete the message
from your inbox. Thank you.
From MuraleeKrishnanR. Tue Jun 5 18:00:33 2001
From: MuraleeKrishnanR. (MuraleeKrishnanR.)
Date: 5 Jun 2001 11:00:33 MDT
Subject: [Tutor] Hello
Message-ID: <20010605170033.21022.qmail@nwcst313.netaddress.usa.net>
Hello all,
=
This is the first time i am mailing in this list..
i am a beginner in Python programming. I am stuck up
somewhere so I thought someone would be able to help
me out.
The following is the error message when i wrote a
program for implementing Tkinter
---------------------------------------------
C:\Python21>python gui.py
Traceback (most recent call last):
File "gui.py", line 3, in ?
top =3D Tkinter.Tk()
File "c:\python21\lib\lib-tk\Tkinter.py", line 1480,
in __init__
self.tk =3D _tkinter.create(screenName, baseName,
className)
TclError: Can't find a usable init.tcl in the
following directories:
{} C:/PYTHON21/lib/tcl8.3 C:/lib/tcl8.3 lib/tcl8.3
lib/tcl8.3/library librar
y ../tcl8.3/library
This probably means that Tcl wasn't installed
properly.
------------------------------------------------------
>
Hope someone would help me..
regards,
Murali
____________________________________________________________________
Get free email and a permanent address at http://www.netaddress.com/?N=3D=
1
From cynic@mail.cz Tue Jun 5 20:07:39 2001
From: cynic@mail.cz (Cynic)
Date: Tue, 05 Jun 2001 21:07:39 +0200
Subject: [Tutor] Hello
In-Reply-To: <20010605170033.21022.qmail@nwcst313.netaddress.usa.net>
Message-ID: <5.1.0.14.2.20010605210203.02081e78@mail.cz>
No guarantees...
Append the directory where init.tcl lives either to $PYTHONPATH
or (in the script) to sys.path.
At 19:00 5.6. 2001, Muralee Krishnan R. wrote the following:
--------------------------------------------------------------
>Hello all,
>
> This is the first time i am mailing in this list..
> i am a beginner in Python programming. I am stuck up
> somewhere so I thought someone would be able to help
> me out.
> The following is the error message when i wrote a
> program for implementing Tkinter
> ---------------------------------------------
> C:\Python21>python gui.py
> Traceback (most recent call last):
> File "gui.py", line 3, in ?
> top = Tkinter.Tk()
> File "c:\python21\lib\lib-tk\Tkinter.py", line 1480,
> in __init__
> self.tk = _tkinter.create(screenName, baseName,
> className)
> TclError: Can't find a usable init.tcl in the
> following directories:
> {} C:/PYTHON21/lib/tcl8.3 C:/lib/tcl8.3 lib/tcl8.3
> lib/tcl8.3/library librar
> y ../tcl8.3/library
>
>
>
> This probably means that Tcl wasn't installed
> properly.
> ------------------------------------------------------
>>
> Hope someone would help me..
>
>regards,
>Murali
>
>____________________________________________________________________
>Get free email and a permanent address at http://www.netaddress.com/?N=1
>
>_______________________________________________
>Tutor maillist - Tutor@python.org
>http://mail.python.org/mailman/listinfo/tutor
------end of quote------
cynic@mail.cz
-------------
And the eyes of them both were opened and they saw that their files
were world readable and writable, so they chmoded 600 their files.
- Book of Installation chapt 3 sec 7
From _cardiac_@yahoo.com Tue Jun 5 22:02:11 2001
From: _cardiac_@yahoo.com (CARDIAC ARREST)
Date: Tue, 5 Jun 2001 14:02:11 -0700 (PDT)
Subject: [Tutor] (no subject)
Message-ID: <20010605210211.926.qmail@web13901.mail.yahoo.com>
I need some more simple instructions on learning to
program with python ... the only programming i know is
VERY basic html .. some of the things that are writen
a just cant understand .. i dont want to know how to
do 2+2 etc i wanna know how to make something i know
this is part of the 1st steps but
__________________________________________________
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail - only $35
a year! http://personal.mail.yahoo.com/
From brett@earthlight.co.nz Tue Jun 5 22:10:05 2001
From: brett@earthlight.co.nz (Brett Shand)
Date: Wed, 6 Jun 2001 09:10:05 +1200
Subject: [Tutor] (no subject)
In-Reply-To: <20010605210211.926.qmail@web13901.mail.yahoo.com>
Message-ID: <3B1DF36D.22407.381D006@localhost>
I am in a somewhat similar situation. I am using "Learning Python"
by Lutz and Ascher. I recommend it very highly.
You can get more information here:
http://www.oreilly.com/catalog/lpython/
brett
---------------------------------------------
On 5 Jun 2001, at 14:02, CARDIAC ARREST wrote:
> I need some more simple instructions on learning to
> program with python ... the only programming i know is
> VERY basic html .. some of the things that are writen
> a just cant understand .. i dont want to know how to
> do 2+2 etc i wanna know how to make something i know
> this is part of the 1st steps but
>
> __________________________________________________
> Do You Yahoo!?
> Get personalized email addresses from Yahoo! Mail - only $35
> a year! http://personal.mail.yahoo.com/
>
> _______________________________________________
> Tutor maillist - Tutor@python.org
> http://mail.python.org/mailman/listinfo/tutor
>
From _cardiac_@yahoo.com Tue Jun 5 22:14:48 2001
From: _cardiac_@yahoo.com (CARDIAC ARREST)
Date: Tue, 5 Jun 2001 14:14:48 -0700 (PDT)
Subject: [Tutor] (no subject)
Message-ID: <20010605211448.6518.qmail@web13905.mail.yahoo.com>
ok i dont think i was detialed enough in the last
message i was frustrated :P anyway what im trying to
find is like a program example icq something that
is made with mostly or all python that i can see the
code and build on it i learn best by watching/ looking
then doing if someone gave me the code to example icq
or something complex i code write it line by line
then see how it comes together if someone has a
program like this that i could use i will sign a
agreement or whatever that i wont try to sell it or
all that junk i just want to LEARN!!! HELP PLEASE!!!
Thank you all
__________________________________________________
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail - only $35
a year! http://personal.mail.yahoo.com/
From kauphlyn@speakeasy.org Tue Jun 5 22:56:28 2001
From: kauphlyn@speakeasy.org (Daniel Coughlin)
Date: Tue, 5 Jun 2001 14:56:28 -0700 (PDT)
Subject: [Tutor] (no subject)
In-Reply-To: <20010605211448.6518.qmail@web13905.mail.yahoo.com>
Message-ID:
You might find some interesting stuff on
http://www.lowerstandard.com/python/pythonsource.html
On Tue, 5 Jun 2001, CARDIAC ARREST wrote:
> ok i dont think i was detialed enough in the last
> message i was frustrated :P anyway what im trying to
> find is like a program example icq something that
> is made with mostly or all python that i can see the
> code and build on it i learn best by watching/ looking
> then doing if someone gave me the code to example icq
> or something complex i code write it line by line
> then see how it comes together if someone has a
> program like this that i could use i will sign a
> agreement or whatever that i wont try to sell it or
> all that junk i just want to LEARN!!! HELP PLEASE!!!
>
> Thank you all
>
>
> __________________________________________________
> Do You Yahoo!?
> Get personalized email addresses from Yahoo! Mail - only $35
> a year! http://personal.mail.yahoo.com/
>
> _______________________________________________
> Tutor maillist - Tutor@python.org
> http://mail.python.org/mailman/listinfo/tutor
>
From rob@jam.rr.com Tue Jun 5 22:09:02 2001
From: rob@jam.rr.com (Rob Andrews)
Date: Tue, 5 Jun 2001 16:09:02 -0500
Subject: [Tutor] (no subject)
References: <20010605210211.926.qmail@web13901.mail.yahoo.com>
Message-ID: <002501c0ee03$d78c90c0$de00a8c0@planhouse5>
----- Original Message -----
From: "CARDIAC ARREST" <_cardiac_@yahoo.com>
To:
Sent: Tuesday, June 05, 2001 4:02 PM
Subject: [Tutor] (no subject)
> I need some more simple instructions on learning to
> program with python ... the only programming i know is
> VERY basic html .. some of the things that are writen
> a just cant understand .. i dont want to know how to
> do 2+2 etc i wanna know how to make something i know
> this is part of the 1st steps but
>
No problem! There are a number of good tutorials on the web, and here's a
page with links to a good number of them:
http://www.lowerstandard.com/python/tutoriallinks.html
Rob
Useless Python
It's not just for breakfast anymore!
http://www.lowerstandard.com/python/index.html
From phil@xfr.co.uk Tue Jun 5 23:11:07 2001
From: phil@xfr.co.uk (Philip Kilner)
Date: Tue, 05 Jun 2001 23:11:07 +0100
Subject: [Tutor] (no subject)
In-Reply-To: <20010605211448.6518.qmail@web13905.mail.yahoo.com>
References: <20010605211448.6518.qmail@web13905.mail.yahoo.com>
Message-ID:
Hello,
In article <20010605211448.6518.qmail@web13905.mail.yahoo.com>, Cardiac
Arrest wrote:
> like a program example icq something that
> is made with mostly or all python that i can see the
> code and build on it
I'm nowhere near that level of complexity, but I can help you find
Python resources. For ICQ-type applications, I took a look at:-
http://www.jabber.org
- and there is indeed a Python tool (Python/Gnome actually).
It's at:-
http://pybber.sourceforge.net/
There's also an AIM (AOL IM) client at:-
http://www.z3p.f2s.com/download/code/toc.py
(Pulls up source in browser!)
I found this for you in the Vaults of Parnassus;-
http://www.vex.net/parnassus/
This is the first place I would look for downloadable python apps with
source - but I'd be looking for something simpler...
I don't know if any of the IM resources are any good - I'm just trying
to help you find stuff - but Parnassus is a fabulous resource.
HTH,
PhilK
From python.tutorial@jarava.org Wed Jun 6 00:57:04 2001
From: python.tutorial@jarava.org (Javier JJ)
Date: Wed, 6 Jun 2001 01:57:04 +0200
Subject: [Tutor] Access to Windows Timers / Idle "states"??
Message-ID: <006901c0ee1b$39375870$0124a8c0@uno>
Hi all!!
After some "lurking" on the list (and not too much time to program, either
:-) I've decided to jump with both feet in :-)
I'm trying to make a program that can handle "timers" (ie, set a timer for
"x" seconds later) and / or "register" itself to recieve windows events.
The idea is, when I launch this program, I want to be able to set a certain
amount of time after whihc I want my program to do something (namely, kill
another program :-)
At the moment, the "killing another program" would be handled with the
pslist and pskill utils from sysinternals, so I "only" want to be able to
set a timer...
Alternatively, I'd like to be able to "know" when the "idle" process kicks
in, like to know when the countdown for the screensaver starts....
The thing is, I have a program that every now and then locks itself solid
and the only way out is a hard reboot (even in W2k, ctrl-alt-del won't work,
even though the OS "seems" to be getting the keys, and the mouse cursor
moves). So, I'd like to be able to "sense" when the OS hasn't been getting
any imput (keys / mouse) for a set period of time and, if that happens,
it'll just kill the offending process....
Am I making any sense at all?
Any and all help would be greatly appreciated.
TIA
Javier
----
Hm..what's this red button fo:=/07
A big THANK YOU for the replies i have got from my
post i wasnt sure about doing it but im glad i did
thank you all again!!!
__________________________________________________
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail - only $35
a year! http://personal.mail.yahoo.com/
From ak@silmarill.org Wed Jun 6 01:30:50 2001
From: ak@silmarill.org (ak@silmarill.org)
Date: Tue, 05 Jun 2001 20:30:50 -0400
Subject: [Tutor] Access to Windows Timers / Idle "states"??
In-Reply-To: <"from python.tutorial"@jarava.org>
References: <006901c0ee1b$39375870$0124a8c0@uno>
Message-ID: <20010605203050.A24683@sill.silmarill.org>
On Wed, Jun 06, 2001 at 01:57:04AM +0200, Javier JJ wrote:
> Hi all!!
>
> After some "lurking" on the list (and not too much time to program, either
> :-) I've decided to jump with both feet in :-)
>
> I'm trying to make a program that can handle "timers" (ie, set a timer for
> "x" seconds later) and / or "register" itself to recieve windows events.
>
> The idea is, when I launch this program, I want to be able to set a certain
> amount of time after whihc I want my program to do something (namely, kill
> another program :-)
>
> At the moment, the "killing another program" would be handled with the
> pslist and pskill utils from sysinternals, so I "only" want to be able to
> set a timer...
>
> Alternatively, I'd like to be able to "know" when the "idle" process kicks
> in, like to know when the countdown for the screensaver starts....
>
> The thing is, I have a program that every now and then locks itself solid
> and the only way out is a hard reboot (even in W2k, ctrl-alt-del won't work,
> even though the OS "seems" to be getting the keys, and the mouse cursor
> moves). So, I'd like to be able to "sense" when the OS hasn't been getting
> any imput (keys / mouse) for a set period of time and, if that happens,
> it'll just kill the offending process....
>
> Am I making any sense at all?
Sort of :-). I don't use windows anymore, so I can only help with the timer
thing.. the command for it is time.sleep(5) to sleep for 5 seconds. If you want
to set hours or minutes, the way to do so is this: time.sleep(60*60*3.5) for 3.5
hours, for instance. Also, you have time.time() which gives you current time in
seconds from the start of epoch (~1970).
Anyway, in order for timer to work, here's what you can do:
sense_keypress()
time.sleep(60)
if not keypresses_happened():
os.kill(someprog)
Look at docs for os.kill.
time.time() you can use to tell how long something took, like this:
t = time.time()
do_something()
print 'do_something() took %d seconds' % (time.time() - t)
>
> Any and all help would be greatly appreciated.
>
> TIA
>
> Javier
>
> ----
>
> Hm..what's this red button fo:=/07
>
>
>
> _______________________________________________
> Tutor maillist - Tutor@python.org
> http://mail.python.org/mailman/listinfo/tutor
--
Lucifer Sam Siam cat
Always sitting by your side
Always by your side
That cat's something I can't explain
- Syd
From dsh8290@rit.edu Wed Jun 6 03:24:53 2001
From: dsh8290@rit.edu (D-Man)
Date: Tue, 5 Jun 2001 22:24:53 -0400
Subject: [Tutor] Access to Windows Timers / Idle "states"??
In-Reply-To: <006901c0ee1b$39375870$0124a8c0@uno>; from python.tutorial@jarava.org on Wed, Jun 06, 2001 at 01:57:04AM +0200
References: <006901c0ee1b$39375870$0124a8c0@uno>
Message-ID: <20010605222453.B14318@harmony.cs.rit.edu>
On Wed, Jun 06, 2001 at 01:57:04AM +0200, Javier JJ wrote:
...
| The thing is, I have a program that every now and then locks itself solid
| and the only way out is a hard reboot (even in W2k, ctrl-alt-del won't work,
| even though the OS "seems" to be getting the keys, and the mouse cursor
| moves).
I've seen this with win2k also. Sometimes it is the OS's own fault as
it tries to shutdown (though sometimes I wonder if it is really trying
...)
| So, I'd like to be able to "sense" when the OS hasn't been getting
| any imput (keys / mouse) for a set period of time and, if that
| happens, it'll just kill the offending process....
|
| Am I making any sense at all?
Yes -- you want to prevent your OS from locking up (IOW failing to
meet its requirements). The solution is much simpler : use Debian!
Sorry, not much help with the code, but I don't try and fix windows by
writing my own watchdog timer and am not sure how you would do
that reliably.
-D
From dyoo@hkn.eecs.berkeley.edu Wed Jun 6 07:53:38 2001
From: dyoo@hkn.eecs.berkeley.edu (Daniel Yoo)
Date: Tue, 5 Jun 2001 23:53:38 -0700 (PDT)
Subject: [Tutor] Converting problem sets from other languages into Python?
Message-ID:
Hiya everyone,
A while back, some people asked for sample problems that they could do to
test out their fluency in Python. Usually, self-motivated projects are
idea at letting people make their knowledge relevant, but sometimes,
people don't know where to start!
Perhaps we should also provide a small "problem set" repository. Sorta
like mini-exercises, with some hints at how to approach a problem.
Useless Python already does a little bit of this with its Python
Challenges at:
http://www.lowerstandard.com/python/pythonchallenge.html
and perhaps this can be extended with more problems.
In short: why not stea... er... convert problems from some textbooks to
make them Python-relevant? By providing these practical problems, we'd
let people gain more confidence as they find they can do these things.
Extending "Useless Python", we can have "Useless Python Problems".
*grin*
I have a few problems written in Scheme, which I should be able to convert
into Python:
http://hkn.eecs.berkeley.edu/~dyoo/cs3/doublets.pdf
http://hkn.eecs.berkeley.edu/~dyoo/cs3/wordprocessing.pdf
(which have too much of a CS flavor, admittedly, but I have to start
somewhere.)
What do people think?
From wheelege@tsn.cc Wed Jun 6 08:45:39 2001
From: wheelege@tsn.cc (Glen Wheeler)
Date: Wed, 6 Jun 2001 17:45:39 +1000
Subject: [Tutor] Converting problem sets from other languages into Python?
References:
Message-ID: <01e801c0ee5c$afeb28c0$0200a8c0@ACE>
> <...>
>
> What do people think?
>
Great idea!
Some good all-round computer problems can be found at
http://www.cse.unsw.edu.au/progcomp - just click on the links to see the
problems for the various years (the grand final ones are particularly fun
:).
Glen.
From wheelege@tsn.cc Wed Jun 6 09:41:18 2001
From: wheelege@tsn.cc (Glen Wheeler)
Date: Wed, 6 Jun 2001 18:41:18 +1000
Subject: [Tutor] Recursion
Message-ID: <021401c0ee64$75b65dc0$0200a8c0@ACE>
This is a multi-part message in MIME format.
------=_NextPart_000_0211_01C0EEB8.4655DFC0
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Hey all,
While fiddling around with maths, I thought it would be nice and cool =
to get all the possible permutations of a set, taken n at a time. I =
have been trying to get this to work nicely, but I'm just not familiar =
enough with recursion to get it to behave.
For example, if I wanted to get all the permutations of a set =
['a','b'] taken three at a time, I would write this :
>>> c =3D []
>>> s =3D ['a', 'b']
>>> for i1 in range(len(s)):
... for i2 in range(len(s)):
... for i3 in range(len(s)):
... c.append([s[i1], s[i2], s[i3]])
...=20
>>> for item in c: print item
...=20
['a', 'a', 'a']
['a', 'a', 'b']
['a', 'b', 'a']
['a', 'b', 'b']
['b', 'a', 'a']
['b', 'a', 'b']
['b', 'b', 'a']
['b', 'b', 'b']
Which is all well and good, but when I want to take them n at a time I =
need more for loops. Thus I thought 'Hmmm, I could get a function which =
calls itself n times...that would work!' - but I'm just too green with =
this sort of programming for it to happen for me.
Help?
Thanks,
Glen.
------=_NextPart_000_0211_01C0EEB8.4655DFC0
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Hey all,
While fiddling around with maths, I thought it would be nice =
and=20
cool to get all the possible permutations of a set, taken n at a =
time. I=20
have been trying to get this to work nicely, but I'm just not familiar =
enough=20
with recursion to get it to behave.
For example, if I wanted to get all the permutations of =
a set=20
['a','b'] taken three at a time, I would write this :
>>> c =3D []
>>> s =3D ['a', =
'b']
>>> for i1=20
in range(len(s)):
... for i2 in range(len(s)):
... =
for=20
i3 in range(len(s)):
... c.append([s[i1], s[i2],=20
s[i3]])
...
>>> for item in c: print item
... =
['a', 'a',=20
'a']
['a', 'a', 'b']
['a', 'b', 'a']
['a', 'b', 'b']
['b', =
'a',=20
'a']
['b', 'a', 'b']
['b', 'b', 'a']
['b', 'b', 'b']
Which is all well and good, but when I want to take them n =
at a time=20
I need more for loops. Thus I thought 'Hmmm, I could get a =
function which=20
calls itself n times...that would work!' - but I'm just too green =
with this=20
sort of programming for it to happen for me.
Help?
Thanks,
Glen.
------=_NextPart_000_0211_01C0EEB8.4655DFC0--
From scarblac@pino.selwerd.nl Wed Jun 6 10:28:03 2001
From: scarblac@pino.selwerd.nl (Remco Gerlich)
Date: Wed, 6 Jun 2001 11:28:03 +0200
Subject: [Tutor] Recursion
In-Reply-To: <021401c0ee64$75b65dc0$0200a8c0@ACE>; from wheelege@tsn.cc on Wed, Jun 06, 2001 at 06:41:18PM +1000
References: <021401c0ee64$75b65dc0$0200a8c0@ACE>
Message-ID: <20010606112803.A19167@pino.selwerd.nl>
On 0, Glen Wheeler wrote:
> Hey all,
>
> While fiddling around with maths, I thought it would be nice and cool to get all the possible permutations of a set, taken n at a time. I have been trying to get this to work nicely, but I'm just not familiar enough with recursion to get it to behave.
> For example, if I wanted to get all the permutations of a set ['a','b'] taken three at a time, I would write this :
>
> >>> c = []
> >>> s = ['a', 'b']
> >>> for i1 in range(len(s)):
> ... for i2 in range(len(s)):
> ... for i3 in range(len(s)):
> ... c.append([s[i1], s[i2], s[i3]])
> ...
> >>> for item in c: print item
> ...
> ['a', 'a', 'a']
> ['a', 'a', 'b']
> ['a', 'b', 'a']
> ['a', 'b', 'b']
> ['b', 'a', 'a']
> ['b', 'a', 'b']
> ['b', 'b', 'a']
> ['b', 'b', 'b']
>
> Which is all well and good, but when I want to take them n at a time I
> need more for loops. Thus I thought 'Hmmm, I could get a function which
> calls itself n times...that would work!' - but I'm just too green with this
> sort of programming for it to happen for me.
The way to think about recursion is solving the problem by solving a smaller
version of the problem first, until you get a smaller problem that's easy to
solve. In this case, the reasoning goes something like this:
You can get all the permutations of a list by taking each element in turn,
and then add to that element all the permutations of the *rest* of the list.
That rest is smaller than the list itself. And the problem is trivial for a
list of length 1 or 0. So we can use recursion.
We get something like this:
def permutations(L):
result = []
if len(L) <= 1:
# The single result is the list itself
result.append(L[:])
else:
for i in range(len(L)):
# We pick element i, and combine it with the permutations of the rest
rest = L[:i] + L[i+1:]
for permutation in permutations(rest):
result.append([L[i]]+permutation)
return result
--
Remco Gerlich
From dyoo@hkn.eecs.berkeley.edu Wed Jun 6 10:35:31 2001
From: dyoo@hkn.eecs.berkeley.edu (Daniel Yoo)
Date: Wed, 6 Jun 2001 02:35:31 -0700 (PDT)
Subject: [Tutor] Recursion
In-Reply-To: <021401c0ee64$75b65dc0$0200a8c0@ACE>
Message-ID:
On Wed, 6 Jun 2001, Glen Wheeler wrote:
> For example, if I wanted to get all the permutations of a set
> ['a','b'] taken three at a time, I would write this :
>
> >>> c = []
> >>> s = ['a', 'b']
> >>> for i1 in range(len(s)):
> ... for i2 in range(len(s)):
> ... for i3 in range(len(s)):
> ... c.append([s[i1], s[i2], s[i3]])
> ...
> >>> for item in c: print item
> ...
> ['a', 'a', 'a']
> ['a', 'a', 'b']
> ['a', 'b', 'a']
> ['a', 'b', 'b']
> ['b', 'a', 'a']
> ['b', 'a', 'b']
> ['b', 'b', 'a']
> ['b', 'b', 'b']
>
> Which is all well and good, but when I want to take them n at a time
> I need more for loops. Thus I thought 'Hmmm, I could get a function
> which calls itself n times...that would work!' - but I'm just too
> green with this sort of programming for it to happen for me.
Hello Glen!
To see the recursion, we should look at some small cases of the problem
first. As background for the others: the idea of recursion is to see a
relationship between the "big" version of a problem and a slightly smaller
version. By seeing this relationship, we may be able to solve the big
problem by taking advantage of the solution for the small one.
In this problem, we're measuring bigness by 'n at a time'. The bigger 'n'
gets, the larger the problem. Let's take a really close look at what the
program should do when n is equal to 1, 2, and 3. Once we do this, things
might look clearer (or more blurry, depending on how long we strain our
eyes... *grin*)
We know that taking the one_at_a_time() on this list ['a', 'b'] should
look like:
[ ['a'],
['b'] ]
Let's pretend we have that function to play with. We can imagine what the
result of two_at_a_time() looks like:
[ ['a', 'a'],
['a', 'b'],
['b', 'a'],
['b', 'b'] ]
I'm intensionally printing two_at_a_time()'s result in 2 visually distinct
blocks because, if we look at this for a little bit, we might see a small
pattern. In order to get two_at_a_time(), all we need to do is take every
element in one_at_a_time, and plunk either 'a' or 'b' in front. This can
be written as:
###
def two_at_a_time(L):
source = one_at_a_time(L)
c = []
for x in L:
for s in source:
c.append([x] + s)
###
Ok, let's look at three_at_a_time() and see if there's a relationship
between it and two_at_a_time:
[ ['a', 'a', 'a'],
['a', 'a', 'b'],
['a', 'b', 'a'],
['a', 'b', 'b'],
['b', 'a', 'a'],
['b', 'a', 'b'],
['b', 'b', 'a'],
['b', 'b', 'b'], ]
Same idea: let's use two_at_a_time() to solve three_at_a_time()! The
definition for three_at_a_time() will eerily familiar...
###
def three_at_a_time(L):
source = two_at_a_time(L)
c = []
for x in L:
for s in source:
c.append([x] + s)
###
This should give you enough to write n_at_a_time(). If you have any
questions, please feel free to ask. Good luck!
From scarblac@pino.selwerd.nl Wed Jun 6 10:38:36 2001
From: scarblac@pino.selwerd.nl (Remco Gerlich)
Date: Wed, 6 Jun 2001 11:38:36 +0200
Subject: [Tutor] Recursion
In-Reply-To: <021401c0ee64$75b65dc0$0200a8c0@ACE>; from wheelege@tsn.cc on Wed, Jun 06, 2001 at 06:41:18PM +1000
References: <021401c0ee64$75b65dc0$0200a8c0@ACE>
Message-ID: <20010606113836.A19201@pino.selwerd.nl>
On 0, Glen Wheeler wrote:
> Hey all,
>
> While fiddling around with maths, I thought it would be nice and cool to get all the possible permutations of a set, taken n at a time. I have been trying to get this to work nicely, but I'm just not familiar enough with recursion to get it to behave.
> For example, if I wanted to get all the permutations of a set ['a','b'] taken three at a time, I would write this :
>
> >>> c = []
> >>> s = ['a', 'b']
> >>> for i1 in range(len(s)):
> ... for i2 in range(len(s)):
> ... for i3 in range(len(s)):
> ... c.append([s[i1], s[i2], s[i3]])
> ...
> >>> for item in c: print item
> ...
> ['a', 'a', 'a']
> ['a', 'a', 'b']
> ['a', 'b', 'a']
> ['a', 'b', 'b']
> ['b', 'a', 'a']
> ['b', 'a', 'b']
> ['b', 'b', 'a']
> ['b', 'b', 'b']
Wait. In my other mail, I solved the wrong problem :-)
I read 'permutations' and stopped reading.
You want to make lists of length n with elements taking from a list L;
again, solve it by making all the lists of length n-1, where length 0 is
trivial, and combine them with all the possible elements:
def permutations2(L, n): # What's the proper name for this, anyway?
if n == 0:
return [[]]
result = []
# Compute this outside the loop
smaller_lists = permutations2(L, n-1)
for element in L:
for l in smaller_lists:
result.append([element]+l)
return result
(untested)
--
Remco Gerlich
From dyoo@hkn.eecs.berkeley.edu Wed Jun 6 10:41:30 2001
From: dyoo@hkn.eecs.berkeley.edu (Daniel Yoo)
Date: Wed, 6 Jun 2001 02:41:30 -0700 (PDT)
Subject: [Tutor] Recursion
In-Reply-To:
Message-ID:
On Wed, 6 Jun 2001, Daniel Yoo wrote:
> ###
> def two_at_a_time(L):
> source = one_at_a_time(L)
> c = []
> for x in L:
> for s in source:
> c.append([x] + s)
> ###
Oops. Ok, I need to make a correction of a very silly bug:
###
def two_at_a_time(L):
source = one_at_a_time(L)
c = []
for x in L:
for s in source:
c.append([x] + s)
return c
###
The program I wrote did all this neat work, but it never gave the answer
back to us! Ugh. Same bug with three_at_a_time(). Sorry about that.
From wheelege@tsn.cc Wed Jun 6 10:58:47 2001
From: wheelege@tsn.cc (Glen Wheeler)
Date: Wed, 6 Jun 2001 19:58:47 +1000
Subject: [Tutor] Recursion
References: <021401c0ee64$75b65dc0$0200a8c0@ACE> <20010606113836.A19201@pino.selwerd.nl>
Message-ID: <023b01c0ee6f$4870b3a0$0200a8c0@ACE>
Thanks Daniel for the great explanation+thought process, and Remco for
inadverdently answering two questions.
You two surely are a very effective one-two in this list :)
Thanks again,
Glen.
From Eugene.Leitl@lrz.uni-muenchen.de Wed Jun 6 11:29:05 2001
From: Eugene.Leitl@lrz.uni-muenchen.de (Eugene Leitl)
Date: Wed, 6 Jun 2001 12:29:05 +0200 (MET DST)
Subject: [Tutor] parsing a blank-separated string into a list
Message-ID:
Assuming, I have a string like this (produced by the JME applet,
encoding a molecule I entered):
10 11 C 9.13 -8.85 C 10.34 -8.15 C 7.92 -8.15 C 10.34 -6.75 C 7.92 -6.75 C
8.43 -3.89 C 9.83 -3.89 C 8.00 -5.23 C 10.26 -5.23 C+ 9.13 -6.05 1 2 2 1 3
1 2 4 1 3 5 2 4 10 2 5 10 1 6 7 1 6 8 1 7 9 1 8 10 1 9 10 1
And want to turn it into a list like this:
[10, 11, C, 9.13 ... ]
How do I do it?
jmelist = map(None, jmevalue) produces
[1, 0, 1, 1, C, ...], whereas I want the blank-separted atoms.
Is there an idiom for that? (I mean, it's of course possible to do it by
hand, but it's not Python Zen).
From SBrunning@trisystems.co.uk Wed Jun 6 11:51:22 2001
From: SBrunning@trisystems.co.uk (Simon Brunning)
Date: Wed, 6 Jun 2001 11:51:22 +0100
Subject: [Tutor] parsing a blank-separated string into a list
Message-ID: <31575A892FF6D1118F5800600846864D78BCEA@intrepid>
> From: Eugene Leitl [SMTP:Eugene.Leitl@lrz.uni-muenchen.de]
> Assuming, I have a string like this (produced by the JME applet,
> encoding a molecule I entered):
>
> 10 11 C 9.13 -8.85 C 10.34 -8.15 C 7.92 -8.15 C 10.34 -6.75 C 7.92 -6.75 C
> 8.43 -3.89 C 9.83 -3.89 C 8.00 -5.23 C 10.26 -5.23 C+ 9.13 -6.05 1 2 2 1 3
> 1 2 4 1 3 5 2 4 10 2 5 10 1 6 7 1 6 8 1 7 9 1 8 10 1 9 10 1
>
> And want to turn it into a list like this:
>
> [10, 11, C, 9.13 ... ]
>
> How do I do it?
>
> jmelist = map(None, jmevalue) produces
>
> [1, 0, 1, 1, C, ...], whereas I want the blank-separted atoms.
Try this
mystring = '''10 11 C 9.13 -8.85 C 10.34 -8.15 C 7.92 -8.15 C 10.34 -6.75 C
7.92 -6.75 C 8.43 -3.89 C 9.83 -3.89 C 8.00 -5.23 C 10.26 -5.23 C+ 9.13
-6.05 1 2 2 1 3 1 2 4 1 3 5 2 4 10 2 5 10 1 6 7 1 6 8 1 7 9 1 8 10 1 9 10
1'''
mylist = mystring.split()
At this point, mylist consists of a list of strings. It looks like you want
the numeric strings converted into numbers. Floats by the look of it. Now,
if your strings were *all* numeric, you could do:
mylist = [float(value) for value in mylist]
and you would be fine. List comprehensions are nice. ;-)
But in your case, this would blow up with a ValueError when trying to
convert the alphabetic characters, so we'll have to do this the old
fashioned way:
for index in range(len(mylist)):
try:
mylist[index] = float(mylist[index])
except ValueError:
pass
BTW, if you are not familiar with floats, you have a lot of surprises coming
up. If you are, then you *still* have a lot of surprises coming up. ;-)
HTH,
Simon B.
-----------------------------------------------------------------------
The information in this email is confidential and may be legally privileged.
It is intended solely for the addressee. Access to this email by anyone else
is unauthorised. If you are not the intended recipient, any disclosure,
copying, distribution, or any action taken or omitted to be taken in
reliance on it, is prohibited and may be unlawful. TriSystems Ltd. cannot
accept liability for statements made which are clearly the senders own.
From rob@jam.rr.com Wed Jun 6 12:11:51 2001
From: rob@jam.rr.com (Rob Andrews)
Date: Wed, 06 Jun 2001 06:11:51 -0500
Subject: [Tutor] Converting problem sets from other languages into Python?
References:
Message-ID: <3B1E0FF7.DD2600D6@jam.rr.com>
Daniel Yoo wrote:
>
> Hiya everyone,
>
> A while back, some people asked for sample problems that they could do to
> test out their fluency in Python. Usually, self-motivated projects are
> idea at letting people make their knowledge relevant, but sometimes,
> people don't know where to start!
>
> Perhaps we should also provide a small "problem set" repository. Sorta
> like mini-exercises, with some hints at how to approach a problem.
> Useless Python already does a little bit of this with its Python
> Challenges at:
>
> http://www.lowerstandard.com/python/pythonchallenge.html
>
> and perhaps this can be extended with more problems.
>
> In short: why not stea... er... convert problems from some textbooks to
> make them Python-relevant? By providing these practical problems, we'd
> let people gain more confidence as they find they can do these things.
> Extending "Useless Python", we can have "Useless Python Problems".
> *grin*
>
> I have a few problems written in Scheme, which I should be able to convert
> into Python:
>
> http://hkn.eecs.berkeley.edu/~dyoo/cs3/doublets.pdf
> http://hkn.eecs.berkeley.edu/~dyoo/cs3/wordprocessing.pdf
>
> (which have too much of a CS flavor, admittedly, but I have to start
> somewhere.)
>
> What do people think?
>
This is just the sort of thing I had in mind. I'd thought of
swip^^^^converting some of the problems from my books on other
languages, partly so I could figure out how to actually get them
accomplished in Python (which is easier) so I'd have a frame of
reference on how do do them in the other languages.
But I think the bottom line is that newbies, teachers, and other people
interested in the Python learning process NEED good CS-type problems and
some proposed solutions. I believe that every ACM problem we can solve
in Python, and every good classical or practical problem we can do it
with, will help us learn the language and add significantly to the
Python legacy.
Rob
--
Useless Python!
Kinda like the AOL of the Open Source Community 3;->
http://www.lowerstandard.com/python/index.html
From rob@jam.rr.com Wed Jun 6 12:15:15 2001
From: rob@jam.rr.com (Rob Andrews)
Date: Wed, 06 Jun 2001 06:15:15 -0500
Subject: [Tutor] Recursion
References: <021401c0ee64$75b65dc0$0200a8c0@ACE> <20010606113836.A19201@pino.selwerd.nl> <023b01c0ee6f$4870b3a0$0200a8c0@ACE>
Message-ID: <3B1E10C3.342CF072@jam.rr.com>
Glen Wheeler wrote:
>
> Thanks Daniel for the great explanation+thought process, and Remco for
> inadverdently answering two questions.
> You two surely are a very effective one-two in this list :)
>
> Thanks again,
> Glen.
>
A few of us in Mississippi still suspect that Danny and Remco are
actually sophisticated bot scripts that Guido brought back from the
future in his time machine.
Rob
--
Useless Python!
Kinda like the AOL of the Open Source Community 3;->
http://www.lowerstandard.com/python/index.html
From steve@mercury.in.cqsl.com Wed Jun 6 11:56:41 2001
From: steve@mercury.in.cqsl.com (lonetwin@yahoo.com)
Date: Wed, 6 Jun 2001 16:26:41 +0530 (IST)
Subject: [Tutor] parsing a blank-separated string into a list
In-Reply-To:
Message-ID:
On Wed, 6 Jun 2001, Eugene Leitl wrote:
>10 11 C 9.13 -8.85 C 10.34 -8.15 C 7.92 -8.15 C 10.34 -6.75 C 7.92 -6.75 C
>8.43 -3.89 C 9.83 -3.89 C 8.00 -5.23 C 10.26 -5.23 C+ 9.13 -6.05 1 2 2 1 3
>1 2 4 1 3 5 2 4 10 2 5 10 1 6 7 1 6 8 1 7 9 1 8 10 1 9 10 1
>
>And want to turn it into a list like this:
>
>[10, 11, C, 9.13 ... ]
>
>How do I do it?
>>>import string
>>> p = '10 11 C 9.13 -8.85 C 10.34 -8.15 C 7.92 -8.15 C 10.34 -6.75 C ...'
>>> string.split(p)
['10', '11', 'C', '9.13', '-8.85', 'C', '10.34', '-8.15', 'C', '7.92', '-8.15',
'C', '10.34', '-6.75', 'C', '...']
:)
if u have python 2.0, don't import string, just do a
p.split()
Peace
Steve
--
||||||||||||||||||||||
|||||||||#####||||||||
||||||||#######|||||||
||||||||# O O #|||||||
||||||||#\ ~ /#|||||||
||||||##||\_/||##|||||
|||||#||||||||||##||||
||||#||||||||||||##|||
||||#|||||||||||||##||
|||/\##|||||||||##/\||
|/ \#########/ \
|\ \#######/ /
||\____/#######\____/|
=====================================
Hello. Just walk along and try NOT to think about your INTESTINES
being almost FORTY YARDS LONG!!
====================================
From rob@jam.rr.com Wed Jun 6 12:44:46 2001
From: rob@jam.rr.com (Rob Andrews)
Date: Wed, 06 Jun 2001 06:44:46 -0500
Subject: [Tutor] Converting problem sets from other languages into Python?
References: <01e801c0ee5c$afeb28c0$0200a8c0@ACE>
Message-ID: <3B1E17AE.523862B4@jam.rr.com>
Glen Wheeler wrote:
>
> > <...>
> >
> > What do people think?
> >
>
> Great idea!
>
> Some good all-round computer problems can be found at
> http://www.cse.unsw.edu.au/progcomp - just click on the links to see the
> problems for the various years (the grand final ones are particularly fun
> :).
>
> Glen.
>
Superlative, Glen! I've added this material to the list of programming
contest problem links on the appropriate Useless page:
http://www.lowerstandard.com/python/acmcontest.html
While we're kinda on the subject, I'll go ahead and leak an up-coming
feature for Useless. (First I need to finish the program that will
automatically generate the HTML pages, but I'm mostly there.)
Once it's begun, for each script someone contributes to Useless, the
contributor will be able to add an icon to a script by someone else,
indicating one of several things ("I actually used this", "I learned
something from this", "This is indeed Useless", etc.). But for each
programming contest or Python Challenge solution, the contributor will
receive two of these. Aside from adding some humor and interesting
commentary to the scripts, I'm hoping this will encourage budding coders
to share their gifts more.
Okay, I'm done now,
Rob
--
Useless Python!
Kinda like the AOL of the Open Source Community 3;->
http://www.lowerstandard.com/python/index.html
From wheelege@tsn.cc Wed Jun 6 12:59:20 2001
From: wheelege@tsn.cc (Glen Wheeler)
Date: Wed, 6 Jun 2001 21:59:20 +1000
Subject: [Tutor] Converting problem sets from other languages into Python?
References: <01e801c0ee5c$afeb28c0$0200a8c0@ACE> <3B1E17AE.523862B4@jam.rr.com>
Message-ID: <029701c0ee80$1fba46e0$0200a8c0@ACE>
> Superlative, Glen! I've added this material to the list of programming
> contest problem links on the appropriate Useless page:
>
> http://www.lowerstandard.com/python/acmcontest.html
>
Thanks. I just went to investigate what you added, and noticed that only
the sample problems are there - if you link to the parent page
(http://www.cse.unsw.edu.au/~progcomp/) then there are actually links to a
very many more problems. Also from this page are the links to the much more
entertaining grand final problems. These links are under the heading
'ProgComp in past years', it's on the right of the page near the bottom.
The ones your linked to now actually have worked solutions written out for
them, wheras the others don't (yet).
> While we're kinda on the subject, I'll go ahead and leak an up-coming
> feature for Useless. (First I need to finish the program that will
> automatically generate the HTML pages, but I'm mostly there.)
>
If you need help... :)
> Once it's begun, for each script someone contributes to Useless, the
> contributor will be able to add an icon to a script by someone else,
> indicating one of several things ("I actually used this", "I learned
> something from this", "This is indeed Useless", etc.). But for each
> programming contest or Python Challenge solution, the contributor will
> receive two of these. Aside from adding some humor and interesting
> commentary to the scripts, I'm hoping this will encourage budding coders
> to share their gifts more.
>
Sounds like an excellent idea! I won't be able to hold back my flood of
scripts then :)
Glen.
> Okay, I'm done now,
> Rob
From rob@jam.rr.com Wed Jun 6 13:15:16 2001
From: rob@jam.rr.com (Rob Andrews)
Date: Wed, 06 Jun 2001 07:15:16 -0500
Subject: [Tutor] Converting problem sets from other languages into Python?
References: <01e801c0ee5c$afeb28c0$0200a8c0@ACE> <3B1E17AE.523862B4@jam.rr.com> <029701c0ee80$1fba46e0$0200a8c0@ACE>
Message-ID: <3B1E1ED4.F2B89880@jam.rr.com>
Glen Wheeler wrote:
>
> > Superlative, Glen! I've added this material to the list of programming
> > contest problem links on the appropriate Useless page:
> >
> > http://www.lowerstandard.com/python/acmcontest.html
> >
>
> Thanks. I just went to investigate what you added, and noticed that only
> the sample problems are there - if you link to the parent page
> (http://www.cse.unsw.edu.au/~progcomp/) then there are actually links to a
> very many more problems. Also from this page are the links to the much more
> entertaining grand final problems. These links are under the heading
> 'ProgComp in past years', it's on the right of the page near the bottom.
> The ones your linked to now actually have worked solutions written out for
> them, wheras the others don't (yet).
>
Thanks for catching that, Glen. My error has been remedied now.
That's what I get for pre-coffee web maintenance,
Rob
--
Useless Python!
Kinda like the AOL of the Open Source Community 3;->
http://www.lowerstandard.com/python/index.html
From python.tutorial@jarava.org Wed Jun 6 14:10:05 2001
From: python.tutorial@jarava.org (Javier JJ)
Date: Wed, 6 Jun 2001 15:10:05 +0200
Subject: [Tutor] Access to Windows Timers / Idle "states"??
References: <006901c0ee1b$39375870$0124a8c0@uno> <20010605222453.B14318@harmony.cs.rit.edu>
Message-ID: <007d01c0ee8a$018b5560$0124a8c0@uno>
> | The thing is, I have a program that every now and then locks itself
solid
> | and the only way out is a hard reboot (even in W2k, ctrl-alt-del won't
work,
> | even though the OS "seems" to be getting the keys, and the mouse cursor
> | moves).
>
> I've seen this with win2k also. Sometimes it is the OS's own fault as
> it tries to shutdown (though sometimes I wonder if it is really trying
> ...)
MM... Personally, I've only experienced this on programs that run fullscreen
and "take over" the display, like the program on my WinTV card, Games....
it's probably something to do with DirectX or similar... and that's a beast
I won't touch with a 10 meter pole :) So, as the OS seems to be "receiving"
input still (sometimes - not always- I've been able to ctrl-alt-del, open
the the task manager and kill the beast), I was wondering about how to
"build my own watchdog timer" :-))
> | So, I'd like to be able to "sense" when the OS hasn't been getting
> | any imput (keys / mouse) for a set period of time and, if that
> | happens, it'll just kill the offending process....
> |
> | Am I making any sense at all?
>
> Yes -- you want to prevent your OS from locking up (IOW failing to
Welll. it's not really (at least it doesn't seem) like it's really frozen
solid.. only that the screen is and not all inputs are handled.. but the
network and services go on (eprompter keeps checking the mail, etc). I had
wondered about another solution: building a xmlrpc or similar server that
would let me "kill" the offending process when triggered from another
machine. Buy having the two computers on is something I'd rather avoid :-))
> meet its requirements). The solution is much simpler : use Debian!
Well, I do :-)) (Ok, not Debian, but Mandrake). Problem is, I haven't found
HlafLife - Front Line Force for Linux .... and besides, I don't think I
could switch to linux and be 100% productive as of yet ....
> Sorry, not much help with the code, but I don't try and fix windows by
> writing my own watchdog timer and am not sure how you would do
> that reliably.
Well, _if_ there is a way of "hooking" onto the event(s) that Windows uses
to signal "no activity" (ie, the same ones that the OS uses to know when to
fire the screensaver), that'd be fairly simple to do. ..
Thanks for the idea, though. I'll look into watchdogs :-))
Javier
----
Famous last words - Don't worry, I can handle it.
From python.tutorial@jarava.org Wed Jun 6 14:25:09 2001
From: python.tutorial@jarava.org (Javier JJ)
Date: Wed, 6 Jun 2001 15:25:09 +0200
Subject: [Tutor] Access to Windows Timers / Idle "states"??
References: <006901c0ee1b$39375870$0124a8c0@uno> <20010605203050.A24683@sill.silmarill.org>
Message-ID: <009f01c0ee8c$1bf55930$0124a8c0@uno>
> >
> > Am I making any sense at all?
>
> Sort of :-). I don't use windows anymore, so I can only help with the
timer
> thing.. the command for it is time.sleep(5) to sleep for 5 seconds. If you
want
> to set hours or minutes, the way to do so is this: time.sleep(60*60*3.5)
for 3.5
> hours, for instance. Also, you have time.time() which gives you current
time in
> seconds from the start of epoch (~1970).
That's really the way :-)) I only need to delay an action a set amount of
time, nothing really fancy (I know if I had to sichronize serveral things,
then I'd have to "really" build a timer to use a "general" event", But for
what I need, time.sleep probably will fit nicely :-)
> Anyway, in order for timer to work, here's what you can do:
>
> sense_keypress()
I guess the trick is here :-) I'll have to build this function.... the trick
is how, I guess :-))
> time.sleep(60)
> if not keypresses_happened():
> os.kill(someprog)
>
> Look at docs for os.kill.
Will do :-) Pity is, "avaliability: UNIX".That's what I "Love" about
"pskill" form sysinternals... it's like kill, only for windows :-)
> time.time() you can use to tell how long something took, like this:
>
> t = time.time()
> do_something()
> print 'do_something() took %d seconds' % (time.time() - t)
>
Thanks a lot for the help :-)
Javier
----
Famous last words - Don't worry, I can handle it.
From Eugene.Leitl@lrz.uni-muenchen.de Wed Jun 6 14:45:12 2001
From: Eugene.Leitl@lrz.uni-muenchen.de (Eugene Leitl)
Date: Wed, 6 Jun 2001 15:45:12 +0200 (MET DST)
Subject: [Tutor] parsing a blank-separated string into a list
In-Reply-To: <31575A892FF6D1118F5800600846864D78BCEA@intrepid>
Message-ID:
On Wed, 6 Jun 2001, Simon Brunning wrote:
> Try this
>
> mystring = '''10 11 C 9.13 -8.85 C 10.34 -8.15 C 7.92 -8.15 C 10.34 -6.75 C
> 7.92 -6.75 C 8.43 -3.89 C 9.83 -3.89 C 8.00 -5.23 C 10.26 -5.23 C+ 9.13
> -6.05 1 2 2 1 3 1 2 4 1 3 5 2 4 10 2 5 10 1 6 7 1 6 8 1 7 9 1 8 10 1 9 10
> 1'''
> mylist = mystring.split()
Thanks, but I'm stuck with 1.5.2, as 2.1 wouldn't build correctly (can't
do freezing, and too dumb to get the configuration right, as the build
procedure has changed with 2.1) on the AIX box I'm developing for.
Hence I'll stick to the suggestion of the other poster:
import string
jmelist = string.split(jmevalue)
Which works for 1.5.2. Yay!
> At this point, mylist consists of a list of strings. It looks like you want
> the numeric strings converted into numbers. Floats by the look of it. Now,
Usually a good guess, but not in this case. See below.
> if your strings were *all* numeric, you could do:
>
> mylist = [float(value) for value in mylist]
>
> and you would be fine. List comprehensions are nice. ;-)
>
> But in your case, this would blow up with a ValueError when trying to
> convert the alphabetic characters, so we'll have to do this the old
> fashioned way:
>
> for index in range(len(mylist)):
> try:
> mylist[index] = float(mylist[index])
> except ValueError:
> pass
>
> BTW, if you are not familiar with floats, you have a lot of surprises coming
> up. If you are, then you *still* have a lot of surprises coming up. ;-)
Oh, I'm familiar with them, I used to do numerics on big boxes, at least
as a user. Any "surprises" will be contained by me not processing the
float information. All I need to do is to rearrange the jme string into a
mol type:
5 6 C 8.76 -3.88 C 8.06 -5.09 C 5.96 -3.88 C 6.66 -2.66 C 7.36 -3.88 1 2 1
1 5 1 2 5 1 3 4 1 3 5 1 4 5 1
to:
5 6 0 0 0 0 0 0 0 0 1 V2000
8.7600 -3.8800 0.0000 C 0 0 0 0 0 0
8.0600 -5.0900 0.0000 C 0 0 0 0 0 0
5.9600 -3.8800 0.0000 C 0 0 0 0 0 0
6.6600 -2.6600 0.0000 C 0 0 0 0 0 0
7.3600 -3.8800 0.0000 C 0 0 0 0 0 0
1 2 1 0 0 0
1 5 1 0 0 0
2 5 1 0 0 0
3 4 1 0 0 0
3 5 1 0 0 0
4 5 1 0 0 0
M END
It is a stupid format, but I don't have a choice. I'll post the subroutine
when I'm done, could be useful for some folks.
-- Eugene Leitl
______________________________________________________________
ICBMTO : N48 10'07'' E011 33'53'' http://www.lrz.de/~ui22204
57F9CFD3: ED90 0433 EB74 E4A9 537F CFF5 86E7 629B 57F9 CFD3
From toodles@yifan.net Wed Jun 6 15:18:14 2001
From: toodles@yifan.net (Andrew Wilkins)
Date: Wed, 6 Jun 2001 22:18:14 +0800
Subject: [Tutor] List mimicing
Message-ID:
Hi folks,
I'm creating a class somewhat like shelve that stores a list as a file, and
provides a very list-like interface to it. I'm having troubles with __iadd__
and __imul__ however. When I call them, it deletes everything in my
file...if someone has enough time to go through my code, I would be _very_
appreciative. I'll delete the irrelevant parts to make it quicker/easier
Here's what i did to test __iadd__, __imul__ reacts the same way:
>>> import file
>>> x=file.ListShelf('a')
>>> x.get()
>>> x+=[1,2,3]
>>> x.get()
Traceback (most recent call last):
File "", line 1, in ?
x.get()
AttributeError: 'None' object has no attribute 'get'
>>> print x
None
Thanks, Andrew
-------- code ----------
import cPickle,types,os
class ListShelf:
def __init__(self,filename):
"""
Open file for updating if it exists, otherwise create it.
"""
if not os.access(filename,os.F_OK):
os.open(filename,os.O_CREAT)
self.file=open(filename,'r+')
def get(self):
return self._load()
def _dump(self,_list):
"""
Seek to the beginning of file and cPickle the list to it.
"""
self.file.seek(0)
cPickle.dump(_list,self.file)
def _load(self):
"""
Seek to the beginning of file and un-cPickle the list from it.
If the file is empty, return an empty list.
"""
self.file.seek(0)
try:
return cPickle.load(self.file)
except EOFError: return []
def __iadd__(self,other):
"ie. list+=other"
_list=self._load()
_list+=other
self._dump(_list)
def __imul__(self,other):
"ie. list*=other"
_list=self._load()
_list*=other
self._dump(_list)
From kalle@gnupung.net Wed Jun 6 16:14:14 2001
From: kalle@gnupung.net (Kalle Svensson)
Date: Wed, 6 Jun 2001 17:14:14 +0200
Subject: [Tutor] List mimicing
In-Reply-To: ; from toodles@yifan.net on Wed, Jun 06, 2001 at 10:18:14PM +0800
References:
Message-ID: <20010606171414.A11739@father>
Sez Andrew Wilkins:
> Hi folks,
>
> I'm creating a class somewhat like shelve that stores a list as a file, and
> provides a very list-like interface to it. I'm having troubles with __iadd__
> and __imul__ however.
[snip]
You want to take a look at the class UserList in the module UserList in the
standard library.
> -------- code ----------
>
> import cPickle,types,os
>
> class ListShelf:
[snip]
> def __iadd__(self,other):
> "ie. list+=other"
> _list=self._load()
> _list+=other
> self._dump(_list)
return self
> def __imul__(self,other):
> "ie. list*=other"
> _list=self._load()
> _list*=other
> self._dump(_list)
return self
Peace,
Kalle
--
Email: kalle@gnupung.net | You can tune a filesystem, but you
Web: http://www.gnupung.net/ | can't tune a fish. -- man tunefs(8)
PGP fingerprint: 0C56 B171 8159 327F 1824 F5DE 74D7 80D7 BF3B B1DD
[ Not signed due to lossage. Blame Microsoft Outlook Express. ]
From tescoil@irtc.net Wed Jun 6 17:04:45 2001
From: tescoil@irtc.net (Tesla Coil)
Date: Wed, 06 Jun 2001 11:04:45 -0500
Subject: [Tutor] Converting problem sets from other languages into Python?
References: <01e801c0ee5c$afeb28c0$0200a8c0@ACE> <3B1E17AE.523862B4@jam.rr.com>
Message-ID: <3B1E549D.95898EA4@irtc.net>
On 6 June 2001, Rob Andrews wrote:
> While we're kinda on the subject, I'll go ahead
> and leak an up-coming feature for Useless. (First
> I need to finish the program that will automatically
> generate the HTML pages, but I'm mostly there.)
>
> Once it's begun, for each script someone contributes
> to Useless, the contributor will be able to add an
> icon to a script by someone else, indicating one of
> several things ("I actually used this", "I learned
> something from this", "This is indeed Useless", etc.).
Should have voting review skill and style rather
than utility, e.g, Elegant, Genius from Mars,
Runs with Square Wheels, Just When You Thought
Obfuscated Python Didn't Exist, etc. This sort
of commentary can be made regardless of what a
program proposes to do. And, however one rates
the utility of working code to solve the Knight's
Tour puzzle (I, for one, am not too sure), the
question is probably of less consequence to the
programmer's next effort than what could be said
of how well it was implemented.
From GBunting864@Worldsavings.com Wed Jun 6 17:09:55 2001
From: GBunting864@Worldsavings.com (Bunting, Glen, IG (x))
Date: Wed, 6 Jun 2001 11:09:55 -0500
Subject: [Tutor] python and Microsoft proxy server
Message-ID: <97E9FA3149D0D311BE5800008349BB27016692F8@ok1ems1.worldsavings.com>
Hi,
I am trying to learn Python and I would like to try out the urllib module.
The problem is everything here goes out through Microsoft's Proxy server
which authenticates with NTLM. Is there any way to allow Python to
authenticate with the proxy server so I can get to the Internet with Python?
Thanks,
Glen
*****************************************************************************
If you are not the intended recipient of this e-mail, please notify
the sender immediately. The contents of this e-mail do not amend
any existing disclosures or agreements unless expressly stated.
*****************************************************************************
From britt_green@hotmail.com Wed Jun 6 17:29:05 2001
From: britt_green@hotmail.com (Britt Green)
Date: Wed, 06 Jun 2001 09:29:05 -0700
Subject: [Tutor] Paths under WinNT?
Message-ID:
Hey,
I was wondering if someone could help me set up my path under Windows NT. Is
there a way to point it to the Python2.1 folder, so it'll see everything
that lives underneath that? Currently, if I have a class in a folder within
Python 2.1 and try to import it, Python can't find it. I'm in the position
of not knowing enough about WinNT to change my path so any advice is
welcome.
Britt
--
It is pitch black. You are likely to be eaten by a grue.
_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com
From GBunting864@Worldsavings.com Wed Jun 6 17:41:30 2001
From: GBunting864@Worldsavings.com (Bunting, Glen, IG (x))
Date: Wed, 6 Jun 2001 11:41:30 -0500
Subject: [Tutor] Paths under WinNT?
Message-ID: <97E9FA3149D0D311BE5800008349BB27016693B5@ok1ems1.worldsavings.com>
Britt,
To set the path, all you need to do is right click on My Computer and choose
properties. Then click on the environment tab, highlight path under the
system variables, then add the path you want entered in the value section.
Glen
-----Original Message-----
From: Britt Green [mailto:britt_green@hotmail.com]
Sent: Wednesday, June 06, 2001 9:29 AM
To: tutor@python.org
Subject: [Tutor] Paths under WinNT?
Hey,
I was wondering if someone could help me set up my path under Windows NT. Is
there a way to point it to the Python2.1 folder, so it'll see everything
that lives underneath that? Currently, if I have a class in a folder within
Python 2.1 and try to import it, Python can't find it. I'm in the position
of not knowing enough about WinNT to change my path so any advice is
welcome.
Britt
--
It is pitch black. You are likely to be eaten by a grue.
_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com
_______________________________________________
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
*****************************************************************************
If you are not the intended recipient of this e-mail, please notify
the sender immediately. The contents of this e-mail do not amend
any existing disclosures or agreements unless expressly stated.
*****************************************************************************
From dsh8290@rit.edu Wed Jun 6 18:03:45 2001
From: dsh8290@rit.edu (D-Man)
Date: Wed, 6 Jun 2001 13:03:45 -0400
Subject: [Tutor] Access to Windows Timers / Idle "states"??
In-Reply-To: <007d01c0ee8a$018b5560$0124a8c0@uno>; from python.tutorial@jarava.org on Wed, Jun 06, 2001 at 03:10:05PM +0200
References: <006901c0ee1b$39375870$0124a8c0@uno> <20010605222453.B14318@harmony.cs.rit.edu> <007d01c0ee8a$018b5560$0124a8c0@uno>
Message-ID: <20010606130345.E12381@connecticut.cs.rit.edu>
On Wed, Jun 06, 2001 at 03:10:05PM +0200, Javier JJ wrote:
| > | So, I'd like to be able to "sense" when the OS hasn't been getting
| > | any imput (keys / mouse) for a set period of time and, if that
| > | happens, it'll just kill the offending process....
| > |
| > | Am I making any sense at all?
| >
| > Yes -- you want to prevent your OS from locking up (IOW failing to
|
| Welll. it's not really (at least it doesn't seem) like it's really frozen
| solid.. only that the screen is and not all inputs are handled.. but the
| network and services go on (eprompter keeps checking the mail, etc). I had
| wondered about another solution: building a xmlrpc or similar server that
| would let me "kill" the offending process when triggered from another
| machine. Buy having the two computers on is something I'd rather avoid :-))
I think telnetd or sshd might be distributed with cygwin. Any real
networked/multiuser OS allows for remote access anyways...
(where'd the 'su' equivalent disappear to... I shouldn't be logged in as
administrator for day-to-day work, yet I shouldn't have to log out
just to install a new toy... oh, yeah, this is windows )
| > meet its requirements). The solution is much simpler : use Debian!
|
| Well, I do :-)) (Ok, not Debian, but Mandrake). Problem is, I haven't found
| HlafLife - Front Line Force for Linux .... and besides, I don't think I
| could switch to linux and be 100% productive as of yet ....
|
| > Sorry, not much help with the code, but I don't try and fix windows by
| > writing my own watchdog timer and am not sure how you would do
| > that reliably.
|
| Well, _if_ there is a way of "hooking" onto the event(s) that Windows uses
| to signal "no activity" (ie, the same ones that the OS uses to know when to
| fire the screensaver), that'd be fairly simple to do. ..
Does the screensaver kick in if you leave it idle long enough? If so
then you should write a screensaver :-). The screensaver won't be an
ordinary, flash-some-colors-on-the-screen sort of thing but it would
kill the offending process if it exists then exec the "real"
screensaver for those situations where you really want a screen saver.
I think this sort of thing would be relatively easy if MS allowed for
custom window managers because the window manager gets all input
(keyboard, mouse, etc) events and figures out whether to keep them
(and deal with it) or pass it on to the app. I suppose, if this were
X, you could create a layer that would see all events from the X
server and determine whether to kill the bad app or not and pass them
on to the real WM.
Anyways, the telnetd or screensaver idea are the most realistic/doable
ideas.
-D
From rob@jam.rr.com Wed Jun 6 18:28:00 2001
From: rob@jam.rr.com (Rob Andrews)
Date: Wed, 6 Jun 2001 12:28:00 -0500
Subject: [Tutor] Converting problem sets from other languages into Python?
References: <01e801c0ee5c$afeb28c0$0200a8c0@ACE> <3B1E17AE.523862B4@jam.rr.com> <3B1E549D.95898EA4@irtc.net>
Message-ID: <004701c0eeae$092df1a0$de00a8c0@planhouse5>
----- Original Message -----
From: "Tesla Coil"
To: "Rob Andrews"
Cc:
Sent: Wednesday, June 06, 2001 11:04 AM
Subject: Re: [Tutor] Converting problem sets from other languages into
Python?
>
> Should have voting review skill and style rather
> than utility, e.g, Elegant, Genius from Mars,
> Runs with Square Wheels, Just When You Thought
> Obfuscated Python Didn't Exist, etc. This sort
> of commentary can be made regardless of what a
> program proposes to do. And, however one rates
> the utility of working code to solve the Knight's
> Tour puzzle (I, for one, am not too sure), the
> question is probably of less consequence to the
> programmer's next effort than what could be said
> of how well it was implemented.
>
Actually, these are also options. I have quite a few in mind, and each will
have its own distinct graphic. I don't understand the *Runs with Square
Wheels* one, though. hehe
Rob
Useless Python
It's not just for breakfast anymore!
http://www.lowerstandard.com/python/index.html
From kstoner@netins.net Wed Jun 6 18:40:43 2001
From: kstoner@netins.net (Katharine Stoner)
Date: Wed, 6 Jun 2001 12:40:43 -0500
Subject: [Tutor] beginners out there
Message-ID: <001801c0eeaf$cff1ed40$8352b1cf@oemcomputer>
This is a multi-part message in MIME format.
------=_NextPart_000_0015_01C0EE85.E67BADA0
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
This is a shout out to all the beginners who need some help finding =
explainations on they're own.
Everything you need get to that is online documentation is at python's =
homepage. Some of it just takes a while to get to. You have to dig a =
bit to find the good stuff. There are some lesson plans that help on =
explaining things http://www.livewires.org.uk/python/. This explains =
some of the lingo that goes with programing and how some of the =
fundamentals work. Its all in html format or Adobe Acrobat reader =
format ready to be downloaded.
Alan Guald's book is probably the best easy, down to earth beginners =
book I've found. The best way to approach this that I've found is to =
watch the tutor emails, get a book, find some tutorials, get a project, =
and start playing around with code. Any beginner question would be fine =
here. We have the tutor emails to help one another learn better. I'm =
about 8 months into my Python education and it takes time to learn how =
to program with the basics.
This is just one beginner to another.
-Cameron
------=_NextPart_000_0015_01C0EE85.E67BADA0
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
This is a shout out to all the =
beginners who need=20
some help finding explainations on they're own.
Everything you need get to that is =
online=20
documentation is at python's homepage. Some of it just takes a =
while to=20
get to. You have to dig a bit to find the good stuff. There =
are some=20
lesson plans that help on explaining things http://www.livewires.org.uk/=
python/. =20
This explains some of the lingo that goes with programing and how some =
of the=20
fundamentals work. Its all in html format or Adobe Acrobat reader =
format=20
ready to be downloaded.
Alan Guald's book is probably the best =
easy, down=20
to earth beginners book I've found. The best way to approach this =
that=20
I've found is to watch the tutor emails, get a book, find some =
tutorials, get a=20
project, and start playing around with code. Any beginner question =
would=20
be fine here. We have the tutor emails to help one another learn=20
better. I'm about 8 months into my Python education and it takes =
time to=20
learn how to program with the basics.
This is just one beginner to =
another.
-Cameron
------=_NextPart_000_0015_01C0EE85.E67BADA0--
From pobrien@orbtech.com Wed Jun 6 18:00:05 2001
From: pobrien@orbtech.com (Patrick K. O'Brien)
Date: Wed, 6 Jun 2001 12:00:05 -0500
Subject: [Tutor] Best way to strip string string padded with nulls
Message-ID:
I'm working with DDE to get data out of Goldmine. The data returned from
Goldmine is padded with nulls (and other random data, see example below). I
need to strip the resulting string down to just the relevant data. I have
some example code here that works, but I'm looking for suggestions for a
simpler or more elegant approach. Thanks.
Here is a snippet from an interactive session so you can see what I have
described above:
>>> c = conversation.Request("Contact1->Company")
>>> c
'GoldMine Software
Corporation\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\
x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00Ok\xf8\xff'
>>> i = c.index('\x00')
>>> i
29
>>> a = c[:i]
>>> a
'GoldMine Software Corporation'
Of course, this could also be collapsed to the following:
c = c[:c.index('\00')]
But considering the fact that I'll have to do this to every string that gets
returned via DDE requests, I'm hoping there is a better way. Thanks for the
help.
---
Patrick K. O'Brien
Orbtech
"I am, therefore I think."
From ak@silmarill.org Wed Jun 6 18:48:11 2001
From: ak@silmarill.org (ak@silmarill.org)
Date: Wed, 06 Jun 2001 13:48:11 -0400
Subject: [Tutor] Access to Windows Timers / Idle "states"??
In-Reply-To: <"from dsh8290"@rit.edu>
References: <006901c0ee1b$39375870$0124a8c0@uno>
<20010605222453.B14318@harmony.cs.rit.edu>
<007d01c0ee8a$018b5560$0124a8c0@uno>
<20010606130345.E12381@connecticut.cs.rit.edu>
Message-ID: <20010606134811.A27269@sill.silmarill.org>
On Wed, Jun 06, 2001 at 01:03:45PM -0400, D-Man wrote:
> On Wed, Jun 06, 2001 at 03:10:05PM +0200, Javier JJ wrote:
> | > | So, I'd like to be able to "sense" when the OS hasn't been getting
> | > | any imput (keys / mouse) for a set period of time and, if that
> | > | happens, it'll just kill the offending process....
> | > |
> | > | Am I making any sense at all?
> | >
> | > Yes -- you want to prevent your OS from locking up (IOW failing to
> |
> | Welll. it's not really (at least it doesn't seem) like it's really frozen
> | solid.. only that the screen is and not all inputs are handled.. but the
> | network and services go on (eprompter keeps checking the mail, etc). I had
> | wondered about another solution: building a xmlrpc or similar server that
> | would let me "kill" the offending process when triggered from another
> | machine. Buy having the two computers on is something I'd rather avoid :-))
>
> I think telnetd or sshd might be distributed with cygwin. Any real
> networked/multiuser OS allows for remote access anyways...
>
> (where'd the 'su' equivalent disappear to... I shouldn't be logged in as
> administrator for day-to-day work, yet I shouldn't have to log out
> just to install a new toy... oh, yeah, this is windows )
>
> | > meet its requirements). The solution is much simpler : use Debian!
> |
> | Well, I do :-)) (Ok, not Debian, but Mandrake). Problem is, I haven't found
>
>
>
> | HlafLife - Front Line Force for Linux .... and besides, I don't think I
> | could switch to linux and be 100% productive as of yet ....
> |
> | > Sorry, not much help with the code, but I don't try and fix windows by
> | > writing my own watchdog timer and am not sure how you would do
> | > that reliably.
> |
> | Well, _if_ there is a way of "hooking" onto the event(s) that Windows uses
> | to signal "no activity" (ie, the same ones that the OS uses to know when to
> | fire the screensaver), that'd be fairly simple to do. ..
>
> Does the screensaver kick in if you leave it idle long enough? If so
> then you should write a screensaver :-). The screensaver won't be an
> ordinary, flash-some-colors-on-the-screen sort of thing but it would
> kill the offending process if it exists then exec the "real"
> screensaver for those situations where you really want a screen saver.
>
> I think this sort of thing would be relatively easy if MS allowed for
> custom window managers because the window manager gets all input
> (keyboard, mouse, etc) events and figures out whether to keep them
> (and deal with it) or pass it on to the app. I suppose, if this were
> X, you could create a layer that would see all events from the X
> server and determine whether to kill the bad app or not and pass them
> on to the real WM.
Well if this was X, you could just ctrl-alt-F2 to second console and
kill the offending process.. :-)
>
> Anyways, the telnetd or screensaver idea are the most realistic/doable
> ideas.
>
> -D
>
>
> _______________________________________________
> Tutor maillist - Tutor@python.org
> http://mail.python.org/mailman/listinfo/tutor
--
Jupiter and Saturn Oberon Miranda
And Titania Neptune Titan
Stars can frighten
- Syd
From scarblac@pino.selwerd.nl Wed Jun 6 18:56:37 2001
From: scarblac@pino.selwerd.nl (Remco Gerlich)
Date: Wed, 6 Jun 2001 19:56:37 +0200
Subject: [Tutor] Best way to strip string string padded with nulls
In-Reply-To: ; from pobrien@orbtech.com on Wed, Jun 06, 2001 at 12:00:05PM -0500
References:
Message-ID: <20010606195636.A19968@pino.selwerd.nl>
On 0, "Patrick K. O'Brien" wrote:
> I'm working with DDE to get data out of Goldmine. The data returned from
> Goldmine is padded with nulls (and other random data, see example below). I
> need to strip the resulting string down to just the relevant data. I have
> some example code here that works, but I'm looking for suggestions for a
> simpler or more elegant approach. Thanks.
>
> Here is a snippet from an interactive session so you can see what I have
> described above:
>
> >>> c = conversation.Request("Contact1->Company")
> >>> c
> 'GoldMine Software
> Corporation\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\
> x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00Ok\xf8\xff'
> >>> i = c.index('\x00')
> >>> i
> 29
> >>> a = c[:i]
> >>> a
> 'GoldMine Software Corporation'
>
> Of course, this could also be collapsed to the following:
>
> c = c[:c.index('\00')]
>
> But considering the fact that I'll have to do this to every string that gets
> returned via DDE requests, I'm hoping there is a better way. Thanks for the
> help.
c = c.replace('\00', '')
--
Remco Gerlich
From scarblac@pino.selwerd.nl Wed Jun 6 19:01:12 2001
From: scarblac@pino.selwerd.nl (Remco Gerlich)
Date: Wed, 6 Jun 2001 20:01:12 +0200
Subject: [Tutor] Best way to strip string string padded with nulls
In-Reply-To: ; from pobrien@orbtech.com on Wed, Jun 06, 2001 at 12:00:05PM -0500
References:
Message-ID: <20010606200112.A19981@pino.selwerd.nl>
On 0, "Patrick K. O'Brien" wrote:
> I'm working with DDE to get data out of Goldmine. The data returned from
> Goldmine is padded with nulls (and other random data, see example below). I
> need to strip the resulting string down to just the relevant data. I have
> some example code here that works, but I'm looking for suggestions for a
> simpler or more elegant approach. Thanks.
>
> Here is a snippet from an interactive session so you can see what I have
> described above:
>
> >>> c = conversation.Request("Contact1->Company")
> >>> c
> 'GoldMine Software
> Corporation\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\
> x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00Ok\xf8\xff'
> >>> i = c.index('\x00')
> >>> i
> 29
> >>> a = c[:i]
> >>> a
> 'GoldMine Software Corporation'
>
> Of course, this could also be collapsed to the following:
>
> c = c[:c.index('\00')]
>
> But considering the fact that I'll have to do this to every string that gets
> returned via DDE requests, I'm hoping there is a better way. Thanks for the
> help.
Hmm, seems I solved the wrong problem *again*. You want to delete the stuff
after the nulls as well. I think that last line of code you have there is
the best option.
--
Remco Gerlich
From pobrien@orbtech.com Wed Jun 6 19:17:15 2001
From: pobrien@orbtech.com (Patrick K. O'Brien)
Date: Wed, 6 Jun 2001 13:17:15 -0500
Subject: [Tutor] Best way to strip string string padded with nulls
In-Reply-To: <20010606200112.A19981@pino.selwerd.nl>
Message-ID:
Yeah. Your suggestion would work if the padding were all nulls, but
Goldmine manages to send back some random junk as well. So I do need to just
cut it short at the very first null. Thanks anyway.
---
Patrick K. O'Brien
Orbtech
"I am, therefore I think."
-----Original Message-----
From: tutor-admin@python.org [mailto:tutor-admin@python.org]On Behalf Of
Remco Gerlich
Sent: Wednesday, June 06, 2001 1:01 PM
To: tutor@python.org
Subject: Re: [Tutor] Best way to strip string string padded with nulls
Hmm, seems I solved the wrong problem *again*. You want to delete the stuff
after the nulls as well. I think that last line of code you have there is
the best option.
--
Remco Gerlich
_______________________________________________
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
From kojo@hal-pc.org Wed Jun 6 19:45:06 2001
From: kojo@hal-pc.org (Kojo Idrissa)
Date: Wed, 06 Jun 2001 13:45:06 -0500
Subject: [Tutor] beginners out there
In-Reply-To: <001801c0eeaf$cff1ed40$8352b1cf@oemcomputer>
Message-ID: <5.0.2.1.0.20010606131223.00ae5dd0@Pop3.norton.antivirus>
--=====================_94567841==_.ALT
Content-Type: text/plain; charset="us-ascii"; format=flowed
As is often my way, I will now jump on the bandwagon started by someone
else. In this case, Cameron.
As a little motivation for the beginners out there ( and I've been
beginning for a long time now...), here's a snippet from a "Python 101"
article on Devshed.:
In the consciously-elitist world of software engineering, a developer with
a few years of Python under his belt gets the best cubicle, the prettiest
girl and the respect of his neighbours; people move out of the way when he
strides down the hall, and colleagues turn to him for creative and elegant
solutions to the problems they encounter. Walk into a job interview and
mention Python when reciting your qualifications; you'll immediately see a
glint of recognition in the interviewer's eyes, an awareness that, in the
hierarchy of software developers, you're one of the top guns
Of course, that's a joke, but it's the lead off of a series of "Python 101"
articles that they're doing. Here's the URL:
Also, some of you new to programming may want to become "serious" about
it. I'm sure that means something different to everyon...in my case I'm
starting on a Comp. Sci. degree and plan to do this sort of thing for the
rest of my life. Anyway, I'm currently reading:
"How to Think Like a Computer Scientist."
It uses Python as it's language of instruction, and can be downloaded all
at once as a .tgz file (Winzip can open these). I found that helpfull, so
I can read while not online.
"How to Design Programs: An Introduction to Computing and Programming"
This one uses Scheme as it's language, but the snippet below explains why
I'd recommend it to beginners:
This book is the first book on programming as the core subject of a liberal
arts education. Its main focus is the design process that leads from
problem statements to well-organized solutions; it de-emphasizes the study
of programming language details, algorithmic minutiae, and specific
application domains.
I also recall a number of posts to this list asking how to go about
designing a larger program. This would seem to address that concern. In
addition, I think we all, no matter what we do in life, have problems we
have to deal with that could use well-organized solutions. This link
"book" would probably be better after you've spent a little time with
Python, but you can learn so much Python so quickly, you'll be
suprised. Also, if you already have a program idea in mind, working on the
design can help you focus what parts of Python you should study. ("Ok, so
how do I generate a random number for my RPG dice rolls module?")
Just my US$.02 (Ok, it's more like a nickel...I'm verbose). I'd also
second most of what Cameron said. He tends to post very interesting
questions that make it obvious that he's learning more about the language
as time goes on.
This list is also an excellent resource. People respond quickly and with
good information [I think, at times, I may be one of the exceptions, so I
try to stay quiet...:-)], and if they don't know what you're asking, they
don't YELL at you, they ask for more details. I Love You Guys!!
Ok, that's enough. Now I must eat, read and write.
At 12:40 PM 6/6/2001 -0500, Katharine Stoner wrote:
>This is a shout out to all the beginners who need some help finding
>explainations on they're own.
>
>Everything you need get to that is online documentation is at python's
>homepage. Some of it just takes a while to get to. You have to dig a bit
>to find the good stuff. There are some lesson plans that help on
>explaining things
>http://www.livewires.org.uk/python/.
>This explains some of the lingo that goes with programing and how some of
>the fundamentals work. Its all in html format or Adobe Acrobat reader
>format ready to be downloaded.
>Alan Guald's book is probably the best easy, down to earth beginners book
>I've found. The best way to approach this that I've found is to watch the
>tutor emails, get a book, find some tutorials, get a project, and start
>playing around with code. Any beginner question would be fine here. We
>have the tutor emails to help one another learn better. I'm about 8
>months into my Python education and it takes time to learn how to program
>with the basics.
>
>This is just one beginner to another.
>
>-Cameron
****************************
Kojo Idrissa
kojo@hal-pc.org
http://www.hal-pc.org/~kojo/
****************************
--=====================_94567841==_.ALT
Content-Type: text/html; charset="us-ascii"
As is often my way, I will now jump on the bandwagon started by someone
else. In this case, Cameron.
As a little motivation for the beginners out there ( and I've been
beginning for a long time now...), here's a snippet from a "Python
101" article on Devshed.:
- In the consciously-elitist world of software engineering, a developer
with a few years of Python under his belt gets the best cubicle, the
prettiest girl and the respect of his neighbours; people move out of the
way when he strides down the hall, and colleagues turn to him for
creative and elegant solutions to the problems they encounter. Walk into
a job interview and mention Python when reciting your qualifications;
you'll immediately see a glint of recognition in the interviewer's eyes,
an awareness that, in the hierarchy of software developers, you're one of
the top guns
Of course, that's a joke, but it's the lead off of a series of
"Python 101" articles that they're doing. Here's the
URL:
<http://www.devshed.com/Server_Side/Python/Python101_1/page1.html>
Also, some of you new to programming may want to become
"serious" about it. I'm sure that means something
different to everyon...in my case I'm starting on a Comp. Sci. degree and
plan to do this sort of thing for the rest of my life. Anyway, I'm
currently reading:
"How to Think Like a Computer Scientist."
<http://www.ibiblio.org/obp/thinkCSpy/>
It uses Python as it's language of instruction, and can be downloaded all
at once as a .tgz file (Winzip can open these). I found that
helpfull, so I can read while not online.
"How to Design Programs: An Introduction to Computing and
Programming"
<http://www.htdp.org/2001-01-18/Book/
>
This one uses Scheme as it's language, but the snippet below explains why
I'd recommend it to beginners:
- This book is the first book on programming as the core subject of a
liberal arts education. Its main focus is the design process that leads
from problem statements to well-organized solutions; it de-emphasizes the
study of programming language details, algorithmic minutiae, and specific
application domains.
I also recall a number of posts to this list asking how to go about
designing a larger program. This would seem to address that
concern. In addition, I think we all, no matter what we do in life,
have problems we have to deal with that could use well-organized
solutions. This link "book" would probably be better
after you've spent a little time with Python, but you can learn so much
Python so quickly, you'll be suprised. Also, if you already have a
program idea in mind, working on the design can help you focus what parts
of Python you should study. ("Ok, so how do I generate a random
number for my RPG dice rolls module?")
Just my US$.02 (Ok, it's more like a nickel...I'm verbose). I'd
also second most of what Cameron said. He tends to post very
interesting questions that make it obvious that he's learning more about
the language as time goes on.
This list is also an excellent resource. People respond quickly and
with good information [I think, at times, I may be one of the exceptions,
so I try to stay quiet...:-)], and if they don't know what you're asking,
they don't YELL at you, they ask for more details. I Love You
Guys!!
Ok, that's enough. Now I must eat, read and write.
At 12:40 PM 6/6/2001 -0500, Katharine Stoner wrote:
This is a
shout out to all the beginners who need some help finding explainations
on they're own.
Everything you need get to that is online
documentation is at python's homepage. Some of it just takes a
while to get to. You have to dig a bit to find the good stuff.
There are some lesson plans that help on explaining things
http://www.livewires.org.uk/python/.
This explains some of the lingo that goes with programing and how some of
the fundamentals work. Its all in html format or Adobe Acrobat
reader format ready to be downloaded.
Alan Guald's book is probably the best easy,
down to earth beginners book I've found. The best way to approach
this that I've found is to watch the tutor emails, get a book, find some
tutorials, get a project, and start playing around with code. Any
beginner question would be fine here. We have the tutor emails to
help one another learn better. I'm about 8 months into my Python
education and it takes time to learn how to program with the
basics.
This is just one beginner to
another.
-Cameron
****************************
Kojo Idrissa
kojo@hal-pc.org
http://www.hal-pc.org/~kojo/
****************************
--=====================_94567841==_.ALT--
From pobrien@orbtech.com Wed Jun 6 19:45:19 2001
From: pobrien@orbtech.com (Patrick K. O'Brien)
Date: Wed, 6 Jun 2001 13:45:19 -0500
Subject: [Tutor] Best way to strip string string padded with nulls
In-Reply-To:
Message-ID:
Here's one problem with my solution.
null = '\x00'
c = conversation.Request("Contact1->Company")
c = c[:c.index(null)]
If there is no null in c, index returns a ValueError that would have to be
dealt with. Worse is if I used c.find(null) since find would return -1 which
would eat the last character of c. Looks like I still need to work on this.
---
Patrick K. O'Brien
Orbtech
"I am, therefore I think."
-----Original Message-----
From: tutor-admin@python.org [mailto:tutor-admin@python.org]On Behalf Of
Patrick K. O'Brien
Sent: Wednesday, June 06, 2001 12:00 PM
To: Python Tutor
Subject: [Tutor] Best way to strip string string padded with nulls
I'm working with DDE to get data out of Goldmine. The data returned from
Goldmine is padded with nulls (and other random data, see example below). I
need to strip the resulting string down to just the relevant data. I have
some example code here that works, but I'm looking for suggestions for a
simpler or more elegant approach. Thanks.
Here is a snippet from an interactive session so you can see what I have
described above:
>>> c = conversation.Request("Contact1->Company")
>>> c
'GoldMine Software
Corporation\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\
x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00Ok\xf8\xff'
>>> i = c.index('\x00')
>>> i
29
>>> a = c[:i]
>>> a
'GoldMine Software Corporation'
Of course, this could also be collapsed to the following:
c = c[:c.index('\00')]
But considering the fact that I'll have to do this to every string that gets
returned via DDE requests, I'm hoping there is a better way. Thanks for the
help.
---
Patrick K. O'Brien
Orbtech
"I am, therefore I think."
_______________________________________________
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
From kauphlyn@speakeasy.org Wed Jun 6 20:14:45 2001
From: kauphlyn@speakeasy.org (Daniel Coughlin)
Date: Wed, 6 Jun 2001 12:14:45 -0700 (PDT)
Subject: [Tutor] parsing a blank-separated string into a list
In-Reply-To:
Message-ID:
Hey Eugene,
Long time since Planeria, eh?
try
>>jmevalue = ' 10 11 C 9.13 ect '
>>jmelist = jmevalue.split(' ')
>>jmelist
['10', '11', 'C', '9.13', etc]
On Wed, 6 Jun 2001, Eugene Leitl wrote:
>
> Assuming, I have a string like this (produced by the JME applet,
> encoding a molecule I entered):
>
> 10 11 C 9.13 -8.85 C 10.34 -8.15 C 7.92 -8.15 C 10.34 -6.75 C 7.92 -6.75 C
> 8.43 -3.89 C 9.83 -3.89 C 8.00 -5.23 C 10.26 -5.23 C+ 9.13 -6.05 1 2 2 1 3
> 1 2 4 1 3 5 2 4 10 2 5 10 1 6 7 1 6 8 1 7 9 1 8 10 1 9 10 1
>
> And want to turn it into a list like this:
>
> [10, 11, C, 9.13 ... ]
>
> How do I do it?
>
> jmelist = map(None, jmevalue) produces
>
> [1, 0, 1, 1, C, ...], whereas I want the blank-separted atoms.
>
> Is there an idiom for that? (I mean, it's of course possible to do it by
> hand, but it's not Python Zen).
>
>
> _______________________________________________
> Tutor maillist - Tutor@python.org
> http://mail.python.org/mailman/listinfo/tutor
>
From kauphlyn@speakeasy.org Wed Jun 6 20:30:41 2001
From: kauphlyn@speakeasy.org (Daniel Coughlin)
Date: Wed, 6 Jun 2001 12:30:41 -0700 (PDT)
Subject: [Tutor] parsing a blank-separated string into a list
In-Reply-To:
Message-ID:
What I wrote below works for Python 2.0 , and I dont know when it was
implemented, but it
definitely doesnt work on my Linux box, which is running python 1.5.2. For that,
I did the following:
import re
jmelist = re.split(' ', jmevalue)
Hope that helps, and sorry for any confusions for people with older versions ;-)
On Wed, 6 Jun 2001, Daniel Coughlin wrote:
> Hey Eugene,
>
> Long time since Planeria, eh?
>
> try
> >>jmevalue = ' 10 11 C 9.13 ect '
> >>jmelist = jmevalue.split(' ')
> >>jmelist
> ['10', '11', 'C', '9.13', etc]
>
>
>
> On Wed, 6 Jun 2001, Eugene Leitl wrote:
>
> >
> > Assuming, I have a string like this (produced by the JME applet,
> > encoding a molecule I entered):
> >
> > 10 11 C 9.13 -8.85 C 10.34 -8.15 C 7.92 -8.15 C 10.34 -6.75 C 7.92 -6.75 C
> > 8.43 -3.89 C 9.83 -3.89 C 8.00 -5.23 C 10.26 -5.23 C+ 9.13 -6.05 1 2 2 1 3
> > 1 2 4 1 3 5 2 4 10 2 5 10 1 6 7 1 6 8 1 7 9 1 8 10 1 9 10 1
> >
> > And want to turn it into a list like this:
> >
> > [10, 11, C, 9.13 ... ]
> >
> > How do I do it?
> >
> > jmelist = map(None, jmevalue) produces
> >
> > [1, 0, 1, 1, C, ...], whereas I want the blank-separted atoms.
> >
> > Is there an idiom for that? (I mean, it's of course possible to do it by
> > hand, but it's not Python Zen).
> >
> >
> > _______________________________________________
> > Tutor maillist - Tutor@python.org
> > http://mail.python.org/mailman/listinfo/tutor
> >
>
>
From pobrien@orbtech.com Wed Jun 6 20:32:16 2001
From: pobrien@orbtech.com (Patrick K. O'Brien)
Date: Wed, 6 Jun 2001 14:32:16 -0500
Subject: [Tutor] Best way to strip string string padded with nulls
In-Reply-To:
Message-ID:
This is what I've come up with so far. I'm still open to suggestions.
def nullstrip(s):
"""Return a string truncated at the first null character."""
try:
s = s[:s.index('\x00')]
except ValueError: # No nulls were found, which is okay.
pass
return s
---
Patrick K. O'Brien
Orbtech
"I am, therefore I think."
-----Original Message-----
From: Patrick K. O'Brien [mailto:pobrien@orbtech.com]
Sent: Wednesday, June 06, 2001 1:45 PM
To: Python Tutor
Subject: RE: [Tutor] Best way to strip string string padded with nulls
Here's one problem with my solution.
null = '\x00'
c = conversation.Request("Contact1->Company")
c = c[:c.index(null)]
If there is no null in c, index returns a ValueError that would have to be
dealt with. Worse is if I used c.find(null) since find would return -1 which
would eat the last character of c. Looks like I still need to work on this.
---
Patrick K. O'Brien
Orbtech
"I am, therefore I think."
From pobrien@orbtech.com Wed Jun 6 22:38:53 2001
From: pobrien@orbtech.com (Patrick K. O'Brien)
Date: Wed, 6 Jun 2001 16:38:53 -0500
Subject: [Tutor] Utility functions - was: Best way to strip string string padded with nulls
In-Reply-To:
Message-ID:
The function I came up with is obviously useful in a variety of contexts. So
it probably ought to go into some kind of general utility file. What kind of
standards do the rest of you follow when you find yourself with generic bits
of code like this? Do you have a particular file or set of files in which to
put these general functions?
---
Patrick K. O'Brien
Orbtech
"I am, therefore I think."
-----Original Message-----
From: tutor-admin@python.org [mailto:tutor-admin@python.org]On Behalf Of
Patrick K. O'Brien
Sent: Wednesday, June 06, 2001 2:32 PM
To: Python Tutor
Subject: RE: [Tutor] Best way to strip string string padded with nulls
This is what I've come up with so far. I'm still open to suggestions.
def nullstrip(s):
"""Return a string truncated at the first null character."""
try:
s = s[:s.index('\x00')]
except ValueError: # No nulls were found, which is okay.
pass
return s
---
Patrick K. O'Brien
Orbtech
"I am, therefore I think."
From ak@silmarill.org Wed Jun 6 23:02:18 2001
From: ak@silmarill.org (ak@silmarill.org)
Date: Wed, 06 Jun 2001 18:02:18 -0400
Subject: [Tutor] Utility functions - was: Best way to strip string string
padded with nulls
In-Reply-To: <"from pobrien"@orbtech.com>
References:
Message-ID: <20010606180218.A28726@sill.silmarill.org>
On Wed, Jun 06, 2001 at 04:38:53PM -0500, Patrick K. O'Brien wrote:
> The function I came up with is obviously useful in a variety of contexts. So
> it probably ought to go into some kind of general utility file. What kind of
> standards do the rest of you follow when you find yourself with generic bits
> of code like this? Do you have a particular file or set of files in which to
> put these general functions?
>
> ---
> Patrick K. O'Brien
> Orbtech
> "I am, therefore I think."
>
> -----Original Message-----
> From: tutor-admin@python.org [mailto:tutor-admin@python.org]On Behalf Of
> Patrick K. O'Brien
> Sent: Wednesday, June 06, 2001 2:32 PM
> To: Python Tutor
> Subject: RE: [Tutor] Best way to strip string string padded with nulls
>
> This is what I've come up with so far. I'm still open to suggestions.
>
> def nullstrip(s):
> """Return a string truncated at the first null character."""
> try:
> s = s[:s.index('\x00')]
> except ValueError: # No nulls were found, which is okay.
> pass
> return s
ActiveState python cookbook, I don't have url on hand so google for it.
>
> ---
> Patrick K. O'Brien
> Orbtech
> "I am, therefore I think."
>
>
> _______________________________________________
> Tutor maillist - Tutor@python.org
> http://mail.python.org/mailman/listinfo/tutor
--
Shine on you crazy diamond
- Roger
From pobrien@orbtech.com Wed Jun 6 23:24:10 2001
From: pobrien@orbtech.com (Patrick K. O'Brien)
Date: Wed, 6 Jun 2001 17:24:10 -0500
Subject: [Tutor] Utility functions - was: Best way to strip string string padded with nulls
In-Reply-To: <20010606180218.A28726@sill.silmarill.org>
Message-ID:
I think my question might not have been clear enough. I was wondering where
to put these functions on my local machine. For example, should I create a
file like utility.py and import that file into my other programs so I can
make use of these little utility functions, like my stripnull()? Does that
make sense? What do the rest of you do?
BTW, the reference you gave is an excellent resource that I've been checking
out whenever I need to do something new. The url is
http://aspn.activestate.com/ASPN/Python/Cookbook/ and there are lots of
interesting code examples. I may just take your suggestion and post my
little function there. Thanks.
---
Patrick K. O'Brien
Orbtech
"I am, therefore I think."
-----Original Message-----
From: tutor-admin@python.org [mailto:tutor-admin@python.org]On Behalf Of
sill@optonline.net
Sent: Wednesday, June 06, 2001 5:02 PM
To: Python Tutor
Subject: Re: [Tutor] Utility functions - was: Best way to strip string
string padded with nulls
ActiveState python cookbook, I don't have url on hand so google for it.
--
Shine on you crazy diamond
- Roger
_______________________________________________
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
From rik_klaver@hotmail.com Wed Jun 6 23:47:08 2001
From: rik_klaver@hotmail.com (Rik Klaver)
Date: Wed, 06 Jun 2001 22:47:08
Subject: [Tutor] importing modules
Message-ID:
I have downloaded some modules (or packages), which I've already put under
the 'Python21' folder in Win98. My problem is: Python lets me import some,
such as dynwin, pmw and pingo, but not the Mmtk20, Numeric and Htmlgen. For
some modules Python raises a SystemError.
Is the fact that Python does not recognize these modules due to their
DOS-names or to Python immediately recognizing, whenever a module is
imported, a (say) __init__-file?
I have no idea and I would very much like to use these modules (especially
the Mtmk)..
thanks in advance for any comments
Rik Klaver
_________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.
From toodles@yifan.net Thu Jun 7 02:14:44 2001
From: toodles@yifan.net (Andrew Wilkins)
Date: Thu, 7 Jun 2001 09:14:44 +0800
Subject: [Tutor] List mimicing
In-Reply-To: <20010606171414.A11739@father>
Message-ID:
> Sez Andrew Wilkins:
> > Hi folks,
> >
> > I'm creating a class somewhat like shelve that stores a list as
> a file, and
> > provides a very list-like interface to it. I'm having troubles
> with __iadd__
> > and __imul__ however.
> [snip]
>
> You want to take a look at the class UserList in the module
> UserList in the
> standard library.
Okay, I can do that, but I'll still be overriding everything anyway won't I?
In which case __imul__ and __iadd__ will still act the same? I'll play
around with it anyway, and see if I'm wrong =)
>
> > -------- code ----------
> >
> > import cPickle,types,os
> >
> > class ListShelf:
> [snip]
> > def __iadd__(self,other):
> > "ie. list+=other"
> > _list=self._load()
> > _list+=other
> > self._dump(_list)
>
> return self
>
> > def __imul__(self,other):
> > "ie. list*=other"
> > _list=self._load()
> > _list*=other
> > self._dump(_list)
>
> return self
>
> Peace,
> Kalle
> --
> Email: kalle@gnupung.net | You can tune a filesystem, but you
> Web: http://www.gnupung.net/ | can't tune a fish. -- man tunefs(8)
> PGP fingerprint: 0C56 B171 8159 327F 1824 F5DE 74D7 80D7 BF3B B1DD
> [ Not signed due to lossage. Blame Microsoft Outlook Express. ]
>
> _______________________________________________
> Tutor maillist - Tutor@python.org
> http://mail.python.org/mailman/listinfo/tutor
>
From toodles@yifan.net Thu Jun 7 04:12:30 2001
From: toodles@yifan.net (Andrew Wilkins)
Date: Thu, 7 Jun 2001 11:12:30 +0800
Subject: [Tutor] List mimicing
In-Reply-To: <20010606171414.A11739@father>
Message-ID:
Okay I've fixed it now. Thanks Kalle, I looked through the source of
UserList and found the prob :)
Also I've subclassed it now, and changed the way it works so it cuts a lot
of method definitions out...I'll post this to Rob for Useless later if
anyone is even remotely interested. heh
Andrew Wilkins
> -----Original Message-----
> From: tutor-admin@python.org [mailto:tutor-admin@python.org]On Behalf Of
> Kalle Svensson
> Sent: Wednesday, 6 June 2001 11:14 PM
> To: tutor@python.org
> Subject: Re: [Tutor] List mimicing
>
>
> Sez Andrew Wilkins:
> > Hi folks,
> >
> > I'm creating a class somewhat like shelve that stores a list as
> a file, and
> > provides a very list-like interface to it. I'm having troubles
> with __iadd__
> > and __imul__ however.
> [snip]
>
> You want to take a look at the class UserList in the module
> UserList in the
> standard library.
>
> > -------- code ----------
> >
> > import cPickle,types,os
> >
> > class ListShelf:
> [snip]
> > def __iadd__(self,other):
> > "ie. list+=other"
> > _list=self._load()
> > _list+=other
> > self._dump(_list)
>
> return self
>
> > def __imul__(self,other):
> > "ie. list*=other"
> > _list=self._load()
> > _list*=other
> > self._dump(_list)
>
> return self
>
> Peace,
> Kalle
> --
> Email: kalle@gnupung.net | You can tune a filesystem, but you
> Web: http://www.gnupung.net/ | can't tune a fish. -- man tunefs(8)
> PGP fingerprint: 0C56 B171 8159 327F 1824 F5DE 74D7 80D7 BF3B B1DD
> [ Not signed due to lossage. Blame Microsoft Outlook Express. ]
>
> _______________________________________________
> Tutor maillist - Tutor@python.org
> http://mail.python.org/mailman/listinfo/tutor
>
From kromag@nsacom.net Thu Jun 7 17:37:29 2001
From: kromag@nsacom.net (kromag@nsacom.net)
Date: Thu, 7 Jun 2001 09:37:29 -0700 (PDT)
Subject: [Tutor] ExpectPy HOWTO/Tutorial/Handholding
Message-ID: <200106071637.f57GbTg11731@pop.nsacom.net>
Several weeks ago I posted a question about parsing data from a serial port.
The data from the serial port uses a binary 3 to signal that it is through
transmitting. Someone mentioned that the ExpectPy module might be a good
candidate for parsing this data.
Does anyone have a HOWTO for ExpectPy?
Thanks!
From rickyp1@frontiernet.net Thu Jun 7 17:05:08 2001
From: rickyp1@frontiernet.net (Ricky Parks)
Date: Thu, 7 Jun 2001 11:05:08 -0500
Subject: [Tutor] Finaly
Message-ID: <006a01c0ef6c$000e0880$6601a8c0@Parks>
This is a multi-part message in MIME format.
------=_NextPart_000_000B_01C0EF41.B6B4F880
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
I can not find where to unsubscibe. Could some one help me! I have given =
up python!
------=_NextPart_000_000B_01C0EF41.B6B4F880
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
I can not find where to unsubscibe. =
Could some one=20
help me! I have given up python!
------=_NextPart_000_000B_01C0EF41.B6B4F880--
From scarblac@pino.selwerd.nl Thu Jun 7 17:21:43 2001
From: scarblac@pino.selwerd.nl (Remco Gerlich)
Date: Thu, 7 Jun 2001 18:21:43 +0200
Subject: [Tutor] Finaly
In-Reply-To: <006a01c0ef6c$000e0880$6601a8c0@Parks>; from rickyp1@frontiernet.net on Thu, Jun 07, 2001 at 11:05:08AM -0500
References: <006a01c0ef6c$000e0880$6601a8c0@Parks>
Message-ID: <20010607182143.A21324@pino.selwerd.nl>
On 0, Ricky Parks wrote:
> I can not find where to unsubscibe. Could some one help me! I have given up python!
Sorry to hear you've given up Python...
Anyway, you can unsubscribe at the mailman page for this list,
http://mail.python.org/mailman/listinfo/tutor
Enter your email address in the 'Edit Options' box at the bottom and you'll
go to a page where you can unsubscribe.
--
Remco Gerlich
From abbn@v-share.com Thu Jun 7 17:48:33 2001
From: abbn@v-share.com (Vassilis Vassiliou)
Date: Thu, 7 Jun 2001 19:48:33 +0300
Subject: [Tutor] Shareware Software Registration Services
Message-ID: <200106071648.f57GmXS13803@v-share.com>
Dear Software Vendor,
Our company Visage Services Inc. offers valuable shareware software registration services to many developers for the past 4 years. Being ourselves shareware software developers we created in 1998 a state of the art service administration system which proved very reliable and prosperous, due to its highly adaptable flexibility. Taking into consideration our very attractive fee schedule this could be a major opportunity to enhance your profits at a minimum cost. Please visit our site at http://www.v-share.com for a detailed description of these services and our fee schedule. Should you need assistance, feel free to contact me anytime.
Thank you for your time reading my mail.
Sincerely,
Vassilis Vassiliou
Sales Manager
VISAGE SERVICES INC.
abbn@v-share.com
From curtis.larsen@Covance.Com Thu Jun 7 19:27:26 2001
From: curtis.larsen@Covance.Com (Curtis Larsen)
Date: Thu, 07 Jun 2001 13:27:26 -0500
Subject: [Tutor] ExpectPy HOWTO/Tutorial/Handholding
Message-ID:
According to this recent blurb in "Dr. Dobbs' Python-URL" (a weekly
"what's-new-in-Python" e-mail newsletter), there may be another
possibility:
"""
How do you do serial IO in Python? Usual answer: It depends on
your operating system. New answer: not anymore! XIO is a new
cross-platform serial port driver for win32 and Unix.
http://groups.google.com/groups?ic=1&th=dae9fa4438b9bc9a,3
"""
Following the link, we learn more:
"Currently, the module implements port creation, opening, closing,
configuration, reading, writing & status peeking. It has been tested
under Linux-x86 and Win-9X. It contains a naive implementation of flow
control (and pretty untested -- so beware!)."
Hope that helps!
Curtis
PS: To receive a new issue of "Dr. Dobbs" in e-mail each Monday
morning, ask to subscribe. Mention "Python-URL!".
>>> 06/07/2001 11:37:29 AM >>>
Several weeks ago I posted a question about parsing data from a serial
port.
The data from the serial port uses a binary 3 to signal that it is
through
transmitting. Someone mentioned that the ExpectPy module might be a
good
candidate for parsing this data.
Does anyone have a HOWTO for ExpectPy?
Thanks!
_______________________________________________
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
-----------------------------------------------------
Confidentiality Notice: This e-mail transmission
may contain confidential or legally privileged
information that is intended only for the individual
or entity named in the e-mail address. If you are not
the intended recipient, you are hereby notified that
any disclosure, copying, distribution, or reliance
upon the contents of this e-mail is strictly prohibited.
If you have received this e-mail transmission in error,
please reply to the sender, so that we can arrange
for proper delivery, and then please delete the message
from your inbox. Thank you.
From inkedmcse@yahoo.com Thu Jun 7 23:01:00 2001
From: inkedmcse@yahoo.com (Kelly Brett)
Date: Thu, 7 Jun 2001 15:01:00 -0700 (PDT)
Subject: [Tutor] python question...
Message-ID: <20010607220100.74350.qmail@web11703.mail.yahoo.com>
--0-195772596-991951260=:74165
Content-Type: text/plain; charset=us-ascii
hello-
i'm brand new to programming, and i'm very excited about learning python. I've used the "instant hacking" tutorial on the website, and it's making total sense. i'm just wondering how it is that somebody can get good at this stuff. i understand that practice makes perfect, but it just seems like there are so many directions that can be taken.
so, beside the aforementioned tutorial, what is a good resource that won't confuse the crap out of me?
thanks guys!!
brett
---------------------------------
Do You Yahoo!?
Yahoo! Mail Personal Address - Get email at your own domain with Yahoo! Mail.
--0-195772596-991951260=:74165
Content-Type: text/html; charset=us-ascii
hello-
i'm brand new to programming, and i'm very excited about learning python. I've used the "instant hacking" tutorial on the website, and it's making total sense. i'm just wondering how it is that somebody can get good at this stuff. i understand that practice makes perfect, but it just seems like there are so many directions that can be taken.
so, beside the aforementioned tutorial, what is a good resource that won't confuse the crap out of me?
thanks guys!!
brett
Do You Yahoo!?
Yahoo! Mail Personal Address -
Get email at your own domain with Yahoo! Mail.
--0-195772596-991951260=:74165--
From glingl@aon.at Thu Jun 7 23:30:11 2001
From: glingl@aon.at (Gregor Lingl)
Date: Fri, 08 Jun 2001 00:30:11 +0200
Subject: [Tutor] python question...
References: <20010607220100.74350.qmail@web11703.mail.yahoo.com>
Message-ID: <3B200073.E90320ED@aon.at>
--------------6FC4330FBD56AB1883C7BF2A
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
If you want to lern to program - using Python - try How to think like a
computer scientist
(http://www.ibiblio.org/obp/thinkCSpy/)
Then to find more cooncrete material- exercises and so on ... - , go to
Alan Gaulds's book on programming
(http://members.nbci.com/alan_gauld/tutor/tutindex.htm)
A very useful list of tutorials of each kind you find at Rob Andrews
Tutorial Page (http://www.lowerstandard.com/python/tutoriallinks.html)
on his Useless Python Site
Good luck (and be patient!)
Gregor L.
Kelly Brett schrieb:
hello-
i'm brand new to programming, and i'm very excited about learning
python. I've used the "instant hacking" tutorial on the website, and
it's making total sense. i'm just wondering how it is that
somebody can get good at this stuff. i understand that practice makes
perfect, but it just seems like there are so many directions that can be
taken.
so, beside the aforementioned tutorial, what is a good resource that
won't confuse the crap out of me?
thanks guys!!
brett
Kelly Brett schrieb:
> hello-
>
> i'm brand new to programming, and i'm very excited about learning
> python. I've used the "instant hacking" tutorial on the website, and
> it's making total sense. i'm just wondering how it is that somebody
> can get good at this stuff. i understand that practice makes perfect,
> but it just seems like there are so many directions that can be taken.
>
> so, beside the aforementioned tutorial, what is a good resource that
> won't confuse the crap out of me?
>
> thanks guys!!
>
> brett
>
>
> -----------------------------------------------------------------------
> Do You Yahoo!?
> Yahoo! Mail Personal Address - Get email at your own domain with
> Yahoo! Mail.
--------------6FC4330FBD56AB1883C7BF2A
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit
If you want to lern to program - using Python - try How
to think like a computer scientist
(http://www.ibiblio.org/obp/thinkCSpy/)
Then to find more cooncrete material- exercises and so on ... - , go
to Alan
Gaulds's book on programming
(http://members.nbci.com/alan_gauld/tutor/tutindex.htm)
A very useful list of tutorials of each kind you find at Rob
Andrews Tutorial Page (http://www.lowerstandard.com/python/tutoriallinks.html)
on his Useless
Python Site
Good luck (and be patient!)
Gregor L.
Kelly Brett schrieb:
hello-
i'm brand new to programming, and i'm very excited about learning
python. I've used the "instant hacking" tutorial on the website,
and it's making total sense. i'm just wondering how it is that
somebody can get good at this stuff. i understand that
practice makes perfect, but it just seems like there are so many directions
that can be taken.
so, beside the aforementioned tutorial, what is a good resource
that won't confuse the crap out of me?
thanks guys!!
brett
Kelly Brett schrieb:
hello-
i'm brand new to programming, and i'm very excited about learning python.
I've used the "instant hacking" tutorial on the website, and it's making
total sense. i'm just wondering how it is that somebody can get good
at this stuff. i understand that practice makes perfect, but it just
seems like there are so many directions that can be taken.
so, beside the aforementioned tutorial, what is a good resource that
won't confuse the crap out of me?
thanks guys!!
brett
Do You Yahoo!?
Yahoo!
Mail Personal Address - Get email at your own domain with Yahoo! Mail.
--------------6FC4330FBD56AB1883C7BF2A--
From j_f9@yahoo.com Fri Jun 8 01:23:00 2001
From: j_f9@yahoo.com (F. Tourigny)
Date: Thu, 7 Jun 2001 17:23:00 -0700 (PDT)
Subject: [Tutor] sys._doc_ documentation
Message-ID: <20010608002300.67711.qmail@web14506.mail.yahoo.com>
I'm just starting with Programming Python, p. 16.
Typing:
sys._doc_
at the python prompt returns this message:
Traceback (most recent call last):
File "", line 1, in ?
AttributeError: 'sys' module has no attribute '_doc_'
However, "dir(sys)" is listing "_doc_" among the
module's attributes.
What gives?
(Using ActivePython 2.1, Build 210)
Greetings,
Frederic
__________________________________________________
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail - only $35
a year! http://personal.mail.yahoo.com/
From m.hadfield@niwa.cri.nz Fri Jun 8 01:28:39 2001
From: m.hadfield@niwa.cri.nz (Mark Hadfield)
Date: Fri, 8 Jun 2001 12:28:39 +1200
Subject: [Tutor] sys._doc_ documentation
References: <20010608002300.67711.qmail@web14506.mail.yahoo.com>
Message-ID: <000401c0efb1$f7260dd0$d938a8c0@Hadfield>
From: "F. Tourigny"
> I'm just starting with Programming Python, p. 16.
> Typing:
> sys._doc_
> at the python prompt returns this message:
>
> Traceback (most recent call last):
> File "", line 1, in ?
> AttributeError: 'sys' module has no attribute '_doc_'
>
> However, "dir(sys)" is listing "_doc_" among the
> module's attributes.
> What gives?
> (Using ActivePython 2.1, Build 210)
Works for me (below). You probably left off one of the underscores.
ActivePython 2.1, build 210 ActiveState)
based on Python 2.1 (#15, Apr 19 2001, 10:28:27) [MSC 32 bit (Intel)] on
win32
Type "help", "copyright", "credits" or "license" for more information.>>>
import sys
>>> import sys
>>> sys.__doc__
"This module provides access to some objects used or maintained by
the\ninterpre
ter and to functions that interact strongly with the interpreter.\n\nDynamic
obj
ects:\n\nargv -- command line arguments; argv[0] is the script pathname if
known
\npath -- module search path; path[0] is the script directory, else
''\nmodules
-- dictionary of loaded modules\n\ndisplayhook -- called to show results in
an i
nteractive session\nexcepthook -- called to handle any uncaught exception
other
than SystemExit\n To customize printing in an interactive session or to
install
a custom\n top-level exception handler, assign other functions to replace
thes
e.\n\nexitfunc -- if sys.exitfunc exists, this routine is called when Python
exi
ts\n Assigning to sys.exitfunc is deprecated; use the atexit module
instead.\n\
....
---
Mark Hadfield
m.hadfield@niwa.cri.nz http://katipo.niwa.cri.nz/~hadfield
National Institute for Water and Atmospheric Research
From ak@silmarill.org Fri Jun 8 01:48:29 2001
From: ak@silmarill.org (ak@silmarill.org)
Date: Thu, 07 Jun 2001 20:48:29 -0400
Subject: [Tutor] sys._doc_ documentation
In-Reply-To: <"from j_f9"@yahoo.com>
References: <20010608002300.67711.qmail@web14506.mail.yahoo.com>
Message-ID: <20010607204829.A421@sill.silmarill.org>
On Thu, Jun 07, 2001 at 05:23:00PM -0700, F. Tourigny wrote:
> I'm just starting with Programming Python, p. 16.
> Typing:
> sys._doc_
> at the python prompt returns this message:
>
> Traceback (most recent call last):
> File "", line 1, in ?
> AttributeError: 'sys' module has no attribute '_doc_'
>
> However, "dir(sys)" is listing "_doc_" among the
> module's attributes.
>
> What gives?
> (Using ActivePython 2.1, Build 210)
>
> Greetings,
> Frederic
That's a typo, it should be sys.__doc__ .
>
>
>
> __________________________________________________
> Do You Yahoo!?
> Get personalized email addresses from Yahoo! Mail - only $35
> a year! http://personal.mail.yahoo.com/
>
> _______________________________________________
> Tutor maillist - Tutor@python.org
> http://mail.python.org/mailman/listinfo/tutor
--
Lime and limpid green
a second scene
A fight between the blue
you once knew
- Syd
From amc1@dcs.qmw.ac.uk Fri Jun 8 15:41:03 2001
From: amc1@dcs.qmw.ac.uk (Allan Crooks)
Date: Fri, 08 Jun 2001 15:41:03 +0100
Subject: [Tutor] Viewing __doc__ strings
Message-ID:
Hi,
Is there anyway to make Python display __doc__ strings without all the "\n" characters? I know I could manually split it and then rejoin it, but surely there's an easier way?
I'm using Python 2.1 on WinNT 4, if that's of any use.
Thanks,
Allan.
From SBrunning@trisystems.co.uk Fri Jun 8 15:46:07 2001
From: SBrunning@trisystems.co.uk (Simon Brunning)
Date: Fri, 8 Jun 2001 15:46:07 +0100
Subject: [Tutor] Viewing __doc__ strings
Message-ID: <31575A892FF6D1118F5800600846864D78BD0D@intrepid>
> From: Allan Crooks [SMTP:amc1@dcs.qmw.ac.uk]
> Is there anyway to make Python display __doc__ strings without all the
> "\n" characters? I know I could manually split it and then rejoin it, but
> surely there's an easier way?
Just use print.
print whatever.__doc__
Cheers,
Simon Brunning
TriSystems Ltd.
sbrunning@trisystems.co.uk
-----------------------------------------------------------------------
The information in this email is confidential and may be legally privileged.
It is intended solely for the addressee. Access to this email by anyone else
is unauthorised. If you are not the intended recipient, any disclosure,
copying, distribution, or any action taken or omitted to be taken in
reliance on it, is prohibited and may be unlawful. TriSystems Ltd. cannot
accept liability for statements made which are clearly the senders own.
From scarblac@pino.selwerd.nl Fri Jun 8 15:55:14 2001
From: scarblac@pino.selwerd.nl (Remco Gerlich)
Date: Fri, 8 Jun 2001 16:55:14 +0200
Subject: [Tutor] Viewing __doc__ strings
In-Reply-To: ; from amc1@dcs.qmw.ac.uk on Fri, Jun 08, 2001 at 03:41:03PM +0100
References:
Message-ID: <20010608165514.A23343@pino.selwerd.nl>
On 0, Allan Crooks wrote:
> Is there anyway to make Python display __doc__ strings without all the
> "\n" characters? I know I could manually split it and then rejoin it, but
> surely there's an easier way?
print it:
>>> len.__doc__
'len(object) -> integer\n\nReturn the number of items of a sequence or mapping.'
>>> print len.__doc__
len(object) -> integer
Return the number of items of a sequence or mapping.
Just like any other strings with \n's in them, really :)
Personally I use a little doc() function that goes like this:
def doc(x):
print "Object:", `x`
print
if hasattr(x, '__doc__'):
print "Docstring:"
print x.__doc__
else:
print "No docstring."
So I can just type
>>> doc(object)
> I'm using Python 2.1 on WinNT 4, if that's of any use.
On Linux I put that function in ~/.pythonrc, but I don't know where it goes
on WinNT. There should be a file that's executed before you enter the
interpreter.
--
Remco Gerlich
From iumarumo@eidosnet.co.uk Fri Jun 8 17:46:21 2001
From: iumarumo@eidosnet.co.uk (ibraheem umaru-mohammed)
Date: Fri, 8 Jun 2001 17:46:21 +0100
Subject: [Tutor] Viewing __doc__ strings
In-Reply-To: <20010608165514.A23343@pino.selwerd.nl>; from scarblac@pino.selwerd.nl on Fri, Jun 08, 2001 at 04:55:14PM +0200
References: <20010608165514.A23343@pino.selwerd.nl>
Message-ID: <20010608174621.B5878@micromuse.com>
[Remco Gerlich wrote...]
-| On 0, Allan Crooks wrote:
-| > Is there anyway to make Python display __doc__ strings without all the
-| > "\n" characters? I know I could manually split it and then rejoin it, but
-| > surely there's an easier way?
-|
-| print it:
-|
-| >>> len.__doc__
-| 'len(object) -> integer\n\nReturn the number of items of a sequence or mapping.'
-| >>> print len.__doc__
-| len(object) -> integer
-|
-| Return the number of items of a sequence or mapping.
-|
-| Just like any other strings with \n's in them, really :)
-|
-| Personally I use a little doc() function that goes like this:
-|
-| def doc(x):
-| print "Object:", `x`
-| print
-| if hasattr(x, '__doc__'):
-| print "Docstring:"
-| print x.__doc__
-| else:
-| print "No docstring."
-|
-| So I can just type
-|
-| >>> doc(object)
-|
-| > I'm using Python 2.1 on WinNT 4, if that's of any use.
-|
-| On Linux I put that function in ~/.pythonrc, but I don't know where it goes
-| on WinNT. There should be a file that's executed before you enter the
-| interpreter.
-|
Or under Python 2.x
>>>import pydoc
>>>pydoc.doc(len)
kindest regards,
--ibs.
--
Ibraheem Umaru-Mohammed
ium@micromuse.com
www.micromuse.com
--0--
From pobrien@orbtech.com Fri Jun 8 16:54:11 2001
From: pobrien@orbtech.com (Patrick K. O'Brien)
Date: Fri, 8 Jun 2001 10:54:11 -0500
Subject: [Tutor] Viewing __doc__ strings
In-Reply-To: <20010608165514.A23343@pino.selwerd.nl>
Message-ID:
I like that a lot. Very helpful when you are messing with something new in
interactive mode. You inspired me to create my own variation. Hope everyone
likes it.
def doc(x):
"""Print type, representation and documentation string for object x."""
print "Object:", str(x)
print "Object Type:", type(x)
print "Representation:", repr(x)
print "Documentation String:"
print "---------------------"
try:
print x.__doc__
except AttributeError:
print "This object does not have a documentation string."
---
Patrick K. O'Brien
Orbtech
"I am, therefore I think."
-----Original Message-----
From: tutor-admin@python.org [mailto:tutor-admin@python.org]On Behalf Of
Remco Gerlich
Sent: Friday, June 08, 2001 9:55 AM
To: tutor@python.org
Subject: Re: [Tutor] Viewing __doc__ strings
Personally I use a little doc() function that goes like this:
def doc(x):
print "Object:", `x`
print
if hasattr(x, '__doc__'):
print "Docstring:"
print x.__doc__
else:
print "No docstring."
So I can just type
>>> doc(object)
> I'm using Python 2.1 on WinNT 4, if that's of any use.
On Linux I put that function in ~/.pythonrc, but I don't know where it goes
on WinNT. There should be a file that's executed before you enter the
interpreter.
--
Remco Gerlich
_______________________________________________
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
From wall@adinet.com.uy Fri Jun 8 16:53:21 2001
From: wall@adinet.com.uy (Walter Moreira)
Date: Fri, 8 Jun 2001 12:53:21 -0300
Subject: [Tutor] Viewing __doc__ strings
In-Reply-To: ; from amc1@dcs.qmw.ac.uk on Fri, Jun 08, 2001 at 03:41:03PM +0100
References:
Message-ID: <20010608125321.A29049@casa.parque>
On Fri, Jun 08, 2001 at 03:41:03PM +0100, Allan Crooks wrote:
> Hi,
>
> Is there anyway to make Python display __doc__ strings without all the "\n" characters? I know I could manually split it and then rejoin it, but surely there's an easier way?
>
> I'm using Python 2.1 on WinNT 4, if that's of any use.
Use the pydoc module which is included in 2.1. For example:
>>> def f(x):
... """A dummy function.
... It returns x.
... """
... return x
...
>>> f.__doc__
'A dummy function.\n\tIt returns x.\n\t'
>>>
>>> from pydoc import help
>>> help(f)
Help on function f in module __main__:
f(x)
A dummy function.
It returns x.
pydoc is really cool!!
Regards:
Walter
--
--------------
Walter Moreira <> Centro de Matematica <> Universidad de la Republica
email: walterm@cmat.edu.uy <> HomePage: http://www.cmat.edu.uy/~walterm
+-----------------------------------------------------
/OD\_ | LEARNING, n. The kind of ignorance distinguishing
O o . |_o_o_) | the studious.
| -- Ambrose Bierce. Devil's Dictionary
--+--
From rpm@wag.caltech.edu Fri Jun 8 17:10:12 2001
From: rpm@wag.caltech.edu (Richard P. Muller)
Date: Fri, 08 Jun 2001 09:10:12 -0700
Subject: [Tutor] Re: python question
References:
Message-ID: <3B20F8E4.7B3F758E@wag.caltech.edu>
> tutor-request@python.org wrote:
>
> Subject: [Tutor] python question...
> Date: Thu, 7 Jun 2001 15:01:00 -0700 (PDT)
> From: Kelly Brett
> To: tutor@python.org
>
> hello-
>
> i'm brand new to programming, and i'm very excited about learning
> python. I've used the "instant hacking" tutorial on the website, and
> it's making total sense. i'm just wondering how it is that somebody
> can get good at this stuff. i understand that practice makes perfect,
> but it just seems like there are so many directions that can be
> taken.
>
> so, beside the aforementioned tutorial, what is a good resource that
> won't confuse the crap out of me?
You already answered your question, in part. The way to get better at
Python is simply to use it. Everywhere. Next time you have a simple
repetitive task to do on the computer, think about how you could do it
with Python. Hackers are generally lazy people, and would rather figure
out an elegant programming solution to a problem rather than have to
repeat some boring task over and over again.
I like Lutz/Ascher's "Learning Python" as a good into. After a while
you'll find all books rather limiting, though. Now I mostly just flip
through the Library Reference from the Python docs.
Some of the best advice anyone ever gave me was to "collect toys". Bill
McCurdy (now at LBL) told me this, in regard to how to be a better
computational chemist, but it applies to computer programming as well.
Next time you hear about some interesting idea (such as XML), algorithm
(such as quick sort), or program, rather than just read about it, code
up a simple "toy" version of it. It's amazing how much more you learn
when you actually try to program something -- it forces you to
understand every facet of the idea rather than simply the jist.
Rick
From pobrien@orbtech.com Fri Jun 8 17:13:57 2001
From: pobrien@orbtech.com (Patrick K. O'Brien)
Date: Fri, 8 Jun 2001 11:13:57 -0500
Subject: [Tutor] Idea to help newbies - let's define 'help'
Message-ID:
Here is an idea. When you run the python interpreter in interactive mode for
the very first time, it is probably pretty common to type the word 'help'
just to see what happens. And guess what you get:
>>> help
Traceback (most recent call last):
File "", line 1, in ?
NameError: name 'help' is not defined
>>>
This is not exactly the friendliest response you and I could think of giving
someone. (Especially if we want them to love Python the way we do.) So how
about joining me in a little project here where we define 'help' for use in
interactive mode? That means we need to create a script that will be pointed
to by PYTHONSTARTUP or some other mechanism. The script (I'll suggest the
name interactive.py) needs to contain useful functions like Remco Gerlich's
doc() function as well as others. In addition, there needs to be a function
named help() that will work with no parameters passed to it (at least none
required).
That's as far as I've gone with the idea. Anyone else interested?
---
Patrick K. O'Brien
Orbtech
"I am, therefore I think."
From pobrien@orbtech.com Fri Jun 8 17:54:58 2001
From: pobrien@orbtech.com (Patrick K. O'Brien)
Date: Fri, 8 Jun 2001 11:54:58 -0500
Subject: [Tutor] Idea to help newbies - let's define 'help'
In-Reply-To:
Message-ID:
I see now that pydoc has 'help' defined and is probably the way to go. So
one approach would be to just add 'from pydoc import help' to a startup
script. Or we could try to reinvent the wheel and learn something along the
way. I may do both.
The pydoc technique is pretty cool in that help is actually an object,
rather than simply a function:
help = Helper(sys.stdin, sys.stdout)
Helper is a custom class that does all kinds of things. Take a look at
pydoc.py for more inspiration.
---
Patrick K. O'Brien
Orbtech
"I am, therefore I think."
-----Original Message-----
From: tutor-admin@python.org [mailto:tutor-admin@python.org]On Behalf Of
Patrick K. O'Brien
Sent: Friday, June 08, 2001 11:14 AM
To: Python Tutor
Subject: [Tutor] Idea to help newbies - let's define 'help'
Here is an idea. When you run the python interpreter in interactive mode for
the very first time, it is probably pretty common to type the word 'help'
just to see what happens. And guess what you get:
>>> help
Traceback (most recent call last):
File "", line 1, in ?
NameError: name 'help' is not defined
>>>
This is not exactly the friendliest response you and I could think of giving
someone. (Especially if we want them to love Python the way we do.) So how
about joining me in a little project here where we define 'help' for use in
interactive mode? That means we need to create a script that will be pointed
to by PYTHONSTARTUP or some other mechanism. The script (I'll suggest the
name interactive.py) needs to contain useful functions like Remco Gerlich's
doc() function as well as others. In addition, there needs to be a function
named help() that will work with no parameters passed to it (at least none
required).
That's as far as I've gone with the idea. Anyone else interested?
---
Patrick K. O'Brien
Orbtech
"I am, therefore I think."
_______________________________________________
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
From pobrien@orbtech.com Fri Jun 8 18:41:24 2001
From: pobrien@orbtech.com (Patrick K. O'Brien)
Date: Fri, 8 Jun 2001 12:41:24 -0500
Subject: [Tutor] PYTHONSTARTUP under Win98
Message-ID:
I have a python script (.pythonrc.py) created and pointed to by
PYTHONSTARTUP in my autoexec.bat file under Win98SE. If I go to a dos prompt
and start python, the startup script is executed properly because the
functions I defined in .pythonrc.py are available according to dir() and
simply by using them. So everything is setup properly.
However, nothing happens when I launch one of the IDEs, such as IDLE,
PythonWin or Boa. I would have expected the interactive windows of these
tools to have executed my startup script. I know they can "see" it because
the following works:
>>> dir()
['__builtins__', '__doc__', '__name__', 'pywin']
>>> import os
>>> os.environ.get('PYTHONSTARTUP')
'C:\\My Documents\\pobrien\\.pythonrc.py'
>>> execfile(os.environ.get('PYTHONSTARTUP'))
>>> dir()
['__builtins__', '__doc__', '__name__', 'doc', 'help', 'os', 'pywin']
>>>
So what gives? Is this the expected behavior? I just found an IDLE command
line flag (-s will run $IDLESTARTUP or $PYTHONSTARTUP first) in the help
file. So maybe that is the case.
---
Patrick K. O'Brien
Orbtech
"I am, therefore I think."
From dyoo@hkn.eecs.berkeley.edu Sat Jun 9 08:06:10 2001
From: dyoo@hkn.eecs.berkeley.edu (Daniel Yoo)
Date: Sat, 9 Jun 2001 00:06:10 -0700 (PDT)
Subject: [Tutor] Re: [Edu-sig] Python resources CD available [getting help() as a
builtin]
In-Reply-To:
Message-ID:
>> Is it practical and possible to have pydoc's help() function
>> autoloaded by bundling a modified interpreter?
> Yes, I've followed that discussion on the tutor list too. I think some
> sort of interactive help would be great. I'm afraid modifying the
> interpreter is a bit beyond me at this point, however. Making the CD
> more interactive would be very cool, no doubt.
Yahoo! We don't need to recompile at all: we just need to append the
following to site.py within the library :
###
## (within site.py)
## Added by dyoo
from pydoc import help
__builtin__.help = help
del help
###
That will do it! Afterwards, help() will appear to be a builtin. I'll
crosspost this to the tutor list; people were wondering about this one.
This should definitely make things nicer for people.
From dyoo@hkn.eecs.berkeley.edu Sat Jun 9 08:26:36 2001
From: dyoo@hkn.eecs.berkeley.edu (Daniel Yoo)
Date: Sat, 9 Jun 2001 00:26:36 -0700 (PDT)
Subject: [Tutor] PYTHONSTARTUP under Win98
In-Reply-To:
Message-ID:
On Fri, 8 Jun 2001, Patrick K. O'Brien wrote:
> I have a python script (.pythonrc.py) created and pointed to by
> PYTHONSTARTUP in my autoexec.bat file under Win98SE. If I go to a dos prompt
Python only looks at PYTHONSTARTUP if you run it as an interactive
interpreter. That is, only when you run it through the dos prompt. It's
one of those details that the official tutorial sorta whispers vaguely
about... *grin*
"""
This file is only read in interactive sessions, not when Python reads
commands from a script, and not when /dev/tty is given as the explicit
source of commands (which otherwise behaves like an interactive session).
"""
http://www.python.org/doc/current/tut/node4.html#SECTION004230000000000000000
> So what gives? Is this the expected behavior? I just found an IDLE command
> line flag (-s will run $IDLESTARTUP or $PYTHONSTARTUP first) in the help
> file. So maybe that is the case.
Yes, you'll want to add the -s option to get IDLE to look at the
$PYTHONSTARTUP variable.
Another approach that we can use to get things to load automatically is to
add some lines to the "site.py", which makes changes for everyone,
regardless if we're running Python interactively or not.
Hope this helps!
From dyoo@hkn.eecs.berkeley.edu Sat Jun 9 08:47:57 2001
From: dyoo@hkn.eecs.berkeley.edu (Daniel Yoo)
Date: Sat, 9 Jun 2001 00:47:57 -0700 (PDT)
Subject: [Tutor] Utility functions - was: Best way to strip string string
padded with nulls
In-Reply-To:
Message-ID:
On Wed, 6 Jun 2001, Patrick K. O'Brien wrote:
> I think my question might not have been clear enough. I was wondering where
> to put these functions on my local machine. For example, should I create a
> file like utility.py and import that file into my other programs so I can
> make use of these little utility functions, like my stripnull()? Does that
> make sense? What do the rest of you do?
I often keep a small personal directory filled with useful scripts that
I've written. If a function seems a bit obscure, it goes into its own
little file. Who knows --- a unoverlapping-genome-sequence-displayer.py
might come in handy someday. *grin*
If it seems general enough, it'll go into a file that's more generically
named. For example, I put some of my string manipulating functions in a
file called "MyStringUtils.py". You can probably make it more personal by
putting your initials in the name somewhere... although I haven't done
this myself, since "MyDy.py" looks a little silly.
Finally, to make things nicer, I set my PYTHONPATH up so that those
scripts are available at my fingertips.
Hope this helps!
From dyoo@hkn.eecs.berkeley.edu Sat Jun 9 08:57:53 2001
From: dyoo@hkn.eecs.berkeley.edu (Daniel Yoo)
Date: Sat, 9 Jun 2001 00:57:53 -0700 (PDT)
Subject: [Tutor] importing modules
In-Reply-To:
Message-ID:
On Wed, 6 Jun 2001, Rik Klaver wrote:
> I have downloaded some modules (or packages), which I've already put under
> the 'Python21' folder in Win98. My problem is: Python lets me import some,
> such as dynwin, pmw and pingo, but not the Mmtk20, Numeric and Htmlgen. For
> some modules Python raises a SystemError.
Hmmm... This is a little strange! Mmtk (The Molecular Modeling
Toolkit) at:
http://starship.python.net/crew/hinsen/MMTK/
says that it needs both ScientificPython and Numeric Python to get things
running. At the same time, it looks like you might need the netCDF
library too! Whew. This might be a little ugly.
It might be good to get Numeric Python working first, and then get MmTk20
working. To get Scientific Python, try downloading here:
http://basic.netmeg.net/godzilla/
You can download the netcdf and scientific_netcdf dll libraries, which
you'll probably want to copy somewhere... can anyone give details on where
it's supposed to go on Win98? I believe it should go within the
site-packages/ directory, but I could be very wrong about this.
About Htmlgen, hmmm... I'm not quite sure. Are you using WinZip to unzip
the files? If so, you should have been ok; WinZip does the right thing
with long file names. Can you tell us where exactly you're copying them
to --- just in the Python21 folder, or in one of the smaller subfolders
there?
Installing new software is always a pain; I hope that this can be fixed
quickly. Good luck to you!
From arcege@speakeasy.net Sat Jun 9 13:01:34 2001
From: arcege@speakeasy.net (Michael P. Reilly)
Date: Sat, 9 Jun 2001 08:01:34 -0400 (EDT)
Subject: [Tutor] ExpectPy HOWTO/Tutorial/Handholding
In-Reply-To: <200106071637.f57GbTg11731@pop.nsacom.net> from "kromag@nsacom.net" at Jun 07, 2001 09:37:29 AM
Message-ID: <200106091201.f59C1Yg01761@dsl092-074-184.bos1.dsl.speakeasy.net>
kromag@nsacom.net wrote
> Several weeks ago I posted a question about parsing data from a serial port.
> The data from the serial port uses a binary 3 to signal that it is through
> transmitting. Someone mentioned that the ExpectPy module might be a good
> candidate for parsing this data.
>
> Does anyone have a HOWTO for ExpectPy?
There is no HOWTO for ExpectPy (unless someone wrote one without telling
the author). The original idea back when it was written four years
ago was that it was a supplement to Expect, and that the user would
probably be reading _Exploring Expect_. But then, that was a while ago.
There are links to the Expect site with more info.
What is it that you are looking for?
-Arcege
--
+----------------------------------+-----------------------------------+
| Michael P. Reilly | arcege@speakeasy.net |
From pobrien@orbtech.com Sat Jun 9 15:30:19 2001
From: pobrien@orbtech.com (Patrick K. O'Brien)
Date: Sat, 9 Jun 2001 09:30:19 -0500
Subject: [Tutor] Utility functions - was: Best way to strip string string padded with nulls
In-Reply-To:
Message-ID:
That does help. I'm just so in love with Python's approach of having
OneRightWay for everything that I'm trying to apply that to my own code. At
every step I'm wondering, what is the OneRightWay for this? (Yes, I have
been accused of being a bit anal.) If anyone else has a better OneRightWay
to organize code I'm all ears.
---
Patrick K. O'Brien
Orbtech
"I am, therefore I think."
-----Original Message-----
From: tutor-admin@python.org [mailto:tutor-admin@python.org]On Behalf Of
Daniel Yoo
Sent: Saturday, June 09, 2001 2:48 AM
To: Patrick K. O'Brien
Cc: Python Tutor
Subject: RE: [Tutor] Utility functions - was: Best way to strip string
string padded with nulls
On Wed, 6 Jun 2001, Patrick K. O'Brien wrote:
> I think my question might not have been clear enough. I was wondering
where
> to put these functions on my local machine. For example, should I create a
> file like utility.py and import that file into my other programs so I can
> make use of these little utility functions, like my stripnull()? Does that
> make sense? What do the rest of you do?
I often keep a small personal directory filled with useful scripts that
I've written. If a function seems a bit obscure, it goes into its own
little file. Who knows --- a unoverlapping-genome-sequence-displayer.py
might come in handy someday. *grin*
If it seems general enough, it'll go into a file that's more generically
named. For example, I put some of my string manipulating functions in a
file called "MyStringUtils.py". You can probably make it more personal by
putting your initials in the name somewhere... although I haven't done
this myself, since "MyDy.py" looks a little silly.
Finally, to make things nicer, I set my PYTHONPATH up so that those
scripts are available at my fingertips.
Hope this helps!
_______________________________________________
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
From pobrien@orbtech.com Sat Jun 9 15:52:01 2001
From: pobrien@orbtech.com (Patrick K. O'Brien)
Date: Sat, 9 Jun 2001 09:52:01 -0500
Subject: [Tutor] PYTHONSTARTUP under Win98
In-Reply-To:
Message-ID:
Thanks. I'm slowly catching on. The more I learn Python, the more impressed
I am with the language ... and the more disappointed I am with the
information about the environment. I think the setup and configuration of
Python is still too big of a barrier for newbies. Python 2.1 and distutils
has helped a lot, but there are still too many gotchas that get in the way.
And if you want to be seriously productive you're going to want to control
the python environment. For me, that means getting everything working the
way I want it to in IDLE, PythonWin, Boa and VisualPython.
And now you're telling me about site.py! Where the hell did that come from.
I don't remember seeing anything about that!!!
Okay, okay, I found it in the Python Essential Reference (excellent,
excellent book). I'll have to read about it in order to reply.
Thanks again for all your help.
---
Patrick K. O'Brien
Orbtech
"I am, therefore I think."
-----Original Message-----
From: tutor-admin@python.org [mailto:tutor-admin@python.org]On Behalf Of
Daniel Yoo
Sent: Saturday, June 09, 2001 2:27 AM
To: Patrick K. O'Brien
Cc: Python Tutor
Subject: Re: [Tutor] PYTHONSTARTUP under Win98
On Fri, 8 Jun 2001, Patrick K. O'Brien wrote:
> I have a python script (.pythonrc.py) created and pointed to by
> PYTHONSTARTUP in my autoexec.bat file under Win98SE. If I go to a dos
prompt
Python only looks at PYTHONSTARTUP if you run it as an interactive
interpreter. That is, only when you run it through the dos prompt. It's
one of those details that the official tutorial sorta whispers vaguely
about... *grin*
"""
This file is only read in interactive sessions, not when Python reads
commands from a script, and not when /dev/tty is given as the explicit
source of commands (which otherwise behaves like an interactive session).
"""
http://www.python.org/doc/current/tut/node4.html#SECTION00423000000000000000
0
> So what gives? Is this the expected behavior? I just found an IDLE command
> line flag (-s will run $IDLESTARTUP or $PYTHONSTARTUP first) in the help
> file. So maybe that is the case.
Yes, you'll want to add the -s option to get IDLE to look at the
$PYTHONSTARTUP variable.
Another approach that we can use to get things to load automatically is to
add some lines to the "site.py", which makes changes for everyone,
regardless if we're running Python interactively or not.
Hope this helps!
_______________________________________________
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
From pobrien@orbtech.com Sat Jun 9 15:52:03 2001
From: pobrien@orbtech.com (Patrick K. O'Brien)
Date: Sat, 9 Jun 2001 09:52:03 -0500
Subject: [Tutor] Re: [Edu-sig] Python resources CD available [getting help() as a builtin]
In-Reply-To:
Message-ID:
Cool idea. Could I suggest a small change, though? The documentation for
site says this:
"After these path manipulations, an attempt is made to import a module
named sitecustomize, which can perform arbitrary additional
site-specific customizations. If this import fails with an
ImportError exception, it is silently ignored."
So would it make more sense to create a sitecustomize.py file with your
code? I'm going to give it a try, as soon as I have another cup of coffee.
---
Patrick K. O'Brien
Orbtech
"I am, therefore I think."
-----Original Message-----
From: tutor-admin@python.org [mailto:tutor-admin@python.org]On Behalf Of
Daniel Yoo
Sent: Saturday, June 09, 2001 2:06 AM
To: Timothy Wilson
Cc: Python-Edu SIG; tutor@python.org
Subject: [Tutor] Re: [Edu-sig] Python resources CD available [getting help()
as a builtin]
>> Is it practical and possible to have pydoc's help() function
>> autoloaded by bundling a modified interpreter?
> Yes, I've followed that discussion on the tutor list too. I think some
> sort of interactive help would be great. I'm afraid modifying the
> interpreter is a bit beyond me at this point, however. Making the CD
> more interactive would be very cool, no doubt.
Yahoo! We don't need to recompile at all: we just need to append the
following to site.py within the library :
###
## (within site.py)
## Added by dyoo
from pydoc import help
__builtin__.help = help
del help
###
That will do it! Afterwards, help() will appear to be a builtin. I'll
crosspost this to the tutor list; people were wondering about this one.
This should definitely make things nicer for people.
_______________________________________________
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
From pobrien@orbtech.com Sat Jun 9 16:18:41 2001
From: pobrien@orbtech.com (Patrick K. O'Brien)
Date: Sat, 9 Jun 2001 10:18:41 -0500
Subject: [Tutor] Re: [Edu-sig] Python resources CD available [getting help() as a builtin]
In-Reply-To:
Message-ID:
Here is the code in site.py that attempts to load sitecustomize.py. As you
can gather, sitecustomize.py will have to be on the PYTHONPATH in order to
be found, which limits where the file can be located.
#
# Run custom site specific code, if available.
#
try:
import sitecustomize
except ImportError:
pass
Site.py lives in the Lib directory, so that might be one place to put
sitecustomize.py. I don't like that because I like to keep customizations
separate from standard Python stuff. So I will probably put this into one of
my own personal directories. But that doesn't work as a standard approach.
Now that I've played with this I actually like Daniel Yoo's original
suggestion the best. Maybe someone should suggest to Guido and company that
Daniel's change to site.py be added to the standard distribution. There is
something of a precedent in that site.py includes some code to define
responses to some other terms (see code below). Anyone know how to submit a
PEP?
--- snipped from site.py as support for PEP XXXXX ---
# Define new built-ins 'quit' and 'exit'.
# These are simply strings that display a hint on how to exit.
if os.sep == ':':
exit = 'Use Cmd-Q to quit.'
elif os.sep == '\\':
exit = 'Use Ctrl-Z plus Return to exit.'
else:
exit = 'Use Ctrl-D (i.e. EOF) to exit.'
import __builtin__
__builtin__.quit = __builtin__.exit = exit
del exit
---
Patrick K. O'Brien
Orbtech
"I am, therefore I think."
-----Original Message-----
From: tutor-admin@python.org [mailto:tutor-admin@python.org]On Behalf Of
Patrick K. O'Brien
Sent: Saturday, June 09, 2001 9:52 AM
To: Python-Edu SIG; tutor@python.org
Subject: RE: [Tutor] Re: [Edu-sig] Python resources CD available [getting
help() as a builtin]
Cool idea. Could I suggest a small change, though? The documentation for
site says this:
"After these path manipulations, an attempt is made to import a module
named sitecustomize, which can perform arbitrary additional
site-specific customizations. If this import fails with an
ImportError exception, it is silently ignored."
So would it make more sense to create a sitecustomize.py file with your
code? I'm going to give it a try, as soon as I have another cup of coffee.
---
Patrick K. O'Brien
Orbtech
"I am, therefore I think."
From pobrien@orbtech.com Sat Jun 9 17:16:21 2001
From: pobrien@orbtech.com (Patrick K. O'Brien)
Date: Sat, 9 Jun 2001 11:16:21 -0500
Subject: [Tutor] Re: [Edu-sig] Python resources CD available [getting help() as a builtin]
In-Reply-To:
Message-ID:
I gave this a try (Adding Daniel's code to sitecustomize.py) and it didn't
quite work. Some stuff did and some didn't. As you can see from the sample
session below, help on a specific function works, but help with no
parameters does not. Weird. Daniel's code works when entered interactively
but not when loaded from sitecustomize.py. So then I tried the original
suggestion to add it to site.py and I get the same behavior. Can anyone else
confirm this? Daniel? I ran this on Win98SE with Python 2.1.
---
>>> help
Traceback (most recent call last):
File "", line 1, in ?
File "c:\python21\lib\pydoc.py", line 1276, in __repr__
self()
File "c:\python21\lib\pydoc.py", line 1285, in __call__
self.interact()
File "c:\python21\lib\pydoc.py", line 1297, in interact
self.output.flush()
IOError: [Errno 9] Bad file descriptor
>>> help(len)
Help on built-in function len:
len(...)
len(object) -> integer
Return the number of items of a sequence or mapping.
>>>
---
Patrick K. O'Brien
Orbtech
"I am, therefore I think."
-----Original Message-----
From: edu-sig-admin@python.org [mailto:edu-sig-admin@python.org]On Behalf Of
Patrick K. O'Brien
Sent: Saturday, June 09, 2001 9:52 AM
To: Python-Edu SIG; tutor@python.org
Subject: RE: [Tutor] Re: [Edu-sig] Python resources CD available [getting
help() as a builtin]
Cool idea. Could I suggest a small change, though? The documentation for
site says this:
"After these path manipulations, an attempt is made to import a module
named sitecustomize, which can perform arbitrary additional
site-specific customizations. If this import fails with an
ImportError exception, it is silently ignored."
So would it make more sense to create a sitecustomize.py file with your
code? I'm going to give it a try, as soon as I have another cup of coffee.
---
Patrick K. O'Brien
Orbtech
"I am, therefore I think."
-----Original Message-----
From: tutor-admin@python.org [mailto:tutor-admin@python.org]On Behalf Of
Daniel Yoo
Sent: Saturday, June 09, 2001 2:06 AM
To: Timothy Wilson
Cc: Python-Edu SIG; tutor@python.org
Subject: [Tutor] Re: [Edu-sig] Python resources CD available [getting help()
as a builtin]
>> Is it practical and possible to have pydoc's help() function
>> autoloaded by bundling a modified interpreter?
> Yes, I've followed that discussion on the tutor list too. I think some
> sort of interactive help would be great. I'm afraid modifying the
> interpreter is a bit beyond me at this point, however. Making the CD
> more interactive would be very cool, no doubt.
Yahoo! We don't need to recompile at all: we just need to append the
following to site.py within the library :
###
## (within site.py)
## Added by dyoo
from pydoc import help
__builtin__.help = help
del help
###
That will do it! Afterwards, help() will appear to be a builtin. I'll
crosspost this to the tutor list; people were wondering about this one.
This should definitely make things nicer for people.
_______________________________________________
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
_______________________________________________
Edu-sig mailing list
Edu-sig@python.org
http://mail.python.org/mailman/listinfo/edu-sig
From pobrien@orbtech.com Sat Jun 9 17:34:53 2001
From: pobrien@orbtech.com (Patrick K. O'Brien)
Date: Sat, 9 Jun 2001 11:34:53 -0500
Subject: [Tutor] Re: [Edu-sig] Python resources CD available [getting help() as a builtin]
In-Reply-To:
Message-ID:
Just to be thoroughly anal about this whole thing, I added the following
code to my .pythonrc.py PYTHONSTARTUP file:
import __builtin__
from pydoc import help
__builtin__.help = help
del help
del __builtin__
When I go into an IDE that honors PYTHONSTARTUP, such as IDLE with the -s
command line switch, help is added to builtin and works completely fine (see
below for sample output).
I must admit, I'm not sure I understand the advantage of having help be a
builtin versus having it be just 'from pydoc import help' except that the
latter did nothing when I tried it as part of site.py. So I imagine there
are namespace things going on that I don't fully understand.
---
Here is what 'help' at the python prompt should look like:
---
>>> help
Welcome to Python 2.1! This is the online help utility.
If this is your first time using Python, you should definitely check out
the tutorial on the Internet at http://www.python.org/doc/tut/.
Enter the name of any module, keyword, or topic to get help on writing
Python programs and using Python modules. To quit this help utility and
return to the interpreter, just type "quit".
To get a list of available modules, keywords, or topics, type "modules",
"keywords", or "topics". Each module also comes with a one-line summary
of what it does; to list the modules whose summaries contain a given word
such as "spam", type "modules spam".
help>
---
Patrick K. O'Brien
Orbtech
"I am, therefore I think."
-----Original Message-----
From: edu-sig-admin@python.org [mailto:edu-sig-admin@python.org]On Behalf Of
Patrick K. O'Brien
Sent: Saturday, June 09, 2001 11:16 AM
To: Python-Edu SIG; tutor@python.org
Subject: RE: [Tutor] Re: [Edu-sig] Python resources CD available [getting
help() as a builtin]
I gave this a try (Adding Daniel's code to sitecustomize.py) and it didn't
quite work. Some stuff did and some didn't. As you can see from the sample
session below, help on a specific function works, but help with no
parameters does not. Weird. Daniel's code works when entered interactively
but not when loaded from sitecustomize.py. So then I tried the original
suggestion to add it to site.py and I get the same behavior. Can anyone else
confirm this? Daniel? I ran this on Win98SE with Python 2.1.
---
>>> help
Traceback (most recent call last):
File "", line 1, in ?
File "c:\python21\lib\pydoc.py", line 1276, in __repr__
self()
File "c:\python21\lib\pydoc.py", line 1285, in __call__
self.interact()
File "c:\python21\lib\pydoc.py", line 1297, in interact
self.output.flush()
IOError: [Errno 9] Bad file descriptor
>>> help(len)
Help on built-in function len:
len(...)
len(object) -> integer
Return the number of items of a sequence or mapping.
>>>
---
Patrick K. O'Brien
Orbtech
"I am, therefore I think."
From kromag@nsacom.net Sun Jun 10 07:35:11 2001
From: kromag@nsacom.net (kromag@nsacom.net)
Date: Sat, 9 Jun 2001 23:35:11 -0700 (PDT)
Subject: [Tutor] PosixSerial.py seems to be missing....
Message-ID: <200106100635.f5A6ZBg21652@pop.nsacom.net>
Does anyone know of a mirror for the PosixSerial.py module? The link at
Vaults of Parnassus is dead. (http://members.tripod.com/~gcavazos/)
Thanks!
d
From allan.crooks@btinternet.com Sun Jun 10 15:28:38 2001
From: allan.crooks@btinternet.com (Allan Crooks)
Date: Sun, 10 Jun 2001 15:28:38 +0100
Subject: [Tutor] Central Python Library / Viewing __doc__ strings
Message-ID:
Hi,
First off, thanks to everyone who responded to my message. Needless to say, I feel somewhat stupid for not trying print. :)
Thanks for the scripts people sent as well. I'm growing somewhat fond of Patrick's however, so I'll probably use that over Pydoc's. Thanks very much Patrick. :)
BTW, does anyone know how Pydoc retrieves the arg list for functions when you use help?
e.g.
>>> def t(x,y,s,ll,m,f=None,n=2):
.. print x,y,s,ll,m,f,n
>>> pydoc.help(t)
Help on function t in module __main__:
t(x, y, s, ll, m, f=None, n=2)
Which now brings me to my next question: Is there a central repository of functions that exist somewhere? Something like a utility module? It just seems a shame for all these methods to just float around without having a home of some sort...
Thanks again,
Allan.
From pobrien@orbtech.com Sun Jun 10 16:16:21 2001
From: pobrien@orbtech.com (Patrick K. O'Brien)
Date: Sun, 10 Jun 2001 10:16:21 -0500
Subject: [Tutor] Central Python Library / Viewing __doc__ strings
In-Reply-To:
Message-ID:
You are most welcome. If you are interested, here is the latest version of
my startup file (.pythonrc.py):
from pydoc import help
from pprint import pprint
def doc(x):
"""Print type, representation and documentation string for object x."""
print "Object:", str(x)
print "Object Type:", type(x)
print "Representation:", repr(x)
print "Documentation String:"
print "---------------------"
try:
print x.__doc__
except AttributeError:
print "This object does not have a documentation string."
# Let the user know that this file has been loaded by their IDE.
# If it doesn't get loaded they won't see the following message.
import os
print "---"
print "Python Startup file (%s) was loaded." %
os.environ.get('PYTHONSTARTUP')
print "---"
del os
---
Patrick K. O'Brien
Orbtech
"I am, therefore I think."
-----Original Message-----
From: tutor-admin@python.org [mailto:tutor-admin@python.org]On Behalf Of
Allan Crooks
Sent: Sunday, June 10, 2001 9:29 AM
To: tutor@python.org
Subject: [Tutor] Central Python Library / Viewing __doc__ strings
Hi,
First off, thanks to everyone who responded to my message. Needless to say,
I feel somewhat stupid for not trying print. :)
Thanks for the scripts people sent as well. I'm growing somewhat fond of
Patrick's however, so I'll probably use that over Pydoc's. Thanks very much
Patrick. :)
From pobrien@orbtech.com Sun Jun 10 17:12:09 2001
From: pobrien@orbtech.com (Patrick K. O'Brien)
Date: Sun, 10 Jun 2001 11:12:09 -0500
Subject: [Tutor] Central Python Library / Viewing __doc__ strings
In-Reply-To:
Message-ID:
Not entirely sure what you are looking for, but here are some suggestions
anyway:
1. Type dir() to see a list of stuff in the current namespace. Type
dir([object]) to get a list of attributes/methods/functions for an object.
For example:
>>> import pydoc
>>> dir(pydoc)
['Doc', 'ErrorDuringImport', 'HTMLDoc', 'HTMLRepr', 'Helper',
'ModuleScanner', 'Repr', 'Scanner', 'TextDoc', 'TextRepr', '__author__',
'__builtins__', '__credits__', '__date__', '__doc__', '__file__',
'__name__', '__version__', 'allmethods', 'apropos', 'classname', 'cli',
'cram', 'describe', 'doc', 'expandtabs', 'find', 'getdoc', 'getpager',
'gui', 'help', 'html', 'imp', 'importfile', 'inspect', 'isdata',
'ispackage', 'ispath', 'join', 'locate', 'lower', 'os', 'pager', 'pathdirs',
'pipepager', 'plain', 'plainpager', 're', 'replace', 'rfind', 'rstrip',
'safeimport', 'serve', 'split', 'splitdoc', 'stat', 'strip', 'stripid',
'synopsis', 'sys', 'tempfilepager', 'text', 'ttypager', 'types', 'writedoc',
'writedocs']
>>>
2. Look in the documentation at the module index to see all the modules and
the functions defined in each
(http://www.python.org/doc/current/modindex.html). Or try the index
(http://www.python.org/doc/current/lib/genindex.html).
Let me know if I am way off base because I'm sure I probably misunderstood
the question.
---
Patrick K. O'Brien
Orbtech
"I am, therefore I think."
-----Original Message-----
From: tutor-admin@python.org [mailto:tutor-admin@python.org]On Behalf Of
Allan Crooks
Sent: Sunday, June 10, 2001 9:29 AM
To: tutor@python.org
Subject: [Tutor] Central Python Library / Viewing __doc__ strings
Hi,
Which now brings me to my next question: Is there a central repository of
functions that exist somewhere? Something like a utility module? It just
seems a shame for all these methods to just float around without having a
home of some sort...
Thanks again,
Allan.
_______________________________________________
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
From allan.crooks@btinternet.com Sun Jun 10 18:09:43 2001
From: allan.crooks@btinternet.com (Allan Crooks)
Date: Sun, 10 Jun 2001 18:09:43 +0100
Subject: [Tutor] Central Python Library / Viewing __doc__ strings
Message-ID:
Thanks for the information, but yes, there was a bit of a misunderstanding. :)
What I meant was is there any kind of place where code that we've written can become easily public domain?
For example, I've written a piece of code that denests lists, tuples, and any other sequence type (it's better than I've described it, honest). It's currently sitting at home, not publicly available. I could put it online, but I doubt anyone would really be interested in it on it's own (they could probably write something in the time it takes to actually find it).
But if there was some place where little pieces of code was collected together and put in the public domain, so that people could find it more easily, and people could use this utility module to use several little functions (to save time coding their own).
I think Useless Python is the closest that I've come to it, but I think I'm looking for a place to submit generic functions. I may just end up putting my own repository of code online anyway...... Just wondered if there was a way I could donate my code for the "greater good" really. :)
Thanks anyway,
Allan.
> Not entirely sure what you are looking for, but here are some suggestions
> anyway:
>
> 1. Type dir() to see a list of stuff in the current namespace. Type
> dir([object]) to get a list of attributes/methods/functions for an object.
> For example:
>
> >>> import pydoc
> >>> dir(pydoc)
> ['Doc', 'ErrorDuringImport', 'HTMLDoc', 'HTMLRepr', 'Helper',
> 'ModuleScanner', 'Repr', 'Scanner', 'TextDoc', 'TextRepr', '__author__',
> '__builtins__', '__credits__', '__date__', '__doc__', '__file__',
> '__name__', '__version__', 'allmethods', 'apropos', 'classname', 'cli',
> 'cram', 'describe', 'doc', 'expandtabs', 'find', 'getdoc', 'getpager',
> 'gui', 'help', 'html', 'imp', 'importfile', 'inspect', 'isdata',
> 'ispackage', 'ispath', 'join', 'locate', 'lower', 'os', 'pager', 'pathdirs',
> 'pipepager', 'plain', 'plainpager', 're', 'replace', 'rfind', 'rstrip',
> 'safeimport', 'serve', 'split', 'splitdoc', 'stat', 'strip', 'stripid',
> 'synopsis', 'sys', 'tempfilepager', 'text', 'ttypager', 'types', 'writedoc',
> 'writedocs']
> >>>
>
> 2. Look in the documentation at the module index to see all the modules and
> the functions defined in each
> (http://www.python.org/doc/current/modindex.html). Or try the index
> (http://www.python.org/doc/current/lib/genindex.html).
>
>
> Let me know if I am way off base because I'm sure I probably misunderstood
> the question.
>
> ---
> Patrick K. O'Brien
> Orbtech
> "I am, therefore I think."
>
> -----Original Message-----
> From: tutor-admin@python.org [mailto:tutor-admin@python.org]On Behalf Of
> Allan Crooks
> Sent: Sunday, June 10, 2001 9:29 AM
> To: tutor@python.org
> Subject: [Tutor] Central Python Library / Viewing __doc__ strings
>
> Hi,
>
>
>
> Which now brings me to my next question: Is there a central repository of
> functions that exist somewhere? Something like a utility module? It just
> seems a shame for all these methods to just float around without having a
> home of some sort...
>
> Thanks again,
> Allan.
>
>
> _______________________________________________
> Tutor maillist - Tutor@python.org
> http://mail.python.org/mailman/listinfo/tutor
>
>
From pobrien@orbtech.com Sun Jun 10 18:28:07 2001
From: pobrien@orbtech.com (Patrick K. O'Brien)
Date: Sun, 10 Jun 2001 12:28:07 -0500
Subject: [Tutor] Central Python Library / Viewing __doc__ strings
In-Reply-To:
Message-ID:
Ah, yes. That code sounds interesting. I wouldn't mind seeing it myself. I
think I might have a need for something like that, actually. Useless Python
is a great spot for something like this and the Python Cookbook is as well
(http://aspn.activestate.com/ASPN/Python/Cookbook/). I think the Python
Cookbook is exactly what you were looking for. See what you think. In the
mean time, I'd love a copy of the code. Thanks.
---
Patrick K. O'Brien
Orbtech
"I am, therefore I think."
-----Original Message-----
From: tutor-admin@python.org [mailto:tutor-admin@python.org]On Behalf Of
Allan Crooks
Sent: Sunday, June 10, 2001 12:10 PM
To: tutor@python.org
Subject: RE: [Tutor] Central Python Library / Viewing __doc__ strings
Thanks for the information, but yes, there was a bit of a misunderstanding.
:)
What I meant was is there any kind of place where code that we've written
can become easily public domain?
For example, I've written a piece of code that denests lists, tuples, and
any other sequence type (it's better than I've described it, honest). It's
currently sitting at home, not publicly available. I could put it online,
but I doubt anyone would really be interested in it on it's own (they could
probably write something in the time it takes to actually find it).
But if there was some place where little pieces of code was collected
together and put in the public domain, so that people could find it more
easily, and people could use this utility module to use several little
functions (to save time coding their own).
I think Useless Python is the closest that I've come to it, but I think I'm
looking for a place to submit generic functions. I may just end up putting
my own repository of code online anyway...... Just wondered if there was a
way I could donate my code for the "greater good" really. :)
Thanks anyway,
Allan.
> Not entirely sure what you are looking for, but here are some suggestions
> anyway:
>
> 1. Type dir() to see a list of stuff in the current namespace. Type
> dir([object]) to get a list of attributes/methods/functions for an object.
> For example:
>
> >>> import pydoc
> >>> dir(pydoc)
> ['Doc', 'ErrorDuringImport', 'HTMLDoc', 'HTMLRepr', 'Helper',
> 'ModuleScanner', 'Repr', 'Scanner', 'TextDoc', 'TextRepr', '__author__',
> '__builtins__', '__credits__', '__date__', '__doc__', '__file__',
> '__name__', '__version__', 'allmethods', 'apropos', 'classname', 'cli',
> 'cram', 'describe', 'doc', 'expandtabs', 'find', 'getdoc', 'getpager',
> 'gui', 'help', 'html', 'imp', 'importfile', 'inspect', 'isdata',
> 'ispackage', 'ispath', 'join', 'locate', 'lower', 'os', 'pager',
'pathdirs',
> 'pipepager', 'plain', 'plainpager', 're', 'replace', 'rfind', 'rstrip',
> 'safeimport', 'serve', 'split', 'splitdoc', 'stat', 'strip', 'stripid',
> 'synopsis', 'sys', 'tempfilepager', 'text', 'ttypager', 'types',
'writedoc',
> 'writedocs']
> >>>
>
> 2. Look in the documentation at the module index to see all the modules
and
> the functions defined in each
> (http://www.python.org/doc/current/modindex.html). Or try the index
> (http://www.python.org/doc/current/lib/genindex.html).
>
>
> Let me know if I am way off base because I'm sure I probably misunderstood
> the question.
>
> ---
> Patrick K. O'Brien
> Orbtech
> "I am, therefore I think."
>
> -----Original Message-----
> From: tutor-admin@python.org [mailto:tutor-admin@python.org]On Behalf Of
> Allan Crooks
> Sent: Sunday, June 10, 2001 9:29 AM
> To: tutor@python.org
> Subject: [Tutor] Central Python Library / Viewing __doc__ strings
>
> Hi,
>
>
>
> Which now brings me to my next question: Is there a central repository of
> functions that exist somewhere? Something like a utility module? It just
> seems a shame for all these methods to just float around without having a
> home of some sort...
>
> Thanks again,
> Allan.
>
>
> _______________________________________________
> Tutor maillist - Tutor@python.org
> http://mail.python.org/mailman/listinfo/tutor
>
>
_______________________________________________
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
From dyoo@hkn.eecs.berkeley.edu Sun Jun 10 18:26:05 2001
From: dyoo@hkn.eecs.berkeley.edu (Daniel Yoo)
Date: Sun, 10 Jun 2001 10:26:05 -0700 (PDT)
Subject: [Tutor] Central Python Library / Viewing __doc__ strings
In-Reply-To:
Message-ID:
On Sun, 10 Jun 2001, Allan Crooks wrote:
> I think Useless Python is the closest that I've come to it, but I
> think I'm looking for a place to submit generic functions. I may just
> end up putting my own repository of code online anyway...... Just
> wondered if there was a way I could donate my code for the "greater
> good" really. :)
The Vaults of Parnassus is one of the "official" repositories for Python
code:
http://www.vex.net/parnassus
Another place that might be relevant is the Python Cookbook, maintained
here:
http://aspn.activestate.com/ASPN/Cookbook/Python
Hope this helps!
From rob@jam.rr.com Sun Jun 10 18:32:07 2001
From: rob@jam.rr.com (Rob Andrews)
Date: Sun, 10 Jun 2001 12:32:07 -0500
Subject: [Tutor] Central Python Library / Viewing __doc__ strings
References:
Message-ID: <3B23AF17.A580EBF@jam.rr.com>
Allan Crooks wrote:
>
> Thanks for the information, but yes, there was a bit of a misunderstanding. :)
>
> What I meant was is there any kind of place where code that we've written can become easily public domain?
>
> For example, I've written a piece of code that denests lists, tuples, and any other sequence type (it's better than I've described it, honest). It's currently sitting at home, not publicly available. I could put it online, but I doubt anyone would really be interested in it on it's own (they could probably write something in the time it takes to actually find it).
>
> But if there was some place where little pieces of code was collected together and put in the public domain, so that people could find it more easily, and people could use this utility module to use several little functions (to save time coding their own).
>
> I think Useless Python is the closest that I've come to it, but I think I'm looking for a place to submit generic functions. I may just end up putting my own repository of code online anyway...... Just wondered if there was a way I could donate my code for the "greater good" really. :)
>
> Thanks anyway,
> Allan.
>
Of course your code is always welcome at Useless Python (which I just
gave Yet Another face-lift, including quotes from some of you). I
encourage people to send material to Useless, the Vaults, the Cookbook,
and anywhere else you care to. Although many of us look at CPAN with
just a hint of envy, I like the fact that Useless, the Vaults, and the
Cookbook are actually quite different from each other.
After all, There's More Than One Way To Do It! (Oh, wait.... That's Perl
again.)
Rob
--
Useless Python!
Kinda like the AOL of the Open Source Community 3;->
http://www.lowerstandard.com/python/index.html
From dyoo@hkn.eecs.berkeley.edu Sun Jun 10 18:37:50 2001
From: dyoo@hkn.eecs.berkeley.edu (Daniel Yoo)
Date: Sun, 10 Jun 2001 10:37:50 -0700 (PDT)
Subject: [Tutor] Re: [Edu-sig] Python resources CD available [getting
help() as a builtin]
In-Reply-To:
Message-ID:
On Sat, 9 Jun 2001, Patrick K. O'Brien wrote:
> import __builtin__
> from pydoc import help
> __builtin__.help = help
> del help
> del __builtin__
>
> When I go into an IDE that honors PYTHONSTARTUP, such as IDLE with the
> -s command line switch, help is added to builtin and works completely
> fine (see below for sample output).
Ah, good! I'm glad it's working now.
> I must admit, I'm not sure I understand the advantage of having help
> be a builtin versus having it be just 'from pydoc import help' except
> that the latter did nothing when I tried it as part of site.py. So I
> imagine there are namespace things going on that I don't fully
> understand.
It's a namespacing issue: if we do the "from pydoc import help", then
help()'s visible from the 'site' module, since that's where it's being
imported into. However, it's not visible anywhere outside, and that's the
big problem. We can do a small example to explore this if you want.
It's an extension of the "local variables" idea, but instead of functions,
it uses whole files (modules) as the containers.
The way the code gets around this isolating behavior is it grabs the
__builtin__ module, which is actually just a big container for all the
built-in functions that Python makes available to us globally.
###
>>> import __builtin__
>>> dir(__builtin__)
['ArithmeticError', 'AssertionError', 'AttributeError',
'DeprecationWarning', 'EOFError', 'Ellipsis', 'EnvironmentError',
'Exception', 'FloatingPointError', 'IOError', 'ImportError',
'IndentationError', 'IndexError', 'KeyError', 'KeyboardInterrupt',
'LookupError', 'MemoryError', 'NameError', 'None', 'NotImplemented',
'NotImplementedError', 'OSError', 'OverflowError', 'RuntimeError',
'RuntimeWarning', 'StandardError', 'SyntaxError', 'SyntaxWarning',
'SystemError', 'SystemExit', 'TabError', 'TypeError', 'UnboundLocalError',
'UnicodeError', 'UserWarning', 'ValueError', 'Warning',
'ZeroDivisionError', '__debug__', '__doc__', '__import__', '__name__',
'abs', 'apply', 'buffer', 'callable', 'chr', 'cmp', 'coerce', 'compile',
'complex', 'copyright', 'credits', 'delattr', 'dir', 'divmod', 'eval',
'execfile', 'exit', 'filter', 'float', 'getattr', 'globals', 'hasattr',
'hash', 'hex', 'id', 'input', 'int', 'intern', 'isinstance', 'issubclass',
'len', 'license', 'list', 'locals', 'long', 'map', 'max', 'min', 'oct',
'open', 'ord', 'pow', 'quit', 'range', 'raw_input', 'reduce', 'reload',
'repr', 'round', 'setattr', 'slice', 'str', 'tuple', 'type', 'unichr',
'unicode', 'vars', 'xrange', 'zip']
###
The code snippet that we have:
> import __builtin__
> from pydoc import help
> __builtin__.help = help
is meant to stuff our help function() alongside those other functions.
[about the unsuccessful approach in sitecustomize.py]
> but not when loaded from sitecustomize.py. So then I tried the original
> suggestion to add it to site.py and I get the same behavior. Can anyone else
> confirm this? Daniel? I ran this on Win98SE with Python 2.1.
Hmmm! I haven't been able to confirm this; I don't have Windows on this
laptop. I'll see if I can check this on Win2k when I get home though.
From pobrien@orbtech.com Sun Jun 10 18:41:01 2001
From: pobrien@orbtech.com (Patrick K. O'Brien)
Date: Sun, 10 Jun 2001 12:41:01 -0500
Subject: [Tutor] Central Python Library / Viewing __doc__ strings
In-Reply-To:
Message-ID:
First, the short answer. It's all in the inspect module:
>>> import inspect
>>> inspect.getargspec(t)
(['x', 'y', 's', 'll', 'm', 'f', 'n'], None, None, (None, 2))
That gets you part of the way. Then you need to do some formatting:
>>> inspect.formatargspec(inspect.getargspec(t))
'((x, y, s, ll, m, f, n), None, None, (None, 2))'
Then you'll need to spend a few hours dissecting the inspect module to
figure out everything that goes on to get the arguments and produce the
final formatting that help(t) shows. (Because I'm too tired to do it myself
and I'm already in trouble with the wife for spending all morning on this.
)
Now for the long(er) answer. Here is the relevant method from pydoc.py. It
is part of the Helper class defined in pydoc:
def help(self, request):
if type(request) is type(''):
if request == 'help': self.intro()
elif request == 'keywords': self.listkeywords()
elif request == 'topics': self.listtopics()
elif request == 'modules': self.listmodules()
elif request[:8] == 'modules ':
self.listmodules(split(request)[1])
elif self.keywords.has_key(request): self.showtopic(request)
elif self.topics.has_key(request): self.showtopic(request)
elif request: doc(request, 'Help on %s:')
elif isinstance(request, Helper): self()
else: doc(request, 'Help on %s:')
self.output.write('\n')
So calling help on an object results in a call to doc(object, 'Help on
%s:'). Doc() is a function that looks like:
def doc(thing, title='Python Library Documentation: %s', forceload=0):
"""Display text documentation, given an object or a path to an
object."""
suffix, name = '', None
if type(thing) is type(''):
try:
object = locate(thing, forceload)
except ErrorDuringImport, value:
print value
return
if not object:
print 'no Python documentation found for %s' % repr(thing)
return
parts = split(thing, '.')
if len(parts) > 1: suffix = ' in ' + join(parts[:-1], '.')
name = parts[-1]
thing = object
desc = describe(thing)
module = inspect.getmodule(thing)
if not suffix and module and module is not thing:
suffix = ' in module ' + module.__name__
pager(title % (desc + suffix) + '\n\n' + text.document(thing, name))
The last bit of code - text.document(thing, name) - is what we need to
explore. Doc() gets documentation on the thing with the document() method of
the TextDoc class (which is a child of the Doc class and the document method
is actually defined in the Doc class, not in TextDoc):
class Doc:
def document(self, object, name=None, *args):
"""Generate documentation for an object."""
args = (object, name) + args
if inspect.ismodule(object): return apply(self.docmodule, args)
if inspect.isclass(object): return apply(self.docclass, args)
if inspect.isroutine(object): return apply(self.docroutine, args)
return apply(self.docother, args)
Since in your example t is a function (inspect.isroutine(t) will return 1,
or true), we need to look at self.docroutine:
class TextDoc(Doc):
...
def docroutine(self, object, name=None, mod=None, cl=None):
"""Produce text documentation for a function or method object."""
realname = object.__name__
name = name or realname
note = ''
skipdocs = 0
if inspect.ismethod(object):
imclass = object.im_class
if cl:
if imclass is not cl:
note = ' from ' + classname(imclass, mod)
skipdocs = 1
else:
if object.im_self:
note = ' method of %s instance' % classname(
object.im_self.__class__, mod)
else:
note = ' unbound %s method' % classname(imclass,mod)
object = object.im_func
if name == realname:
title = self.bold(realname)
else:
if (cl and cl.__dict__.has_key(realname) and
cl.__dict__[realname] is object):
skipdocs = 1
title = self.bold(name) + ' = ' + realname
if inspect.isbuiltin(object):
argspec = '(...)'
else:
args, varargs, varkw, defaults = inspect.getargspec(object)
argspec = inspect.formatargspec(
args, varargs, varkw, defaults,
formatvalue=self.formatvalue)
if realname == '':
title = 'lambda'
argspec = argspec[1:-1] # remove parentheses
decl = title + argspec + note
if skipdocs:
return decl + '\n'
else:
doc = getdoc(object) or ''
return decl + '\n' + (doc and rstrip(self.indent(doc)) + '\n')
Now, this is a lot of code to look at, but the answer to your question lies
with inspect.getargspec(object). If we run that bit of code on t we get the
following:
>>> inspect.getargspec(t)
(['x', 'y', 's', 'll', 'm', 'f', 'n'], None, None, (None, 2))
>>>
The rest of the code makes things a prettier. Again, that analysis will be
left as an exercise for the reader.
Hope that answered your question.
---
Patrick K. O'Brien
Orbtech
"I am, therefore I think."
-----Original Message-----
From: tutor-admin@python.org [mailto:tutor-admin@python.org]On Behalf Of
Allan Crooks
Sent: Sunday, June 10, 2001 9:29 AM
To: tutor@python.org
Subject: [Tutor] Central Python Library / Viewing __doc__ strings
BTW, does anyone know how Pydoc retrieves the arg list for functions when
you use help?
e.g.
>>> def t(x,y,s,ll,m,f=None,n=2):
.. print x,y,s,ll,m,f,n
>>> pydoc.help(t)
Help on function t in module __main__:
t(x, y, s, ll, m, f=None, n=2)
Thanks again,
Allan.
_______________________________________________
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
From pobrien@orbtech.com Sun Jun 10 19:22:07 2001
From: pobrien@orbtech.com (Patrick K. O'Brien)
Date: Sun, 10 Jun 2001 13:22:07 -0500
Subject: [Tutor] Re: [Edu-sig] Python resources CD available [getting help() as a builtin]
In-Reply-To:
Message-ID:
Just to clarify a tiny bit. (I hope) Adding help to the builtins works from
my PYTHONSTARTUP file, but not from site.py or sitecustomize.py. So it
doesn't really have any advantage over 'from pydoc import help' when loaded
this way, does it? If it will only work properly from the startup file, I
feel that "from pydoc import help" is just as good an approach. In fact, it
has the advantage of being listed in dir() and not buried in __builtins__.
Or am I missing something?
I think I understand the namespace concept pretty well. (I hope. ) What I
don't understand is why the module pointed to by PYTHONSTARTUP is part of
the global namespace (which is why we can just do 'from pydoc import help'
in it, and the help function stays around) while site.py is not (so while
'from pydoc import help' works it also "disappears" once control goes to the
interactive prompt, unless we do the __builtin__ trick). Well, I do
understand why it works that way for the startup file. It just seemed like
it would work the same for site.py, based on the (skimpy) documentation. So
my confusion has more to do with a lack of documented behavior, rather than
the behavior itself, if that makes any sense. And maybe the answer is just
"because".
Other than that, I understand and agree with everything you say below. I
just wish I knew why your suggested code doesn't entirely work in site.py.
---
Patrick K. O'Brien
Orbtech
"I am, therefore I think."
-----Original Message-----
From: tutor-admin@python.org [mailto:tutor-admin@python.org]On Behalf Of
Daniel Yoo
Sent: Sunday, June 10, 2001 12:38 PM
To: Patrick K. O'Brien
Cc: tutor@python.org
Subject: RE: [Tutor] Re: [Edu-sig] Python resources CD available [getting
help() as a builtin]
On Sat, 9 Jun 2001, Patrick K. O'Brien wrote:
> import __builtin__
> from pydoc import help
> __builtin__.help = help
> del help
> del __builtin__
>
> When I go into an IDE that honors PYTHONSTARTUP, such as IDLE with the
> -s command line switch, help is added to builtin and works completely
> fine (see below for sample output).
Ah, good! I'm glad it's working now.
> I must admit, I'm not sure I understand the advantage of having help
> be a builtin versus having it be just 'from pydoc import help' except
> that the latter did nothing when I tried it as part of site.py. So I
> imagine there are namespace things going on that I don't fully
> understand.
It's a namespacing issue: if we do the "from pydoc import help", then
help()'s visible from the 'site' module, since that's where it's being
imported into. However, it's not visible anywhere outside, and that's the
big problem. We can do a small example to explore this if you want.
It's an extension of the "local variables" idea, but instead of functions,
it uses whole files (modules) as the containers.
The way the code gets around this isolating behavior is it grabs the
__builtin__ module, which is actually just a big container for all the
built-in functions that Python makes available to us globally.
###
>>> import __builtin__
>>> dir(__builtin__)
['ArithmeticError', 'AssertionError', 'AttributeError',
'DeprecationWarning', 'EOFError', 'Ellipsis', 'EnvironmentError',
'Exception', 'FloatingPointError', 'IOError', 'ImportError',
'IndentationError', 'IndexError', 'KeyError', 'KeyboardInterrupt',
'LookupError', 'MemoryError', 'NameError', 'None', 'NotImplemented',
'NotImplementedError', 'OSError', 'OverflowError', 'RuntimeError',
'RuntimeWarning', 'StandardError', 'SyntaxError', 'SyntaxWarning',
'SystemError', 'SystemExit', 'TabError', 'TypeError', 'UnboundLocalError',
'UnicodeError', 'UserWarning', 'ValueError', 'Warning',
'ZeroDivisionError', '__debug__', '__doc__', '__import__', '__name__',
'abs', 'apply', 'buffer', 'callable', 'chr', 'cmp', 'coerce', 'compile',
'complex', 'copyright', 'credits', 'delattr', 'dir', 'divmod', 'eval',
'execfile', 'exit', 'filter', 'float', 'getattr', 'globals', 'hasattr',
'hash', 'hex', 'id', 'input', 'int', 'intern', 'isinstance', 'issubclass',
'len', 'license', 'list', 'locals', 'long', 'map', 'max', 'min', 'oct',
'open', 'ord', 'pow', 'quit', 'range', 'raw_input', 'reduce', 'reload',
'repr', 'round', 'setattr', 'slice', 'str', 'tuple', 'type', 'unichr',
'unicode', 'vars', 'xrange', 'zip']
###
The code snippet that we have:
> import __builtin__
> from pydoc import help
> __builtin__.help = help
is meant to stuff our help function() alongside those other functions.
[about the unsuccessful approach in sitecustomize.py]
> but not when loaded from sitecustomize.py. So then I tried the original
> suggestion to add it to site.py and I get the same behavior. Can anyone
else
> confirm this? Daniel? I ran this on Win98SE with Python 2.1.
Hmmm! I haven't been able to confirm this; I don't have Windows on this
laptop. I'll see if I can check this on Win2k when I get home though.
_______________________________________________
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
From dyoo@hkn.eecs.berkeley.edu Sun Jun 10 20:46:47 2001
From: dyoo@hkn.eecs.berkeley.edu (Daniel Yoo)
Date: Sun, 10 Jun 2001 12:46:47 -0700 (PDT)
Subject: [Tutor] PosixSerial.py seems to be missing....
In-Reply-To: <200106100635.f5A6ZBg21652@pop.nsacom.net>
Message-ID:
On Sat, 9 Jun 2001 kromag@nsacom.net wrote:
> Does anyone know of a mirror for the PosixSerial.py module? The link at
> Vaults of Parnassus is dead. (http://members.tripod.com/~gcavazos/)
Ouch! I haven't been able to find this either; you may want to ask the
comp.lang.python folks and bring this to their attention.
From israel@lith.com Sun Jun 10 21:35:19 2001
From: israel@lith.com (Israel Evans)
Date: Sun, 10 Jun 2001 13:35:19 -0700
Subject: [Tutor] request: info on AI and related subjects for Python
Message-ID:
Has anyone found any good information on applying Python to AI/Neural
network yada yada programming and whether or not it's a good idea?
~Israel~
From lumbricus@gmx.net Sun Jun 10 22:49:06 2001
From: lumbricus@gmx.net (lumbricus@gmx.net)
Date: Sun, 10 Jun 2001 23:49:06 +0200
Subject: [Tutor] request: info on AI and related subjects for Python
In-Reply-To: ; from israel@lith.com on Sun, Jun 10, 2001 at 01:35:19PM -0700
References:
Message-ID: <20010610234906.A14085@Laplace.localdomain>
On Sun, Jun 10, 2001 at 01:35:19PM -0700, Israel Evans wrote:
> Has anyone found any good information on applying Python to AI/Neural
> network yada yada programming and whether or not it's a good idea?
>
"http://www.ai.uga.edu/~jae/ai.html"
"http://www-acs.ucsd.edu/~jstrout/python/ai/"
>
> ~Israel~
>
HTH J!
> _______________________________________________
> Tutor maillist - Tutor@python.org
> http://mail.python.org/mailman/listinfo/tutor
>
--
Colorless green ideas sleep furiously.
From InternetShops@mail.ru Mon Jun 11 00:22:30 2001
From: InternetShops@mail.ru (InternetShops@mail.ru)
Date: Mon, 11 Jun 2001 01:22:30 +0200
Subject: [Tutor] úáëáú îáäåöîïçï ïâïòõäï÷áîéñ þåòåú éîôåòîåô
Message-ID: <200106102322.f5ANMUM14499@friedrich.unkelhaeuser.de>
This is a MIME encoded message.
--b21fe52ec73da2129e8a6323ced0b8f49
Content-Type: text/html ; charset="windows-1251"
Content-Transfer-Encoding: base64
PCFET0NUWVBFIEhUTUwgUFVCTElDICItLy9XM0MvL0RURCBIVE1MIDQuMCBUcmFuc2l0aW9uYWwv
L0VOIj4NCg0KPGh0bWw+DQo8aGVhZD4NCgk8dGl0bGU+x8DKwMcgzcDExcbNzsPOIM7BztDTxM7C
wM3I3yDXxdDFxyDIzdLF0M3F0jwvdGl0bGU+DQo8L2hlYWQ+DQoNCjxib2R5Pg0KPGRpdiBhbGln
bj0iQ0VOVEVSIj4NCjxoMj7V7vDu+OXlIO7h7vDz5O7i4O3o5SDs7ubt7iDq8+/o8vwsIOfg6uDn
4OIg9+Xw5ecgyO3y5fDt5fI6PC9oMj4NCjx0YWJsZT4NCjx0cj4NCgk8dGQ+PGI+yu7s7/z+8uXw
+zo8L2I+PC90ZD4NCjwvdHI+DQo8dHI+DQoJPHRkPjxhIGhyZWY9Imh0dHA6Ly93d3cudmlzdC5y
dUB3d3cuamFuLWhlbmRyaWsuY29tL3Jlcy5waHA/dD10dXRvckBweXRob24ub3JnJnM9dmlzdC5y
dSI+dmlzdC5ydTwvYT48YnI+DQoJPGEgaHJlZj0iaHR0cDovL3d3dy5rbG9uZGFpay5ydUB3d3cu
amFuLWhlbmRyaWsuY29tL3Jlcy5waHA/dD10dXRvckBweXRob24ub3JnJnM9a2xvbmRhaWsucnUi
Pmtsb25kYWlrLnJ1PC9hPjxicj4NCgk8YSBocmVmPSJodHRwOi8vd3d3Lm12aWRlby5ydUB3d3cu
amFuLWhlbmRyaWsuY29tL3Jlcy5waHA/dD10dXRvckBweXRob24ub3JnJnM9bXZpZGVvLnJ1Ij5t
dmlkZW8ucnU8L2E+DQoJPC90ZD4NCjwvdHI+DQo8dHI+DQoJPHRkPjxiPs3u8/Lh8+roOjwvYj48
L3RkPg0KPC90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c2NvcHkucnVAd3d3Lmphbi1oZW5kcmlrLmNvbS9yZXMu
cGhwP3Q9dHV0b3JAcHl0aG9uLm9yZyZzPXNjb3B5LnJ1Ij5zY29weS5ydTwvYT48L3RkPg0KPC90
cj4NCjwvdGFibGU+DQoNCjwvZGl2Pg0KPC9ib2R5Pg0KPC9odG1sPg0K
--b21fe52ec73da2129e8a6323ced0b8f49--
From dyoo@hkn.eecs.berkeley.edu Mon Jun 11 03:03:09 2001
From: dyoo@hkn.eecs.berkeley.edu (Daniel Yoo)
Date: Sun, 10 Jun 2001 19:03:09 -0700 (PDT)
Subject: [Tutor] request: info on AI and related subjects for Python
In-Reply-To:
Message-ID:
On Sun, 10 Jun 2001, Israel Evans wrote:
> Has anyone found any good information on applying Python to AI/Neural
> network yada yada programming and whether or not it's a good idea?
Peter Norvig, one of the authors of the textbook, "Artifical Inteligence:
A Modern Approach", has a small page about Python in his AI programming.
His page is here:
http://www.norvig.com/python-lisp.html
This isn't quite what you're looking for though, because it only explains
the differences between Lisp and Python. It sounds like you're more
interested in actual applications of AI stuff. Parnassus does have some
links to AI programs. For example, there are some neural net
implementations here:
http://www.vex.net/parnassus/apyllo.py?find=neural+net
If you want something more input about this, you might want to talk with
people on comp.lang.python as well; I believe that Mark Lutz or one of the
other Python authors has written expert system shells in Python, so Python
seems to be a reasonable language for certain AI applications.
Anyway, hope this helps!
From bcarey@ix.netcom.com Mon Jun 11 03:47:40 2001
From: bcarey@ix.netcom.com (William N Carey)
Date: Sun, 10 Jun 2001 19:47:40 -0700
Subject: [Tutor] a db question
Message-ID: <200106110244.WAA11500@barry.mail.mindspring.net>
Hi all,
I'm new to Python. I love Python, and recently tried
using it to do a very simple database project, but perhaps my
expectations were unrealistic. Using Python 2.0 on a Win2000
machine with 256M Ram and many gigs of disk space, I couldn't
successfully load a text file which consists of a 12 character key
and a 38 character text string as the record. The problem is that
the file consist of about 800,000 records. I used "anydb" which
on my machine uses bsddb as the default (I believe). After about
120,000 records the load would halt with
an "error: (0, 'error')" . The key and text string are normal. I can
start the reload a couple of records short of where it blew up, and it
continues for another 100,000 or so records, and blows up again,
until it finally halts at about 400,000 records with a hard halt
(invoking my Visual C++ debugger).
I built in a file.sync instruction which happens every 10,000
records, and this didn't help.
I suspect that I am asking the "db" routines to do too much, but
that is disappointing to me, because Python has always done
whatever I wanted in my limited past with it. Below is the very
simple program that doesn't finish.
Thanks for any advice!!!
import os, anydbm
ofile = anydbm.open("e:\\python20\\lib\\wnctrans","c")
ifile = open("e:\\python20\\lib\\wncdet","rb")
fin = ifile.fileno()
for x in range(0,783284):
if x % 10000 == 0:
ofile.sync
print x
ptr = os.lseek(fin,x * 50, 0)
wstr = os.read(fin,50)
if len(wstr) == 50:
key12 = str(wstr[:12])
item = str(wstr[12:])
ofile[key12] = item
os.close(fin)
print "Done..."
dum = raw_input("any key")
ofile.clo
From wheelege@tsn.cc Mon Jun 11 05:39:53 2001
From: wheelege@tsn.cc (Glen Wheeler)
Date: Mon, 11 Jun 2001 14:39:53 +1000
Subject: [Tutor] a db question
References: <200106110244.WAA11500@barry.mail.mindspring.net>
Message-ID: <00cc01c0f230$907f7cc0$0200a8c0@ACE>
> <...>
> I built in a file.sync instruction which happens every 10,000
> records, and this didn't help.
>
I'm no db expert, but in your code you aren't calling that function - you
have forgotten the ()'s :).
> <...>
>
> import os, anydbm
> ofile = anydbm.open("e:\\python20\\lib\\wnctrans","c")
> ifile = open("e:\\python20\\lib\\wncdet","rb")
> fin = ifile.fileno()
> for x in range(0,783284):
> if x % 10000 == 0:
> ofile.sync
Just here ------^^
> print x
Perhaps you could try your code without this print?
> ptr = os.lseek(fin,x * 50, 0)
> wstr = os.read(fin,50)
> if len(wstr) == 50:
> key12 = str(wstr[:12])
> item = str(wstr[12:])
> ofile[key12] = item
> os.close(fin)
> print "Done..."
> dum = raw_input("any key")
> ofile.clo
And I assume this is a classic copy and paste error, but this should be
ofile.close() :)
Anywho, hope that helped,
Glen.
From wheelege@tsn.cc Mon Jun 11 07:52:23 2001
From: wheelege@tsn.cc (Glen Wheeler)
Date: Mon, 11 Jun 2001 16:52:23 +1000
Subject: [Tutor] a db question
References: <200106110535.BAA13343@maynard.mail.mindspring.net>
Message-ID: <001201c0f243$1221a7a0$0200a8c0@ACE>
> Glen,
>
> I tried your suggestions, putting the parentheses after "sync" and
> getting rid of the print statement... it didn't help. It went much
> faster with no print statement, but it blew up at exactly the same
> spot. I carefully checked both the key value and the record (text
> string), and they were fine. I think it may be that I only have 256M
> of RAM, and I'm getting some kind of caching problem.
Indeed, like some sort of virtual memory problem...good old windows.
> Also, if I restart the program a couple of records before the one that
> it blew up on, it continues fine for another 100,000 records or so,
> so it doesn't seem to be a problem with my data.
>
That's good news. In that case, I would suggest using multiple files -
your code looks like this...
import os, anydbm
ofile = anydbm.open("e:\\python20\\lib\\wnctrans","c")
ifile = open("e:\\python20\\lib\\wncdet","rb")
fin = ifile.fileno()
for x in range(0,783284):
if x % 10000 == 0:
ofile.sync
print x
ptr = os.lseek(fin,x * 50, 0)
wstr = os.read(fin,50)
if len(wstr) == 50:
key12 = str(wstr[:12])
item = str(wstr[12:])
ofile[key12] = item
os.close(fin)
print "Done..."
dum = raw_input("any key")
ofile.close()
Right? I suppose you could try doing the same thing, but split it up into
smaller loops. For example...
t = 0
for x in range(1000):
t += x
Could become...
t = 0
for y in range((1000/10), (1000+(1000/10)), (1000/10)): ## that last thing
is called the 'step'
st = 0
for x in range((y-(1000/10)), y):
st += x
t += st
del st
I left the range things unsimplified because although the look a little
ugly now, I hope that this way it is easier to see what is happening. In
both cases t will have the same end value.
Or, even better, look into the os() module and try to find stuff on memory
allocation. I'm afraid that the multiple loops thing may just be a dead
end, so it looks like either you get thrown a bone from people more
knowledgeable than me (come on guys :) or have a bit of reading ahead of
you. Either way, alot of fun.
Hope that helped,
Glen.
From ppathiyi@cisco.com Mon Jun 11 10:50:33 2001
From: ppathiyi@cisco.com (Praveen Pathiyil)
Date: Mon, 11 Jun 2001 15:20:33 +0530
Subject: [Tutor] Getting a function name from within itself
Message-ID: <00a601c0f25b$f513b8b0$37ef87c0@ppathiyipc>
This is a multi-part message in MIME format.
------=_NextPart_000_00A3_01C0F28A.0EA2C1D0
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Hi all,
I am posting a question which is not specific to python.=20
Is there a way to get the name of a function from within itself =
at runtime ? Suppose that i have a function f1. At the run time when it =
encounters some condition ( errors or some condition which i want to let =
the user know by printing), I want to say that this warning originated =
from this function f1, without actually hard coding that name in the =
print statement.
def f1(self):
--- do something --
Print "Warning ......", function_name
Can i get the function name from execution environment or something ?
Thanks,
Praveen.
------=_NextPart_000_00A3_01C0F28A.0EA2C1D0
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Hi all,
I =
am posting=20
a question which is not specific to python.
Is there=20
a way to get the name of a function from within itself at runtime ? =
Suppose that=20
i have a function f1. At the run time when it encounters some condition =
( errors=20
or some condition which i want to let the user know by printing), I want =
to say=20
that this warning originated from this function f1, without actually =
hard coding=20
that name in the print statement.
def f1(self):
--- do something =
--
Print "Warning =
......",=20
function_name
Can i get the function name from =
execution=20
environment or something ?
Thanks,
Praveen.
------=_NextPart_000_00A3_01C0F28A.0EA2C1D0--
From toodles@yifan.net Mon Jun 11 11:42:36 2001
From: toodles@yifan.net (Andrew Wilkins)
Date: Mon, 11 Jun 2001 18:42:36 +0800
Subject: [Tutor] Getting a function name from within itself
In-Reply-To: <00a601c0f25b$f513b8b0$37ef87c0@ppathiyipc>
Message-ID:
This is a multi-part message in MIME format.
------=_NextPart_000_0002_01C0F2A6.48A15740
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: base64
DQogICAgICAgICAgSSBhbSBwb3N0aW5nIGEgcXVlc3Rpb24gd2hpY2ggaXMgbm90IHNwZWNpZmlj
IHRvIHB5dGhvbi4gDQogICAgICAgICAgSXMgdGhlcmUgYSB3YXkgdG8gZ2V0IHRoZSBuYW1lIG9m
IGEgZn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9TUEFOPiZuYnNwOzwvRElWPg0KICA8RElW
PjxTUEFOIGNsYXNzPTcxMDA3MjIxMC0xMTA2MjAwMT48Rk9OVCBmYWNlPVRhaG9tYSBjb2xvcj0j
MDAwMGZmIA0KICBzaXplPTI+Q2xhc3NlcyBhcmUgYWx3YXlzIGZ1biAqZ3Jpbio8L0ZPTlQ+PC9T
UEFOPjwvRElWPg0KICA8RElWPjxTUEFOIGNsYXNzPTcxMDA3MjIxMC0xMTA2MjAwMT48Rk9OVCBm
YWNlPVRhaG9tYSBjb2xvcj0jMDAwMGZmIA0KICBzaXplPTI+PC9GT05UPjwvU1BBTj4mbmJzcDs8
L0RJVj4NCiAgPERJVj48U1BBTiBjbGFzcz03MTAwNzIyMTAtMTEwNjIwMDE+PEZPTlQgZmFjZT1U
YWhvbWEgY29sb3I9IzAwMDBmZiANCiAgc2l6ZT0yPkFuZHJldzwvRk9OVD48L1NQQU4+PC9ESVY+
PC9CTE9DS1FVT1RFPjwvQk9EWT48L0hUTUw+DQo=
------=_NextPart_000_0002_01C0F2A6.48A15740--
From arcege@speakeasy.net Mon Jun 11 13:07:43 2001
From: arcege@speakeasy.net (Michael P. Reilly)
Date: Mon, 11 Jun 2001 08:07:43 -0400 (EDT)
Subject: [Tutor] Getting a function name from within itself
In-Reply-To: <00a601c0f25b$f513b8b0$37ef87c0@ppathiyipc> from "Praveen Pathiyil" at Jun 11, 2001 03:20:33 PM
Message-ID: <200106111207.f5BC7he11666@dsl092-074-184.bos1.dsl.speakeasy.net>
Praveen Pathiyil wrote
> I am posting a question which is not specific to python.=20
> Is there a way to get the name of a function from within itself =
> at runtime ? Suppose that i have a function f1. At the run time when it =
> encounters some condition ( errors or some condition which i want to let =
> the user know by printing), I want to say that this warning originated =
> from this function f1, without actually hard coding that name in the =
> print statement.
>
> def f1(self):
> --- do something --
> Print "Warning ......", function_name
>
> Can i get the function name from execution environment or something ?
You can use the traceback object from exceptions to get this information.
>>> def get_caller():
... import sys
... try: raise SystemError
... except SystemError:
... exc, val, tb = sys.exc_info()
... # from the traceback, get the second frame back (first is get_caller)
... caller = tb.tb_frame.f_back
... # delete the traceback object to free memory
... del exc, val, tb
... return caller
...
At this point, you would get a frame for the calling function, which
contain a reference to the code, and subsequently to the name.
>>> def whatsmyline():
... print 'function name is', get_caller().f_code.co_name
...
>>> whatsmyline()
function name is whatsmyline
>>>
This is the most common (and least obtrusive) idiom. In Python 2.1,
there is now a new standard library module called "inspect" which does
a lot of this for you.
-Arcege
--
+----------------------------------+-----------------------------------+
| Michael P. Reilly | arcege@speakeasy.net |
From hanna@chagford.com Mon Jun 11 22:40:49 2001
From: hanna@chagford.com (Hanna Joo)
Date: Mon, 11 Jun 2001 14:40:49 -0700
Subject: [Tutor] Threads.. help /___\ (look of despair)
Message-ID: <012001c0f2bf$303aa940$0100007f@localdomain>
Hi all
I wrote a simple consumer - producer program trying to use threads (solid
emphasis on 'trying'). I have this feeling I don't know how to pass
arguments to threads and keep it synchronized.. any help will be greatly
appreaciated.
import threading
from time import sleep
def producer():
soup = 'ABCDEFGHIJKLMNOP'
while len(buff) != 15:
inx = randint(1,15)
buff.append(soup[inx])
print soup[inx], "thrown into soup!!"
sleep(randint(1,3))
def consumer():
while len(buff) :
a = buff.pop()
print a, "eaten from soup!!"
sleep(randint(1,3))
def main():
print 'starting threads...'
buff = []
firstthread = threading.Thread(target=producer, args=(buffer)) #---->
problem area!!
secondthread = threading.Thread(target=consumer, args=(buffer)) #---->
problem area!!
firstthread.start()
secondthread.start()
firstthread.join()
secondthread.join()
if __name__ == '__main__':
main()
ERROR>:
Exception in thread Thread-1:
Traceback (most recent call last):
File "c:\python\lib\threading.py", line 376, in __bootstrap
self.run()
File "c:\python\lib\threading.py", line 364, in run
apply(self.__target, self.__args, self.__kwargs)
TypeError: apply() 2nd argument must be a sequence
Exception in thread Thread-2:
Traceback (most recent call last):
File "c:\python\lib\threading.py", line 376, in __bootstrap
self.run()
File "c:\python\lib\threading.py", line 364, in run
apply(self.__target, self.__args, self.__kwargs)
TypeError: apply() 2nd argument must be a sequence
TIA
Hanna
From arcege@speakeasy.net Mon Jun 11 14:46:10 2001
From: arcege@speakeasy.net (Michael P. Reilly)
Date: Mon, 11 Jun 2001 09:46:10 -0400 (EDT)
Subject: [Tutor] Threads.. help /___\ (look of despair)
In-Reply-To: <012001c0f2bf$303aa940$0100007f@localdomain> from "Hanna Joo" at Jun 11, 2001 02:40:49 PM
Message-ID: <200106111346.f5BDkAo11794@dsl092-074-184.bos1.dsl.speakeasy.net>
Hanna Joo wrote
>
> Hi all
>
> I wrote a simple consumer - producer program trying to use threads (solid
> emphasis on 'trying'). I have this feeling I don't know how to pass
> arguments to threads and keep it synchronized.. any help will be greatly
> appreaciated.
I see four errors here:
1. You are not importing the randint function. This is minor though.
from random import randint
2. The arguments to the threads should be a sequence (really should be
a tuple); to make a singleton tuple, you need to add a comma:
(1) ==> the expression of the number 1
(1,) ==> a tuple containing the number 1
3. Both functions do not allow for the argument being given.
def producer(buff):
4. The "buffer" in main does not exist, but "buff" does. You should
be consistant in the names within a function.
> import threading
> from time import sleep
from random import randint
>
> def producer():
def producer(buff):
>
> soup = 'ABCDEFGHIJKLMNOP'
> while len(buff) != 15:
> inx = randint(1,15)
> buff.append(soup[inx])
> print soup[inx], "thrown into soup!!"
> sleep(randint(1,3))
>
> def consumer():
def consumer(buff):
>
> while len(buff) :
> a = buff.pop()
> print a, "eaten from soup!!"
> sleep(randint(1,3))
>
>
> def main():
>
> print 'starting threads...'
> buff = []
buffer = []
> firstthread = threading.Thread(target=producer, args=(buffer))
firstthread = threading.Thread(target=producer, args=(buffer,))
> secondthread = threading.Thread(target=consumer, args=(buffer))
secondthread = threading.Thread(target=consumer, args=(buffer,))
>
> firstthread.start()
> secondthread.start()
>
> firstthread.join()
> secondthread.join()
>
> if __name__ == '__main__':
> main()
Once I made these changes, I got a working program (but probably not
what is expected *smile*).
HTH :)
-Arcege
--
+----------------------------------+-----------------------------------+
| Michael P. Reilly | arcege@speakeasy.net |
From dyoo@hkn.eecs.berkeley.edu Mon Jun 11 16:53:49 2001
From: dyoo@hkn.eecs.berkeley.edu (Daniel Yoo)
Date: Mon, 11 Jun 2001 08:53:49 -0700 (PDT)
Subject: [Tutor] Getting a function name from within itself
In-Reply-To:
Message-ID:
On Mon, 11 Jun 2001, Andrew Wilkins wrote:
> I am posting a question which is not specific to python.
> Is there a way to get the name of a function from within
> itself at runtime ? Suppose that i have a function f1. At the run time
> when it encounters some condition ( errors or some condition which i
> want to let the user know by printing), I want to say that this
> warning originated from this function f1, without actually hard coding
> that name in the print statement.
There must be a way to do this in Python, because the following:
###
>>> def f():
... pass
...
>>> x = f
>>> x
###
shows that 'x' remembers that it actually came out of function f. So, if
anything, we can always ask for the string repr() of a function during
runtime. After that, we can pull the name out of the string.
But this seems like a lot of work. Michael's suggestion to use inspect
sounds like the best way to get the function's name, but I've actually
never used inspect. Well, it's a good time to learn now! *grin*
Let's see...
http://python.org/doc/current/lib/inspect-types.html
sounds about right. It appears to show that we can use
inspect.getmembers(), and then pull out the particular 'member' that
contains the name:
###
>>> import inspect
>>> inspect.getmembers(x)
[('__dict__', None), ('__doc__', None), ('__name__', 'f'),
('func_closure', None), ('func_code', ", line 1>), ('func_defaults', None), ('func_dict', None),
('func_doc', None), ('func_globals', {'__doc__': None, 'inspect': , 'x':