Dr. Dobb's Python-URL! - weekly Python news and links (Jun 26)

2006-06-26 Thread Cameron Laird
QOTW:  In short, it's never what you think it is ;-) - timbot,
probably on the subject of performance

Real efficiency comes from elegant solutions, not optimized programs.
Optimization is always just a few correctness-preserving transformations
away. - Jonathan Sobel
http://www.cs.indiana.edu/~jsobel/c455-c511.updated.txt


Microsoft is (again) structuring its current marketing around
platforms, and apparently Python is starting to show up in
the campaigns:

http://www.microsoft.com/presspass/press/2006/jun06/06-20MSRoboticsStudioPR.mspx

Intel puts Python to good use in commercial program slicing:

http://groups.google.com/group/comp.lang.python/browse_thread/thread/98cd59f90b169896/

Transcoding PVRs?  Constructing collaborative whiteboards?
Streaming multimedia in all directions?  Apparently you can
construct very impressive network-aware audiovisual
applications *visually* with Kamaelia:

http://groups.google.com/group/comp.lang.python/browse_thread/thread/36c89411fba299b6/
If you only care about advanced concurrency methods, pipeline-
based methods, and componentry, well, that's in there, too,
wrapped as Axon:
http://groups.google.com/group/comp.lang.python/msg/7a5f189e886d9fc0

Discussion about the new Python icons might inspire a reader
to try them:

http://groups.google.com/group/comp.lang.python/browse_thread/thread/204f2792a882648d/

Wow:  PyPy is up to 0.9.0:
 
http://groups.google.com/group/comp.lang.python.announce/msg/6fa325e6c0cdd526

Life becomes more sophisticated than ever before:
http://golly.sourceforge.net/

Timbot illustrates how an experienced file-comparer thinks
about performance hacks (and Windows):
http://groups.google.com/group/comp.lang.python/msg/15d45c2b268fa410
... and how much deeper one can analyze recursion and numerics
than merely the tastes great!  less filling! level:
http://groups.google.com/group/comp.lang.python/msg/e67403fcaa06c022
http://groups.google.com/group/comp.lang.python/msg/4451e63833a0c1c1



Everything Python-related you want is probably one or two clicks away in
these pages:

Python.org's Python Language Website is the traditional
center of Pythonia
http://www.python.org
Notice especially the master FAQ
http://www.python.org/doc/FAQ.html

PythonWare complements the digest you're reading with the
marvelous daily python url
 http://www.pythonware.com/daily
Mygale is a news-gathering webcrawler that specializes in (new)
World-Wide Web articles related to Python.
 http://www.awaretek.com/nowak/mygale.html
While cosmetically similar, Mygale and the Daily Python-URL
are utterly different in their technologies and generally in
their results.

For far, FAR more Python reading than any one mind should
absorb, much of it quite interesting, several pages index
much of the universe of Pybloggers.
http://lowlife.jp/cgi-bin/moin.cgi/PythonProgrammersWeblog
http://www.planetpython.org/
http://mechanicalcat.net/pyblagg.html

comp.lang.python.announce announces new Python software.  Be
sure to scan this newsgroup weekly.

http://groups.google.com/groups?oi=djqas_ugroup=comp.lang.python.announce

Python411 indexes podcasts ... to help people learn Python ...
Updates appear more-than-weekly:
http://www.awaretek.com/python/index.html

Steve Bethard, Tim Lesher, and Tony Meyer continue the marvelous
tradition early borne by Andrew Kuchling, Michael Hudson and Brett
Cannon of intelligently summarizing action on the python-dev mailing
list once every other week.
http://www.python.org/dev/summary/

The Python Package Index catalogues packages.
http://www.python.org/pypi/

The somewhat older Vaults of Parnassus ambitiously collects references
to all sorts of Python resources.
http://www.vex.net/~x/parnassus/

Much of Python's real work takes place on Special-Interest Group
mailing lists
http://www.python.org/sigs/

Python Success Stories--from air-traffic control to on-line
match-making--can inspire you or decision-makers to whom you're
subject with a vision of what the language makes practical.
http://www.pythonology.com/success

The Python Software Foundation (PSF) has replaced the Python
Consortium as an independent nexus of activity.  It has official
responsibility for Python's development and maintenance.
http://www.python.org/psf/
Among the ways you can support PSF is with a donation.
http://www.python.org/psf/donate.html

Kurt B. Kaiser publishes a weekly report on faults and patches.
http://www.google.com/groups?as_usubject=weekly%20python%20patch

Although unmaintained 

Re: What is Expressiveness in a Computer Language

2006-06-26 Thread John Thingstad
On Sun, 25 Jun 2006 20:11:22 +0200, Anton van Straaten  
[EMAIL PROTECTED] wrote:

 [EMAIL PROTECTED] wrote:
 In this context, the term latently-typed language refers to the
 language that a programmer experiences, not to the subset of that
 language which is all that we're typically able to formally define.
   That language is not a subset, if at all, it's the other way round,  
 but
 I'd say they are rather incomparable. That is, they are different
 languages.

 The subset characterization is not important for what I'm saying.  The  
 fact that they are different languages is what's important.  If you  
 agree about that, then you can at least understand which language I'm  
 referring to when I say latently-typed language.

 Besides, many dynamically-typed languages have no formal models, in  
 which case the untyped formal model I've referred to is just a  
 speculative construct.  The language I'm referring to with  
 latently-typed language is the language that programmers are familiar  
 with, and work with.

 That is starting to get a bit too mystical for my tastes.
   I have to agree.
  \sarcasm One step further, and somebody starts calling C a latently
 memory-safe language, because a real programmer knows that his code
 is in a safe subset... And where he is wrong, dynamic memory page
 protection checks will guide him.

 That's a pretty apt comparison, and it probably explains how it is that  
 the software we all use, which relies so heavily on C, works as well as  
 it does.

 But the comparison critiques the practice of operating without static  
 guarantees, it's not a critique of the terminology.

 Anton

Actually I have never developed a C/C++ program
without a bounds checker the last 15 years.
It checks all memory references and on program shutdown
checks for memory leaks. What is it about you guys that make you blind
to these fact's. Allocation problem's haven't really bugged me at all
since forever. Now debugging fluky templates on the other hands..
But then debugging Lisp macro's isn't much better.

-- 
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/
-- 
http://mail.python.org/mailman/listinfo/python-list


list problem 4 newbie

2006-06-26 Thread manstey
I can't figure out why my code is not working. I thought I had the list
copied correctly:

Here is my code:



a=[[u'HF', []], [u')F', [u'75']], [u'RE', []], [u'C', []]]
b=a[:]

for index in reversed(range(0,len(a)-1)):
   if '75' in b[index][1]:
  b[index][1].remove('75')
  b[index][1].append('99')

print a,'\n',b



but when it finishes, I get

[[u'HF', []], [u')F', ['99']], [u'RE', []], [u'C', []]]
[[u'HF', []], [u')F', ['99']], [u'RE', []], [u'C', []]]

instead of the desired:

[[u'HF', []], [u')F', ['75']], [u'RE', []], [u'C', []]]
[[u'HF', []], [u')F', ['99']], [u'RE', []], [u'C', []]]

why is this?

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


Re: Python sub-interpreter, security

2006-06-26 Thread faulkner
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/496746

[EMAIL PROTECTED] wrote:
 Hello, I am writing a pure-Python game engine that interprets the code
 of game objects within the same process with the exec statement. My
 main goal is to make as much power available as possible and exec seems
 like the best way to do that.

 This is my proof-of-concept code(only 18 lines and some whitespace,
 including the test):

 http://people.ucsc.edu/~jhofmann/programmables.py

 I showed this to the Pygame list and recieved some interest and a
 completely different, more sophisticated implementation:

 http://codereactor.net/~shang/interpret/

 As-is, both versions are wide-open security holes. I think that I can
 patch them up if I run checks on the statements and eliminate all
 language features that pose risks. Then, features that are useful but
 not needed at their full capacity can be accessed through functions
 designed to be secure. Forcing a crash is not considered an exploit for
 this purpose(since it's a game engine - if it crashes, the user can
 recover and lose no data)

 What I'd like to know is, is it possible to meet this level of
 security, and if so, which features have to be eliminated?

 The two that I'm sure should go are module imports and self-modifying
 code. But in the latter case, I don't know all the ways that might be
 done. It seems like a very complicated problem, and if I can't solve it
 I might leave the whole thing unsecured.

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


Re: What is Expressiveness in a Computer Language

2006-06-26 Thread Anton van Straaten
Chris Smith wrote:
 What makes static type systems interesting is not the fact that these 
 logical processes of reasoning exist; it is the fact that they are 
 formalized with definite axioms and rules of inference, performed 
 entirely on the program before execution, and designed to be entirely 
 evaluatable in finite time bounds according to some procedure or set of 
 rules, so that a type system may be checked and the same conclusion 
 reached regardless of who (or what) is doing the checking.  All that, 
 and they still reach interesting conclusions about programs.  

There's only one issue mentioned there that needs to be negotiated 
w.r.t. latent types: the requirement that they are performed entirely 
on the program before execution.  More below.

 If 
 informal reasoning about types doesn't meet these criteria (and it 
 doesn't), then it simply doesn't make sense to call it a type system 
 (I'm using the static terminology here).  It may make sense to discuss 
 some of the ways that programmer reasoning resembles types, if indeed 
 there are resemblances beyond just that they use the same basic rules of 
 logic.  It may even make sense to try to identify a subset of programmer 
 reasoning that even more resembles... or perhaps even is... a type 
 system.  It still doesn't make sense to call programmer reasoning in 
 general a type system.

I'm not trying to call programmer reasoning in general a type system. 
I'd certainly agree that a programmer muddling his way through the 
development of a program, perhaps using a debugger to find all his 
problems empirically, may not be reasoning about anything that's 
sufficiently close to types to call them that.  But latent means what 
it implies: someone who is more aware of types can do better at 
developing the latent types.

As a starting point, let's assume we're dealing with a disciplined 
programmer who (following the instructions found in books such as the 
one at htdp.org) reasons about types, writes them in his comments, and 
perhaps includes assertions (or contracts in the sense of Contracts for 
Higher Order Functions[1]), to help check his types at runtime (and I'm 
talking about real type-checking, not just tag checking).

When such a programmer writes a type signature as a comment associated 
with a function definition, in many cases he's making a claim that's 
provable in principle about the inputs and outputs of that function.

For example, if the type in question is int - int, then the provable 
claim is that given an int, the function cannot return anything other 
than an int.  Voila, assuming we can actually prove our claim, then 
we've satisfied the requirement in Pierce's definition of type system, 
i.e. proving the absence of certain program behaviors by classifying 
phrases according to the kinds of values they compute.

The fact that the proof in question may not be automatically verified is 
no more relevant than the fact that so many proofs in mathematics have 
not been automatically verified.  Besides, if the proof turns out to be 
wrong, we at least have an automated mechanism for finding witnesses to 
the error: runtime tag checks will generate an error.  Such detection is 
not guaranteed, but again, proof does not imply automation.

What I've just described walks like a type and talks like a type, or at 
least it appears to do so according to Pierce's definition.  We can 
classify many terms in a given dynamically-typed program on this basis 
(although some languages may be better at supporting this than others).

So, on what grounds do you reject this as not being an example of a 
type, or at the very least, something which has clear and obvious 
connections to formal types, as opposed to simply being arbitrary 
programmer reasoning?

Is it the lack of a formalized type system, perhaps?  I assume you 
recognize that it's not difficult to define such a system.

Regarding errors, we haven't proved that the function in question can 
never be called with something other than an int, but we haven't claimed 
to prove that, so there's no problem there.  I've already described how 
errors in our proofs can be detected.

Another possible objection is that I'm talking about local cases, and 
not making any claims about extending it to an entire program (other 
than to observe that it can be done).  But let's take this a step at a 
time: considered in isolation, if we can assign types to terms at the 
local level in a program, do you agree that these are really types, in 
the type theory sense?

If you were to agree, then we could move on to looking at what it means 
to have many local situations in which we have fairly well-defined 
types, which may all be defined within a common type system.

As an initial next step, we could simply rely on the good old universal 
type everywhere else in the program - it ought to be possible to make 
the program well-typed in that case, it would just mean that the 
provable properties would be 

Re: Python sub-interpreter, security

2006-06-26 Thread jvvhie

faulkner wrote:
 http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/496746


Thanks! I was searching everywhere but couldn't find the right terms, I
guess.

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


Re: What is Expressiveness in a Computer Language

2006-06-26 Thread Anton van Straaten
John Thingstad wrote:
 On Sun, 25 Jun 2006 20:11:22 +0200, Anton van Straaten  
 [EMAIL PROTECTED] wrote:
 
 [EMAIL PROTECTED] wrote:
...
  \sarcasm One step further, and somebody starts calling C a latently
 memory-safe language, because a real programmer knows that his code
 is in a safe subset... And where he is wrong, dynamic memory page
 protection checks will guide him.


 That's a pretty apt comparison, and it probably explains how it is 
 that  the software we all use, which relies so heavily on C, works as 
 well as  it does.

 But the comparison critiques the practice of operating without static  
 guarantees, it's not a critique of the terminology.

 Anton
 
 
 Actually I have never developed a C/C++ program
 without a bounds checker the last 15 years.
 It checks all memory references and on program shutdown
 checks for memory leaks. What is it about you guys that make you blind
 to these fact's. 

You misunderstand -- for the purposes of the above comparison, a bounds 
checker serves essentially the same purpose as dynamic memory page 
protection checks.  The point is that it happens dynamically, i.e. at 
runtime, and that there's a lack of static guarantees about memory 
safety in C or C++.  That's why, as I said, the comparison to latent vs. 
static typing is an apt one.

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


Re: list problem 4 newbie

2006-06-26 Thread vaibhav
Hi,
if u check the id's of a and b lists and also its elements, you will
obeserve that the id's of a and b have changed  but id's of their
elements have not changed.
 If you make a deep copy of the list a and then make your changes in
that list, it shud work.  this can be done using the copy module.

hope that helps,
vaibhav

 id(a)
-1208622388
 id(b)
-1208622324

 for el in a:
... print id(el)
...
-1208622836
-1208622708
-1208622772
-1208622420

 for el in b:
... print id(el)
...
-1208622836
-1208622708
-1208622772
-1208622420

 import copy
 c = copy.deepcopy(a)
 id(c)
-1208464564

 for el in c:
... print id(el)
...
-1208465172
-1208464276
-1208464180
-1208463988

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


Re: Interactive debugging

2006-06-26 Thread Fredrik Lundh
[EMAIL PROTECTED] wrote:

 Hi, is there a way in python to place some sort of keyboard() type
 statement which stops the script and puts you back at the console? 

see the third example on this page:

 http://effbot.org/librarybook/code.htm

/F

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


Re: What is Expressiveness in a Computer Language

2006-06-26 Thread Anton van Straaten
Joachim Durchholz wrote:
 Anton van Straaten schrieb:
 
 Marshall wrote:

 Can you be more explicit about what latent types means?


 Sorry, that was a huge omission.  (What I get for posting at 3:30am.)

 The short answer is that I'm most directly referring to the types in 
 the programmer's head.
 
 
 Ah, finally that terminology starts to make sense to me. I have been 
 wondering whether there's any useful difference between latent and 
 run-time typing. (I tend to avoid the term dynamic typing because 
 it's overloaded with too many vague ideas.)

Right, that's the reason for using a different term.  Runtime and 
dynamic types are both usually associated with the idea of tagged 
values, and don't address the types of program phrases.

 there are usually many possible static type schemes that can be 
 assigned to a given program.
 
 
 This seems to apply to latent types as well.

That's what I meant, yes.

 Actually the set of latent types seems to be the set of possible static 
 type schemes.
 Um, well, a superset of these - static type schemes tend to be slightly 
 less expressive than what the programmer in his head. (Most type schemes 
 cannot really express things like the range of this index variable is 
 such-and-so, and the boundary to general assertions about the code is 
 quite blurry anyway.)

Yes, although this raises the type theory objection of how you know 
something is a type if you haven't formalized it.  For the purposes of 
comparison to static types, I'm inclined to be conservative and stick to 
things that have close correlates in traditional static types.

 There's a close connection between latent types in the sense I've 
 described, and the tagged values present at runtime.  However, as 
 type theorists will tell you, the tags used to tag values at runtime, 
 as e.g. a number or a string or a FooBar object, are not the same 
 thing as the sort of types which statically-typed languages have.
 
 
 Would that be a profound difference, or is it just that annotating a 
 value with a full type expression would cause just too much runtime 
 overhead?

It's a profound difference.  The issue is that it's not just the values 
that need to be annotated with types, it's also other program terms.  In 
addition, during a single run of a program, all it can ever normally do 
is record the types seen on the path followed during that run, which 
doesn't get you to static types of terms.  To figure out the static 
types, you really need to do static analysis.

Of course, static types give an approximation of the actual types of 
values that flow at runtime, and if you come at it from the other 
direction, recording the types of values flowing through terms on 
multiple runs, you can get an approximation to the static type.  Some 
systems use that kind of thing for method lookup optimization.

 In your terminology:
 
 So, where do tagged values fit into this?  Tags help to check types at 
 runtime, but that doesn't mean that there's a 1:1 correspondence 
 between tags and types.
 
 
 Would it be possible to establish such a correspondence, would it be 
 common consensus that such a system should be called tags anymore, or 
 are there other, even more profound differences?

There's a non 1:1 correspondence which I gave an example of in the 
quoted message.  For 1:1 correspondence, you'd need to associate types 
with terms, which would need some static analysis.  It might result in 
an interesting program browsing and debugging tool...

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


Re: Python database access

2006-06-26 Thread Dave Cook
On 2006-06-26, Serge Orlov [EMAIL PROTECTED] wrote:
 On 25 Jun 2006 21:19:18 -0700, arvind [EMAIL PROTECTED] wrote:

 I am going to  work on Python 2.4.3 and MSSQL database server on
 Windows platform.

 The module you're looking for is the first result if you search
 python mysql on google or if you search mysql on python package
 index http://www.python.org/pypi

I think he meant Microsoft SQL Server.  In which case, google searches on
python mssql and python odbc should be helpful.

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


Re: Python taught in schools?

2006-06-26 Thread Lawrence D'Oliveiro
In article [EMAIL PROTECTED],
 [EMAIL PROTECTED] (Alex Martelli) wrote:

... let's try some google searches and see the number of million hits...:

But how reliable are those estimates of numbers of hits, anyway? More 
than once I've got a page showing something like Results 1 - 10 of 
about 36 hits, only to find that there were no more pages after the 
second one. If it could get estimates so wrong with such small numbers, 
how can you trust the large ones?
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python taught in schools?

2006-06-26 Thread Lawrence D'Oliveiro
In article [EMAIL PROTECTED],
 Mirco Wahab [EMAIL PROTECTED] wrote:

C++ programming requires you to massively invest your thinking
first into the setup of your build environment ...

I don't understand why. It's easy enough to build small programs with a 
single g++ command.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Duplex communication with pipes - is possible ?

2006-06-26 Thread Dara Durum

Hi !

See this shortened, simplified example. It is not working, but I don't
understand why...

# Client Process

import os, sys
from subprocess import Popen, PIPE
from time import sleep, time
from cPickle import loads, dumps
from binascii import hexlify, unhexlify
from base64 import encodestring, decodestring
from time import time

def WriteData(WStm,Data):
   data=dumps(Data,1)
   bdata=hexlify(data)
   msg='%s#'%bdata
   WStm.write(msg)

def ReadData(RStm):
   tmpl=[]
   while 1:
   c=RStm.read(1)
   if c=='#':
   break
   tmpl.append(c)
   bdata=''.join(tmpl)
   data=unhexlify(bdata)
   orgdata=loads(data)
   return orgdata

def SubProcessFunctions():
   f=open('spp_clt.log','w')
   print f,m1
   while 1:
   print f,m2
   data=ReadData(sys.stdin)
   print f,m3,[data]
   if data=='quit':
   print f,m4
   WriteData(sys.stdout,'')
   break
   print f,m5
   WriteData(sys.stdout,'%s'%[data])
   print f,m6

if __name__=='__main__':
   SubProcessFunctions()

# The Master process
from spp_clt import ReadData, WriteData
from subprocess import Popen, PIPE
import time

def MasterProcess():
   print m1
   p=Popen([r'c:\python24\python.exe','spp_clt.py'], \
stdin=PIPE,stdout=PIPE)
   print m2
   (child_stdout, child_stdin) = (p.stdout, p.stdin)
   print m3
   for s in range(2):
   print m4
   WriteData(child_stdin,s)
   print m5
   ReadData(child_stdout)
   print m6
   print m7
   WriteData(child_stdin,'quit')
   print m8
   ReadData(child_stdout)
   print m9

MasterProcess()

It is freezed, because I got deadlock. Every process got Read state,
and never get back.
What I do wrong ?
I was trying with this packet managing mode:
def WriteData(WStm,Data):
   data=dumps(Data,1)
   bdata=encodestring(data)
   dlen=len(bdata)
   msg='%12d%s'%(dlen,bdata)
   if WStm==None:
   print msg
   else:
   WStm.write(msg)

def ReadData(RStm):
   dlen=int(RStm.read(12))
   bdata=RStm.read(dlen)
   data=decodestring(bdata)
   orgdata=loads(data)
   return orgdata

but it also freezed.
Why the master doesn't got the packets are sended by client ?

Thanks for your help:
dd




2006/6/21, Dara Durum [EMAIL PROTECTED]:

Hi !
Sorry, but I need multios application...

This version for text mode is working:

import subprocess
import os,sys

if 'C' in sys.argv:
#sys.stdout=open(r'c:\tpp2client.log','w')
print clt start
while 1:
head=sys.stdin.read(4)
print clt head,[head]
if head.lower()=='quit':
break
dsize=int(head)
if dsize:
data=sys.stdin.read(dsize)
print clt get data,len(data)
print clt end\n
else:
print MS
p=subprocess.Popen([r'c:\python24\python.exe','tpp2.py','C'], \
 stdin=subprocess.PIPE,stdout=subprocess.PIPE)
print MSS
(child_stdout, child_stdin) = (p.stdout, p.stdin)
data=range(1000)
import cPickle
bdata=cPickle.dumps(data,1)
print len(bdata)
import binascii
hdata=binascii.hexlify(bdata)
print len(hdata)
import base64
hdata=base64.encodestring(bdata)
print len(hdata)
child_stdin.write('%04d'%len(hdata))
child_stdin.write(hdata)
child_stdin.write('quit')
output=child_stdout.readlines()
print Client's answer:\n,''*80
for s in output:
print s.strip()
print ''*80
print MEE

I will see your idea: the bittorrent...

Thanx:
dd



2006/6/20, Daniel Dittmar [EMAIL PROTECTED]:
 Dara Durum wrote:
  Now I trying with packet size decreasing. Are PIPE-s can handle the
  binary data packets, or I need to convert them with base64 ?

 In the client, you need to set the mode of sys.stdin to binary,
 otherwise, you get the DOS translation of linefeeds. See
 http://mail.python.org/pipermail/python-list/2000-January/020463.html
 for some hints.

 I assume that the stream returned by subprocess.popen are also opened in
 text mode and you have to change them tobinary, see the second hint in
 the link mentioned above.

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


from spp_clt import ReadData, WriteData
from subprocess import Popen, PIPE
import time

def MasterProcess():
print m1
p=Popen([r'c:\python24\python.exe','spp_clt.py'], \
 stdin=PIPE,stdout=PIPE)
print m2
(child_stdout, child_stdin) = (p.stdout, p.stdin)
print m3
for s in range(2):
print m4
WriteData(child_stdin,s)
print m5
ReadData(child_stdout)
print m6
print m7
WriteData(child_stdin,'quit')
print m8
ReadData(child_stdout)
print m9

MasterProcess()import os, sys
from subprocess import Popen, PIPE
from shamd5mod import HashWithSHAMD5
from custom_procthr import CustomSubProcClass
from time import sleep, time
from cPickle import loads, dumps
from binascii import hexlify, unhexlify
from base64 import encodestring, decodestring
from threading import Thread
from Queue import Queue
from time import 

Re: What technologies should I use for my application manager?

2006-06-26 Thread Adam Jones
MrBlueSky wrote:
 Hello!  I've just finished working on my first Python app (a
 Tkinter-based program that displays the content of our application log
 files in graphical format).   It was a great experience that's had a
 very positive response from my colleagues.

 So I'd like to try something different for my second Python
 application.  It's a simple server that can launch and monitor the
 state of our program, to help our software developers.  In my mind I
 have a vision of:
 * a web server
 * allows the user to launch our product (choosing from a set of
 different launch scripts)
 * allow user to stop a launched product
 * report state by retrieving data from the RDBMS against which the
 product runs (Oracle or SQL Server)

 There seem to be a lot of web server related Python libraries around,
 and I've no experience in web servers at all.   So I'd really
 appreciate some advice on what Python technologies you think I should
 base my application on.


For speed of development I would suggest looking into a framework that
can do some of the heavy lifting for you. Out of those the really big
names in python are Turbogears ( http://www.turbogears.org/ ), Django
( http://www.djangoproject.org/ ), and Zope ( http://www.zope.org ).
(along with others that I have forgotten who shall most likely be
mentioned promptly) Of them all I have the most experience with
Turbogears, so that is what I will try and sell you on.

By default Turbogears provides support for *either* MS SQL or Oracle.
One of the differences between Turbogears and most web frameworks is
that many of the bigger chunks of code for it are taken from existing
projects instead of being written internally. Due to this Turbogears
provides support for two database mappers: Sqlobject, which supports MS
SQL; and Sqlalchemy, which supports Oracle. Of the two Sqlalchemy is
much more flexible, but is also a newer project and may be harder to
work with until the api finishes settling. Both projects offer full
support for one of the databases you mentioned, and developmental
support for the other. If you need to work with both it is possible to
bring in the database integration method of your choice.

Turbogears has a very flexible widget system that supports a lot of
interesting code. Basic things like user input forms can be handled
with widgets, but there are also prebuilt widgets for things like
find-as-you-type form fields, calendar-based date pickers, tabbed
displays, syntax-highlighted text, and a plotting kit (and those are
just the fancy things that looked like they would be useful).

There is a pretty nice validation system that can handle converting
user input into appropriately typed python objects, and can
automatically force a correction page if you would like it to do so.

Like any other framework Turbogears has a templating system to help
handle the html/css/javascript that you will be using. By default it
uses Kid, which is XHTML with an additional namespace that provides
support for looping, element replacement, and limited function
definitions. Overall I have found it to be pretty nice to work with.
That said if you want something else you can install plugins for a few
different templating languages. (Currently supported are Cheetah, Stan,
ZPT, HtmlPy, Clearsilver, Myghty, and Python String Templates)

Obviously some of the more important parts you are looking for are
integration into the system environment, logging, and possibly user
authentication and scheduled tasks. By default Turbogears supports all
of the access to the surrounding system that Python does. This is kind
of a no-brainer, but for me at least was something of a stumbling block
in coming from PHP.

The logging system is based on the built-in logging package for Python.
It is configured through Turbogears to allow some of the components
involved to support it. You have access to pretty much all of the
facilities that the Python logger provides.

User authentication in Turbogears is generally handled through the
Identity system. This allows you to restrict access to directories,
pages, and even specific page elements (like links or forms) based on
the connecting host, user account, group membership, or permissions
granted. The identity system itself is pretty extensible and can
probably be made to support anything you can think of as an
authentication method.

Scheduled tasks can be handled from inside of turbogears with the built
in scheduler. This allows you to schedule tasks while working inside
turbogears, which saves the headache of handling database access
separately.

Installing and configuring Turbogears can actually be pretty simple.
The system is based around python eggs (
http://peak.telecommunity.com/DevCenter/PythonEggs/ ) which can handle
installation requirements and upgrades for you.

Overall I have found Turbogears to be a flexible, easy-to-use
framework. It generally seems to do well at staying out of the way, and
most of the extra features it adds have 

Re: list problem 4 newbie

2006-06-26 Thread Duncan Booth
manstey wrote:

 for index in reversed(range(0,len(a)-1)):
if '75' in b[index][1]:
   b[index][1].remove('75')
   b[index][1].append('99')
 

What on earth is all that messing around in the for loop intended to do? If 
you want a range from len(a)-2 to 0 inclusive then just do it in range 
directly (and did you really mean not to look at the last element?), if you 
actually just wanted to iterate through b in reverse, then just iterate 
through b in reverse:

b = copy.deepcopy(a)
for element in reversed(b):
   if '75' in element[1]:
  element[1].remove('75')
  element[1].append('99')
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: What is Expressiveness in a Computer Language

2006-06-26 Thread Ketil Malde
Rob Thorpe [EMAIL PROTECTED] writes:

 I think statements like this are confusing, because there are
 different interpretations of what a value is.

 But I mean the value as the semantics of the program itself sees it.
 Which mostly means the datum in memory.

I don't agree with that.  Generally, a language specifies a virtual
machine and doesn't need to concern itself with things like memory
at all.  Although langauges like C tries to, look at all the undefined
behavior you get when you make assumptions about memory layout etc.

Memory representation is just an artifact of a particular
implementation of the language for a particular architecture.

-k
-- 
If I haven't seen further, it is by standing in the footprints of giants
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Pygame.draw challenge is over!

2006-06-26 Thread Duncan Booth
Richard Jones wrote:

 spiffy wrote:
 Congrats to Seth Yastrov for 'gravity.py' ... THE ONLY ONE THAT
 WORKED!
 
 I did test that they all worked on my machine before putting them
 online... 
 
 What issues are you having? What OS?

The only issue I found is that goop dies with IndexError: list index out 
of range if you move to to the top right corner.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: What is Expressiveness in a Computer Language

2006-06-26 Thread Chris Smith
Anton van Straaten [EMAIL PROTECTED] wrote:
 I'm not trying to call programmer reasoning in general a type system. 
 I'd certainly agree that a programmer muddling his way through the 
 development of a program, perhaps using a debugger to find all his 
 problems empirically, may not be reasoning about anything that's 
 sufficiently close to types to call them that.

Let me be clear, then.  I am far less agreeable than you that this 
couldn't be called a type system.  One of my goals here is to try to 
understand, if we are going to work out what can and can't be called a 
type system in human thought, how we can possible draw a boundary 
between kinds of logic and say that one of them is a type system while 
the other is not.  I haven't seen much of a convincing way to do it.  
The only things that I can see rejecting out of hand are the empirical 
things; confidence gained through testing or observation of the program 
in a debugger.  Everything else seems to qualify, and that's the 
problem.

So let's go ahead and agree about everything up until...

[...]

 As an initial next step, we could simply rely on the good old universal 
 type everywhere else in the program - it ought to be possible to make 
 the program well-typed in that case, it would just mean that the 
 provable properties would be nowhere near as pervasive as with a 
 traditional statically-typed program.

It would, in fact, mean that interesting provable properties would only 
be provable if data can't flow outside of those individual small bits 
where the programmer reasoned with types.  Of course that's not true, or 
the programmer wouldn't have written the rest of the program in the 
first place.  If we define the universal type as a variant type 
(basically, tagged or something like it, so that the type can be tested 
at runtime) then certain statements become provable, of the form either 
X or some error condition is raised because a value is inappropriate.  
That is indeed a very useful property; but wouldn't it be easier to 
simply prove it by appealing to the language semantics that say that if 
not X, the operation raises an exception, or to the existence of 
assertions within the function that verify X, or some other such thing 
(which must exist, or the statement wouldn't be true)?

 But the point is we would now 
 have put our types into a formal context.

Yes, but somewhat vacuously so...

 The point about inherent informality is just that if you fully formalize 
 a static type system for a dynamic language, such that entire programs 
 can be statically typed, you're likely to end up with a static type 
 system with the same disadvantages that the dynamic language was trying 
 to avoid.

Okay, so you've forced the admission that you have a static type system 
that isn't checked and doesn't prove anything interesting.  If you 
extended the static type system to cover the whole program, then you'd 
have a statically typed language that lacks an implementation of the 
type checker.

I don't see what we lose in generality by saying that the language lacks 
a static type system, since it isn't checked, and doesn't prove anything 
anyway.  The remaining statement is that the programmer may use static 
types to reason about the code.  But, once again, the problem here is 
that I don't see any meaning to that.  It would basically mean the same 
thing as that the programmer may use logic to reason about code.  That 
isn't particularly surprising to me.  I suppose this is why I'm 
searching for what is meant by saying that programmers reason about 
types, and am having that conversation in several places throughout this 
thread... because otherwise, it doesn't make sense to point out that 
programmers reason with types.

 Well, I'm trying to use the term latent type, as a way to avoid the 
 ambiguity of type alone, to distinguish it from static type, and to 
 get away from the obvious problems with dynamic type.

I replied to your saying something to Marshall about the type systems 
(in the static sense) of dynamically-typed languages.  That's what my 
comments are addressing.  If you somehow meant something other than the 
static sense, then I suppose this was all a big misunderstanding.

 But I'm much less interested in the term itself than in the issues 
 surrounding dealing with real types in dynamically-checked programs - 
 if someone had a better term, I'd be all in favor of it.

I will only repeat again that in static type systems, the type becomes 
a degenerate concept when it is removed from the type system.  It is 
only the type system that makes something a type.  Therefore, if you 
want real types, then my first intuition is that you should avoid 
looking in the static types of programming languages.  At best, they 
happen to coincide frequently with real types, but that's only a 
pragmatic issue if it means anything at all.

 So when well-typed program fragments are considered as part of a larger 
 untyped program, you're 

Re: Kamaelia 0.4.0 RELEASED - Faster! More Tools! More Examples! More Docs! ; -)

2006-06-26 Thread Matt Hammond
 This allows  somethings to run eg

 AxonVisualiser.py --navelgaze

 but I'm not sure if the results are really unaffected by not having a
 real yielder. The diagram appears, but doesn't seem to settle down.

 I don't think the AxonVisualiser would be particularly affected by
 this - any wobbling you'll see there is probably more down to the
 simple physics model the visualiser uses not having sufficient
 dampening for the layout you see. (The physics model was apparently
 originally written by Matt for a lava lamp simulator, but has turned
 out to be incredibly useful as a simple layout tool :-)

 A little bit of manual assistance to spread things out can sometimes
 help it settle down though :)

Michael's right: the wobble is due to the low level of dampening in the  
physics model and its discrete time step nature. Brief, non-methodical(!)  
experiments with increased dampening do lead to a more stable  
visualisation, but particles start to become 'sticky' and not always move  
when it would be helpful for them to do so!

The physics code is not the fastest on the planet, so the number of  
simulation cycles per second is quite low - therefore to enable the  
particles to move quickly enough, the forces act quite strongly and the  
dampening is quite low. You therefore occasionally see a slight wobbling  
effect where a 'component' particle is being pulled and pushed quite  
strongly by its inbox and outbox particles in many different directions at  
once.



Matt
-- 
| Matt Hammond
| Research Engineer, Tech. Group, BBC, Kingswood Warren, Tadworth, Surrey,  
UK
| http://kamaelia.sf.net/
| http://www.bbc.co.uk/rd/
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python taught in schools?

2006-06-26 Thread Duncan Booth
Lawrence D'Oliveiro wrote:

 In article [EMAIL PROTECTED],
  [EMAIL PROTECTED] (Alex Martelli) wrote:
 
... let's try some google searches and see the number of million
hits...: 
 
 But how reliable are those estimates of numbers of hits, anyway? More 
 than once I've got a page showing something like Results 1 - 10 of 
 about 36 hits, only to find that there were no more pages after the 
 second one. If it could get estimates so wrong with such small
 numbers, how can you trust the large ones?

If you read what it says at the bottom of the last page of results (this 
example from a claimed 90 hits, but only 27 visible):

 In order to show you the most relevant results, we have omitted some
 entries very similar to the 27 already displayed. If you like, you can
 repeat the search with the omitted results included. 

Google's hit count includes all the pages which by default it filters out. 
In particular it only returns you two pages from each site in the initial 
results (grouped together and with the second one indented). If you repeat 
the search with filtering turned off then you should find that a small 
count of hits is pretty accurate).
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Interactive debugging

2006-06-26 Thread Diez B. Roggisch
[EMAIL PROTECTED] wrote:

 Hi, is there a way in python to place some sort of keyboard() type
 statement which stops the script and puts you back at the console?  I'm
 looking for something like in matlab, where you place a keyboard()
 command (I think), then you're in debug mode in the console, and you
 type continue to re-enter the script where you left off.  While you're
 in the debugger/console you're at the scope where the keyboard() call
 was and you can manipulate variables, etc.  Is there something like
 this in python?  I've been using winpdb, which is great, but sometimes
 I need more interactivity.  Is this what pdb is about?

Use

import pdb
pdb.set_trace()

The line where the set_trace() is invoked puts you back in the interpreter.

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


Re: Mix-In Class Methods At Run-Time

2006-06-26 Thread Bruno Desthuilliers
[EMAIL PROTECTED] wrote:
(snip)

 Two additional questions though: 1) is there a way for a function to
 get a reference to its caller automatically (as in, without the caller
 having to pass it in)?

It's possible with sys._getframe() and a decorator - but consider it a
hack.

 and 2) what's the reason to use newstyle classes
 versus the old?

All this is explained on python.org (there's a menu entry for this in
the documentation menu). AFAICT, newstyle classes can do whatever
oldstyle classes did, *and much more* (descriptors and usable
metaclasses) - and they are somewhat faster too. So - compatibility with
older Python versions ( 2.2 IIRC) set aside -, there's just no reason
to use oldstyle classes.

  In order to create the dynamic class NewClass in the
 code above I called type() but that requires at least one new style
 class as a base. Thus, I had to have at least one of my animals inherit
 from object and this seemed a nuisance since

OMG, eight more keystrokes - talk about a nuisance...

 I don't at this point
 know what the benefit of newstyle classes is.

See it the other way round :  the *only* benefit of oldstyle classes is
compatibility with pre-2.2 Python versions.

-- 
bruno desthuilliers
python -c print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for
p in '[EMAIL PROTECTED]'.split('@')])
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: error with string (beginner)

2006-06-26 Thread Bruno Desthuilliers
Jason wrote:
 I believe what you are trying to do is something like the following.
 
 [code]
 def isIntLike(x):
   try:int(x)
   except: return False

*Never* ever use a bare except clause. *Always* specify wich exceptions
you are expecting. (NB : here, TypeError and ValueError).

(NB :  of course, like for all and any do's-and-don't rules, there are
actually a very few cases where using a bare except may be ok.)

   else:   return True
 
 something = raw_input(Enter something and I will tell you the type: )
 
 if isIntLike(something):  print I am an int

Nope. At this stage, 'something' is *not* an int - it's a string that
can be turned into an int.

 elif isinstance(something, type('')): print I am a string

You don't need the type('') stuff - use isinstance(something,
basestring) instead.

 else: print I am an impostor!
 [/code]

(snip)

-- 
bruno desthuilliers
python -c print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for
p in '[EMAIL PROTECTED]'.split('@')])
-- 
http://mail.python.org/mailman/listinfo/python-list


style question

2006-06-26 Thread Hari Sekhon
Is it better to do:

message = This is line1.
This is line2
This is line3\n

or

message = This is line1.\n
message = message + This is line2\n
message = message + This is line3\n


Since the first method does not follow python's clean and easy looking 
indentation structure but the second just looks crude and ugly anyway.

If I indent the first version so the text is lined up to match code 
indentation then this comes out in the input and isn't aligned there.

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


Re: Python question

2006-06-26 Thread Bruno Desthuilliers
Harry wrote:
 Hi All,
(snip)
 I have the following object which is like a list of tuples

 row= [('name', 'x1'), ('min', 15.449041129349528), ('max',
 991.6337818245629), ('range', 976.18474069521335), ('mean',
 496.82174193958127), ('stddev', 304.78275004920454), ('variance',
 92892.524727555894), ('mode', '46.5818482111'), ('unique_count', '99'),
 ('count', 99.0), ('count_missing', 0.0), ('sum_weight', 99.0)]

FWIW, it *is* a list of tuples.

 What command

ot What's a 'command' ? /ot

 do I use to get the value corresponding to 'min'?
(see below...)

 This object seems to be non-indexable

It is - just like any other list. Try :
 print row[0]
 print row[1]
 # etc...

Now if you want keyword access, try this:
 print dict(row)['min']



-- 
bruno desthuilliers
python -c print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for
p in '[EMAIL PROTECTED]'.split('@')])
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: style question

2006-06-26 Thread MTD

Hari Sekhon wrote:
 Is it better to do:

 message = This is line1.
 This is line2
 This is line3\n

 or

 message = This is line1.\n
 message = message + This is line2\n
 message = message + This is line3\n

Is there any reason you can't do it in one line?

message = This is line1.\nThis is line2.\nThis is line3.\n

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


Re: style question

2006-06-26 Thread Hari Sekhon




MTD wrote:

  Hari Sekhon wrote:
  
  
Is it better to do:

message = """This is line1.
This is line2
This is line3\n"""

or

message = "This is line1.\n
message = message + "This is line2\n"
message = message + "This is line3\n"

  
  
Is there any reason you can't do it in one line?

message = "This is line1.\nThis is line2.\nThis is line3.\n"

  

this would also be ugly though, a huge lone line for the paragraph I
want to output, which would wrap around and break the visual
indentation.

otherwise I could do it in one line. but if I was going to do that and
it was going to be so long, I'd just use """..."""


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

Re: Mix-In Class Methods At Run-Time

2006-06-26 Thread bearophileHUGS
I can't give much answers, I am not that expert yet.

Bruno Desthuilliers:
 newstyle classes can do whatever oldstyle classes
 did, *and much more* (descriptors and usable
 metaclasses) - and they are somewhat faster too.

In the past I have done few tests, and it seemed that new style classes
are a bit slower (but the difference doesn't make much difference).
Maybe for Py2.5 the situation will be different.

Bye,
bearophile

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


Re: style question

2006-06-26 Thread Frank Millman

Hari Sekhon wrote:
 Is it better to do:

 message = This is line1.
 This is line2
 This is line3\n

 or

 message = This is line1.\n
 message = message + This is line2\n
 message = message + This is line3\n


 Since the first method does not follow python's clean and easy looking
 indentation structure but the second just looks crude and ugly anyway.

 If I indent the first version so the text is lined up to match code
 indentation then this comes out in the input and isn't aligned there.

How about

  message = (This is line1. 
 This is line2 
 This is line3\n)

The brackets mean that the lines are automatically treated as
continuous, without the need for the ugly '\' continuation character.

The opening/closing quotes on each line mean that the strings are
contatenated into one long string.

Frank Millman

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


Re: style question

2006-06-26 Thread Frank Millman

Frank Millman wrote:

 How about

   message = (This is line1. 
  This is line2 
  This is line3\n)

 The brackets mean that the lines are automatically treated as
 continuous, without the need for the ugly '\' continuation character.

 The opening/closing quotes on each line mean that the strings are
 contatenated into one long string.

 Frank Millman

Don't know what happened there - Google seems to have messed up my
indentation.

My intention was that each of the three leading quote marks line up
vertically, but when I read it back via Google Groups, the second two
lines were pushed over to the right.

Frank

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


Re: style question

2006-06-26 Thread Laurent Rahuel
Hari Sekhon wrote:

 Is it better to do:
 
 message = This is line1.
 This is line2
 This is line3\n
 
 or
 
 message = This is line1.\n
 message = message + This is line2\n
 message = message + This is line3\n
 
 
 Since the first method does not follow python's clean and easy looking
 indentation structure but the second just looks crude and ugly anyway.
 
 If I indent the first version so the text is lined up to match code
 indentation then this comes out in the input and isn't aligned there.

Hi,

msgs = ['This is line1.','This is line2.','This is line3.']
message = '\n'.join(msgs)

Regards,

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


Re: style question

2006-06-26 Thread Fredrik Lundh
Frank Millman wrote:

 How about

   message = (This is line1. 
  This is line2 
  This is line3\n)

 The brackets mean that the lines are automatically treated as
 continuous, without the need for the ugly '\' continuation character.

 The opening/closing quotes on each line mean that the strings are
 contatenated into one long string.

 Don't know what happened there - Google seems to have messed up my
 indentation.

 My intention was that each of the three leading quote marks line up
 vertically, but when I read it back via Google Groups, the second two
 lines were pushed over to the right.

assuming fixed-pitch fonts isn't very Pythonic, though; to get reliable 
indentation
no matter what font you're using, you can write:

message = (
This is line1. 
This is line2 
This is line3\n)

whether this is better than  depends on the situation.

/F 



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


Re: What is Expressiveness in a Computer Language

2006-06-26 Thread Ketil Malde
Chris Smith [EMAIL PROTECTED] writes:

 I've since abandoned any attempt to be picky about use of the word 
 type.  That was a mistake on my part.  I still think it's legitimate 
 to object to statements of the form statically typed languages X, but 
 dynamically typed languages Y, in which it is implied that Y is 
 distinct from X.  When I used the word type above, I was adopting the 
 working definition of a type from the dynamic sense.  

Umm...what *is* the definition of a dynamic type?  In this thread
it's been argued from tags and memory representation to (almost?)
arbitrary predicates.  

 That is, I'm considering whether statically typed languages may be
 considered to also have dynamic types, and it's pretty clear to me
 that they do. 

Well, if you equate tags with dynamic types:

data Universal = Str String | Int Integer | Real Double 
 | List [Universal] ...

A pattern match failure can then be seen as a dynamic type error.

Another question is how to treat a system (and I think C++'s RTTI
qualifies, and probably related languages like Java) where static type
information is available at runtime.  Does this fit with the term
dynamic typing with typing in the same sense as static typing?

-k
-- 
If I haven't seen further, it is by standing in the footprints of giants
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: style question

2006-06-26 Thread Frank Millman

Fredrik Lundh wrote:
 Frank Millman wrote:

  How about
 
message = (This is line1. 
   This is line2 
   This is line3\n)
 
  The brackets mean that the lines are automatically treated as
  continuous, without the need for the ugly '\' continuation character.
 
  The opening/closing quotes on each line mean that the strings are
  contatenated into one long string.
 
  Don't know what happened there - Google seems to have messed up my
  indentation.
 
  My intention was that each of the three leading quote marks line up
  vertically, but when I read it back via Google Groups, the second two
  lines were pushed over to the right.

 assuming fixed-pitch fonts isn't very Pythonic, though; to get reliable 
 indentation
 no matter what font you're using, you can write:

 message = (
 This is line1. 
 This is line2 
 This is line3\n)

 whether this is better than  depends on the situation.
 
 /F

Obvious, now that you mention it.

Thank you.

Frank

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


Re: Python taught in schools?

2006-06-26 Thread Mirco Wahab
Thus spoke Lawrence D'Oliveiro (on 2006-06-26 09:21):

 In article [EMAIL PROTECTED],
  Mirco Wahab [EMAIL PROTECTED] wrote:
 
C++ programming requires you to massively invest your thinking
first into the setup of your build environment ...
 
 I don't understand why. It's easy enough to build small programs with a 
 single g++ command.


Think about beeing a young guy with a
windows pc at home.

To make sense of your 45 min C++
class, you need to practice the
stuff at home for sure, I'd guess.

Now go ahead! What would you do?

Download The C++ from the Internet,
click on setup and start?  Right ;-)

Regards

Mirco

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


Re: style question

2006-06-26 Thread Duncan Booth
Hari Sekhon wrote:

 Since the first method does not follow python's clean and easy looking 
 indentation structure but the second just looks crude and ugly anyway.

If you want indented and pretty is important to you:

 from textwrap import dedent as D
 message = D(\
   This is line1.
   This is line2
   This is line3
   )
 message
'This is line1.\nThis is line2\nThis is line3\n'

Usually though I would just make sure that long strings are declared at 
module level and not indent them. The backslash after the opening quotes 
stops the first line being indented differently:

message = \
This is line1.
This is line2
This is line3

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


Re: What is Expressiveness in a Computer Language

2006-06-26 Thread Ketil Malde
Chris Smith [EMAIL PROTECTED] writes:

 Joachim Durchholz [EMAIL PROTECTED] wrote:
 Assume a language that
 a) defines that a program is type-correct iff HM inference establishes 
 that there are no type errors
 b) compiles a type-incorrect program anyway, with an establishes 
 rigorous semantics for such programs (e.g. by throwing exceptions as 
 appropriate).

 So the compiler now attempts to prove theorems about the program, but 
 once it has done so it uses the results merely to optimize its runtime 
 behavior and then throws the results away. 

Hmm... here's my compiler front end (for Haskell or other languages
that ..er.. define 'undefined'):

  while(type error) {
replace an incorrectly typed function with 'undefined'
  }

Wouldn't the resulting program still be statically typed?

In practice I prefer to (and do) define troublesome functions as
'undefined' manually during development.

-k
-- 
If I haven't seen further, it is by standing in the footprints of giants
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: pypy-0.9.0: stackless, new extension compiler

2006-06-26 Thread cfbolz
Hi all!

Michael Hudson wrote:
 The PyPy development team has been busy working and we've now packaged
 our latest improvements, completed work and new experiments as
 version 0.9.0, our fourth public release.

Unfortunately the download links for the release tarballs did not work
until very recently. They are now working though. You can download the
0.9 release of PyPy under:

http://codespeak.net/download/pypy/pypy-0.9.0.tar.bz2
http://codespeak.net/download/pypy/pypy-0.9.0.tar.gz
http://codespeak.net/download/pypy/pypy-0.9.0.zip

For detailed notes about how to get started into the world of PyPy see
here:

http://codespeak.net/pypy/dist/pypy/doc/getting-started.html

Sorry for the fuss and cheers,

Carl Friedrich Bolz

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


Re: What is Expressiveness in a Computer Language

2006-06-26 Thread Ketil Malde
Anton van Straaten [EMAIL PROTECTED] writes:

 But a program as seen by the programmer has types: the programmer
 performs (static) type inference when reasoning about the program, and
 debugs those inferences when debugging the program, finally ending up
 with a program which has a perfectly good type scheme.

I'd be tempted to go further, and say that the programmer performs 
(informally, incompletely, and probably incorrectly ) a proof of
correctness, and that type correctness is just a part of general
correctness. 

-k
-- 
If I haven't seen further, it is by standing in the footprints of giants
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: What is Expressiveness in a Computer Language

2006-06-26 Thread Andreas Rossberg
Gabriel Dos Reis wrote:
 [EMAIL PROTECTED] writes:
 
 | think that it is too relevant for the discussion at hand. Moreover,
 | Harper talks about a relative concept of C-safety.
 
 Then, I believe you missed the entire point.

I think the part of my reply you snipped addressed it well enough.

Anyway, I can't believe that we actually need to argue about the fact 
that - for any *useful* and *practical* notion of safety - C is *not* a 
safe language. I refrain from continuing the discussion along this line, 
because *that* is *really* silly.

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


About python 2.5 and its try statement.

2006-06-26 Thread defcon8
I can't remember the proposal number, but many of you reading will have
probably read the features that will be added to python 2.5. The actual
part I wanted to talk about was the finally part of try. Isn't it
totally defeating a compiler's job by executing the finally part even
if there is an error in the previous statements? Or have I understood
something wrong?

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


Re: Python database access

2006-06-26 Thread defcon8

arvind wrote:
 Hi all,
 I am going to  work on Python 2.4.3 and MSSQL database server on
 Windows platform.
 But I don't know how to make the connectivity or rather which module to
 import.
 I searched for the modules in the Python library, but I couldn't find
 which module to go for.
 Please help me out!

I think there are a few recipes for mssql in the activestate python
cookbook, or at least for odbc.

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


Re: About python 2.5 and its try statement.

2006-06-26 Thread Tim N. van der Leeuw
Hi,


defcon8 wrote:
 I can't remember the proposal number, but many of you reading will have
 probably read the features that will be added to python 2.5. The actual
 part I wanted to talk about was the finally part of try. Isn't it
 totally defeating a compiler's job by executing the finally part even
 if there is an error in the previous statements? Or have I understood
 something wrong?

try ... finally already exists in current python; what's new is that it
can be combined in 1 statement with try ... except ... finally.

No, this is not defeating a compilers job. It's very useful.

It defines an amount of cleanup that needs to happen no matter what,
exception or no exception. Example: closing an open file. You'll want
to close the file, whether after you done the job you intended to do,
or after an exception occurred while doing something.

So you put 'f.close()' in your finally - suite.

Another example of a useful 'finally' is logging function-exit -- not
the actual 'return' statement, but just a log-statement recording
function-exit.

(Putting a 'return' statement in a 'finally' suite is totally defeating
the point of exceptions that you want thrown to the caller, yes. So
don't put your 'return' statement there.)

Clearer?

Cheers,

--Tim

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


RE: SWIG problems with gcc and Cygwin?

2006-06-26 Thread Michael Yanowitz
  No response yet. The SWIG test works fine in Linux no problems.
However, I still have the problem in Cygwin.
  Also, not sure if related but I do have a win32 Python 2.4.3 and
Cygwin Python 2.4.1. Not sure if there are any conflicts. Any advice
in making these two co-exist?
  The only C/C++ compiler I have presently is Cygwin gcc.

Thanks in advance:
Michael Yanowitz

-Original Message-

From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf
Of Michael Yanowitz
Sent: Tuesday, June 20, 2006 3:39 PM
To: python-list@python.org
Subject: SWIG problems with gcc and Cygwin?


Hello:

   I am just trying out SWIG, but quickly ran into problems.
Using Cygwin gcc, I tried the following:

1) Created example.c (as given on http://www.swig.org/tutorial.html )
/* File : example.c */

 #include time.h
 double My_variable = 3.0;

 int fact(int n) {
 if (n = 1) return 1;
 else return n*fact(n-1);
 }

 int my_mod(int x, int y) {
 return (x%y);
 }

 char *get_time()
 {
 time_t ltime;
 time(ltime);
 return ctime(ltime);
 }

2) Create interface file, example.i

/* example.i */
 %module example
 %{
 /* Put header files here or function declarations like below */
 extern double My_variable;
 extern int fact(int n);
 extern int my_mod(int x, int y);
 extern char *get_time();
 %}

 extern double My_variable;
 extern int fact(int n);
 extern int my_mod(int x, int y);
 extern char *get_time();

3)ran in cygwin:  swig -i python example.i

4)Attempted to run on cygwin:  ld -shared example.o example_wrap.o -o
_example.so
But got back many errors:
example.o:example.c:(.text+0x55): undefined reference to `time'
example.o:example.c:(.text+0x60): undefined reference to `ctime'
example_wrap.o:example_wrap.c:(.text+0x9c): undefined reference to `strlen'
example_wrap.o:example_wrap.c:(.text+0x12c): undefined reference to `strlen'
example_wrap.o:example_wrap.c:(.text+0x1dd): undefined reference to `strcmp'
example_wrap.o:example_wrap.c:(.text+0x494): undefined reference to `strcmp'
example_wrap.o:example_wrap.c:(.text+0x748): undefined reference to `strlen'
example_wrap.o:example_wrap.c:(.text+0x779): undefined reference to `strcpy'
example_wrap.o:example_wrap.c:(.text+0x7a5): undefined reference to `strcmp'
example_wrap.o:example_wrap.c:(.text+0x805): undefined reference to `strlen'
example_wrap.o:example_wrap.c:(.text+0x877): undefined reference to
`strncpy'
example_wrap.o:example_wrap.c:(.text+0x8ab): undefined reference to `strcmp'
example_wrap.o:example_wrap.c:(.text+0x8c9): undefined reference to `memset'
example_wrap.o:example_wrap.c:(.text+0x948): undefined reference to `fputs'
example_wrap.o:example_wrap.c:(.text+0x95d): undefined reference to `fputs'
example_wrap.o:example_wrap.c:(.text+0x970): undefined reference to `fputs'
example_wrap.o:example_wrap.c:(.text+0x9db): undefined reference to
`PyString_Fr
omFormat'
example_wrap.o:example_wrap.c:(.text+0xa3a): undefined reference to
`PyString_Fr
omString'
example_wrap.o:example_wrap.c:(.text+0xa68): undefined reference to
`PyLong_From
VoidPtr'
example_wrap.o:example_wrap.c:(.text+0xa83): undefined reference to
`PyTuple_New
  etc...

  Any idea what I am doing wrong or omitted?

Of course when I then try to go into python and
import example, I get:

 import example
Traceback (most recent call last):
  File stdin, line 1, in ?
  File example.py, line 5, in ?
import _example
ImportError: No module named _example

Thanks in advance:
Michael Yanowitz

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

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


Help with conversion VB script to Python : COM objects

2006-06-26 Thread mitsura
Hi,

I need to re-write a VB script into Python (because I really don't like
VB).

The VB script is used to create a Windows COM object.
(I am more of Unix guy, so COM objects are a little bit alien for me).

At a certain point in the VB script, I have the following line:
objPolTypes = objPmad.Cvar(objPmad.GetPolicyTypeList)

Does anybody what the equivalent in Python would be?
I tried:
objPolTypes = objPmad.Cvar(objPmad.GetPolicyTypeList() )

but then I get the following error:

Traceback (most recent call last):
  File C:\Python24\MyProgs\FodFin\test.py, line 11, in ?
objPolTypes = objPmad.cvar(objPmad.GetPolicyTypeList() )
  File COMObject PMAD.OvPmdPolicyManager, line 2, in cvar
pywintypes.com_error: (-2147352571, 'Type mismatch.', None, 1)


I also tried :
objPolTypes = objPmad.GetPolicyTypeList()

this works but I end of with a list of COM object and have no clue how
to query/use them or what methods are defined for those type of
objects.

Any help really appreciated.

With kind regards,

KRis

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


Re: About python 2.5 and its try statement.

2006-06-26 Thread Bruno Desthuilliers
defcon8 wrote:
 I can't remember the proposal number,

http://docs.python.org/dev/whatsnew/pep-341.html

 but many of you reading will have
 probably read the features that will be added to python 2.5. The actual
 part I wanted to talk about was the finally part of try.

It has been here from the start (well, IIRC, it's since at least 1.5.2)
- the only limitation was that you couldn't use both 'except' and
'finally' in the same statement, so you had to wrap'em when needed.

 Isn't it
 totally defeating a compiler's job by executing the finally part even
 if there is an error in the previous statements? 

I don't see how this relates to the compiler. But anyway, the whole
point of the 'finally' clause is (and has ever been) to *ensure* this
block gets executed *whatever* happened. FWIW, the canonical use case is
resource aquisition/release.

 Or have I understood
 something wrong?

Seems so - unless it's me misunderstading your question.

-- 
bruno desthuilliers
python -c print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for
p in '[EMAIL PROTECTED]'.split('@')])
-- 
http://mail.python.org/mailman/listinfo/python-list


automatic debugger?

2006-06-26 Thread micklee74
hi
is there something like an automatic debugger module available in
python? Say if i enable this auto debugger, it is able to run thru the
whole python program, print variable values at each point, or print
calls to functions..etc...just like the pdb module, but now it's
automatic.
thanks

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


Re: About python 2.5 and its try statement.

2006-06-26 Thread Fredrik Lundh
defcon8 wrote:

I can't remember the proposal number, but many of you reading will have
 probably read the features that will be added to python 2.5. The actual
 part I wanted to talk about was the finally part of try. Isn't it
 totally defeating a compiler's job by executing the finally part even
 if there is an error in the previous statements? Or have I understood
 something wrong?

sounds like you're confusing compilation and execution, and compilation errors
(syntax errors) with runtime errors (exceptions).

try-finally is a runtime thing, not a compile time thing.

/F 



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


Re: SWIG problems with gcc and Cygwin?

2006-06-26 Thread Istvan Albert
Michael Yanowitz wrote:

   Also, not sure if related but I do have a win32 Python 2.4.3 and
 Cygwin Python 2.4.1. Not sure if there are any conflicts. Any advice
 in making these two co-exist?

SWIG will work with the windows and cygwin python, just make sure you
don't mix the various platforms.

- Install two separate versions of swig one for windows (binary) and
compile one in cygwin,
- Pay attention to the path and make sure that you invoke the correct
swig and python 

Istvan.

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


Re: String negative indices?

2006-06-26 Thread Antoon Pardon
On 2006-06-23, Filip Wasilewski [EMAIL PROTECTED] wrote:
 [EMAIL PROTECTED] wrote:

 Logically, I should be able to enter x[-2:-0] to get the last and next to 
 last characters. However, since Python doesn't distinguish between positive 
 and negative zero, this doesn't work. Instead, I have to enter x[-2:].

 Hooray! Logically there is no such thing as positive or negative zero,
 or did I miss something in the primary?

 PS. x[len(x)-2 : len(x)-0]

This seems to defeat the purpose of allowing negative indexes. My
understanding was that negative indexes were introduced to avoid
things like seq[len(seq) - i]

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


Re: automatic debugger?

2006-06-26 Thread Paul Rubin
[EMAIL PROTECTED] writes:
 is there something like an automatic debugger module available in
 python? Say if i enable this auto debugger, it is able to run thru the
 whole python program, print variable values at each point, or print
 calls to functions..etc...just like the pdb module, but now it's
 automatic.

Dunno about Python but www.askigor.com automatically finds
the bugs in C programs.  It's amazing.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Mix-In Class Methods At Run-Time

2006-06-26 Thread digitalorganics

Bruno Desthuilliers wrote:
 [EMAIL PROTECTED] wrote:
 (snip)

  Two additional questions though: 1) is there a way for a function to
  get a reference to its caller automatically (as in, without the caller
  having to pass it in)?

 It's possible with sys._getframe() and a decorator - but consider it a
 hack.

Gotcha, thanks.


  and 2) what's the reason to use newstyle classes
  versus the old?

 All this is explained on python.org (there's a menu entry for this in
 the documentation menu). AFAICT, newstyle classes can do whatever
 oldstyle classes did, *and much more* (descriptors and usable
 metaclasses) - and they are somewhat faster too. So - compatibility with
 older Python versions ( 2.2 IIRC) set aside -, there's just no reason
 to use oldstyle classes.

   In order to create the dynamic class NewClass in the
  code above I called type() but that requires at least one new style
  class as a base. Thus, I had to have at least one of my animals inherit
  from object and this seemed a nuisance since

 OMG, eight more keystrokes - talk about a nuisance...

Like, Oh My God! *claps hand to mouth*  lol   You humor me. Yes, eight
more keystrokes. I follow the general rule of, if I'm going to put in
extra effort, I'd like to know why. So you see, it's not so much an
adversion to the eight keystrokes (multiplied by however many classes I
have mind you), but to not knowing why I should use them. If I don't
care for descriptors or metaclasses, I don't see why I should feel
compelled to use them. And when I decide I want/need these features, I
can put the eight keystroke in at that time. No biggy. :-) Thanks
Bruno.


  I don't at this point
  know what the benefit of newstyle classes is.

 See it the other way round :  the *only* benefit of oldstyle classes is
 compatibility with pre-2.2 Python versions.

 --
 bruno desthuilliers
 python -c print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for
 p in '[EMAIL PROTECTED]'.split('@')])

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


DictProxy? What is this?

2006-06-26 Thread digitalorganics
When I tried to update a class's __dict__, I got an error saying that
there is no 'update' attribute for dictproxy object. What is a
dictproxy object? I thought that __dict__ is always suppose to be a, no
kidding, dictionary? Hence there should indeed be an update method.
What's this proxy business?

Thanks all.

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


Re: DictProxy? What is this?

2006-06-26 Thread Fredrik Lundh
[EMAIL PROTECTED] wrote:

 When I tried to update a class's __dict__, I got an error saying that
 there is no 'update' attribute for dictproxy object. What is a
 dictproxy object?

a CPython implementation detail, used to protect an internal data structure used
by new-style objects from unexpected modifications.

/F 



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


Re: DictProxy? What is this?

2006-06-26 Thread digitalorganics

Fredrik Lundh wrote:
 [EMAIL PROTECTED] wrote:

  When I tried to update a class's __dict__, I got an error saying that
  there is no 'update' attribute for dictproxy object. What is a
  dictproxy object?

 a CPython implementation detail, used to protect an internal data structure 
 used
 by new-style objects from unexpected modifications.

 /F

Ah, so I'm not suppose to be able to change a class's __dict__? Thanks
Fredrik.

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


A game idea.

2006-06-26 Thread defcon8
I have had what I think is quite a nice game idea, but I don't really
have the experience or knowledge to go about it. Would anyone be
willing to start a game project? The game I am thinking about is a
virtual IRC stock exchange. There will be a bot in the channel which
gets the live stock quotes and also adds any effects of buying or
selling of the players. Everyone will have their own portfolio, which
they will be able to view on the web, and will be able to issue
commands from the irc channel. They'll be able to trade between
eachother, and also to the stock exchange. I know this sounds like
quite a big project, but I think this would be a highly fun game and
maybe it would become quite popular. I would be willing to help of
course with what I can, but obviously, an experienced developer would
be needed.

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


Re: Python database access

2006-06-26 Thread BartlebyScrivener
 But I don't know how to make the connectivity or rather which module to
 import.

Try mxODBC

http://www.egenix.com/files/python/mxODBC.html

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


Re: DictProxy? What is this?

2006-06-26 Thread Maric Michaud
Le lundi 26 juin 2006 16:06, [EMAIL PROTECTED] a écrit :
 Fredrik Lundh wrote:
  [EMAIL PROTECTED] wrote:
   When I tried to update a class's __dict__, I got an error saying that
   there is no 'update' attribute for dictproxy object. What is a
   dictproxy object?
 
  a CPython implementation detail, used to protect an internal data
  structure used by new-style objects from unexpected modifications.
 
  /F

 Ah, so I'm not suppose to be able to change a class's __dict__? Thanks
 Fredrik.

Of course, yes :

In [1]: class a(object) : pass
   ...:

In [2]: a.__dict__
Out[2]: dictproxy object at 0xa7e01d34

In [3]: a.__dict__.items()
Out[3]:
[('__dict__', attribute '__dict__' of 'a' objects),
 ('__module__', '__main__'),
 ('__weakref__', attribute '__weakref__' of 'a' objects),
 ('__doc__', None)]

In [4]: a.__dict__['foo'] = lambda s : True
---
exceptions.TypeError...

TypeError: object does not support item assignment

hmmm, not this way, but :

In [5]: a.foo = lambda s : True

In [6]: a.__dict__.items()
Out[6]:
[('__dict__', attribute '__dict__' of 'a' objects),
 ('__module__', '__main__'),
 ('foo', function lambda at 0xa79528ec),
 ('__weakref__', attribute '__weakref__' of 'a' objects),
 ('__doc__', None)]

In [7]: a().foo()
Out[7]: True

or :

In [9]: setattr(a, 'bar', lambda s : False)

In [10]: a().bar()
Out[10]: False


-- 
_

Maric Michaud
_

Aristote - www.aristote.info
3 place des tapis
69004 Lyon
Tel: +33 426 880 097
-- 
http://mail.python.org/mailman/listinfo/python-list


Questions on Threading

2006-06-26 Thread j.c.sackett
Hello--I'm using the threading module to accomplish some distributed processing on a project, and have a basic (I hope) question that I can't find an answer to elsewhere.I've noted that there's a lot of documentation saying that there is no external way to stop a thread, and yet when creating a thread through the threading module I can see that it has a method called _Thread__stop, which does indeed stop it. Is this in any way dangerous (
i.e. doesn't actually stop the thread, or causes other thread timing issues down the road?) Or is there some other reason that there is officially no stop method?The code would be basically:t = threading.Thread
(None, some_function)t.start()#Let t run for a whilet._Thread__stop()Is this dangerous to a system using several many threads (100 max)?Thanks,J.C.Sackett
-- 
http://mail.python.org/mailman/listinfo/python-list

Re: DictProxy? What is this?

2006-06-26 Thread digitalorganics
All right. Thanks for explaining that Maric.

Maric Michaud wrote:
 Le lundi 26 juin 2006 16:06, [EMAIL PROTECTED] a écrit :
  Fredrik Lundh wrote:
   [EMAIL PROTECTED] wrote:
When I tried to update a class's __dict__, I got an error saying that
there is no 'update' attribute for dictproxy object. What is a
dictproxy object?
  
   a CPython implementation detail, used to protect an internal data
   structure used by new-style objects from unexpected modifications.
  
   /F
 
  Ah, so I'm not suppose to be able to change a class's __dict__? Thanks
  Fredrik.

 Of course, yes :

 In [1]: class a(object) : pass
...:

 In [2]: a.__dict__
 Out[2]: dictproxy object at 0xa7e01d34

 In [3]: a.__dict__.items()
 Out[3]:
 [('__dict__', attribute '__dict__' of 'a' objects),
  ('__module__', '__main__'),
  ('__weakref__', attribute '__weakref__' of 'a' objects),
  ('__doc__', None)]

 In [4]: a.__dict__['foo'] = lambda s : True
 ---
 exceptions.TypeError...

 TypeError: object does not support item assignment

 hmmm, not this way, but :

 In [5]: a.foo = lambda s : True

 In [6]: a.__dict__.items()
 Out[6]:
 [('__dict__', attribute '__dict__' of 'a' objects),
  ('__module__', '__main__'),
  ('foo', function lambda at 0xa79528ec),
  ('__weakref__', attribute '__weakref__' of 'a' objects),
  ('__doc__', None)]

 In [7]: a().foo()
 Out[7]: True

 or :

 In [9]: setattr(a, 'bar', lambda s : False)

 In [10]: a().bar()
 Out[10]: False


 --
 _

 Maric Michaud
 _

 Aristote - www.aristote.info
 3 place des tapis
 69004 Lyon
 Tel: +33 426 880 097

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


Re: languages with full unicode support

2006-06-26 Thread Oliver Wong

Oliver Bandel [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]

 Xah Lee wrote:


 As far as i know, Java and JavaScript are languages with full, complete
 unicode support. That is, they allow names to be defined using unicode.

 Can you explain what you mena with the names here?

As in variable names, function names, class names, etc.

- Oliver 

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


Get List of Classes

2006-06-26 Thread digitalorganics
Is there a method or attribute I can use to get a list of classes
defined or in-use within my python program? I tried using pyclbr and
readmodule but for reason that is dogslow. Thanks in advance

DigiO

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


Search String for Word

2006-06-26 Thread digitalorganics
What's the best way to search a string for a particular word and get a
booleen value indicating whether it exists in the string or not?
Thanks...

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


Re: What is Expressiveness in a Computer Language [off-topic]

2006-06-26 Thread David Hopwood
Matthias Blume wrote:
 I agree with Bob Harper about safety being language-specific and all
 that.  But, with all due respect, I think his characterization of C is
 not accurate.
[...]
 AFAIC, C is C-unsafe by Bob's reasoning.

Agreed.

 Of course, C can be made safe quite easily:
 
 Define a state undefined that is considered safe and add a
 transition to undefined wherever necessary.

I wouldn't say that was quite easy at all.

C99 4 #2:
# If a shall or shall not requirement that appears outside of a constraint
# is violated, the behavior is undefined. Undefined behavior is otherwise
# indicated in this International Standard by the words undefined behavior
# *or by the omission of any explicit definition of behavior*. [...]

In other words, to fix C to be a safe language (compatible with Standard C89
or C99), you first have to resolve all the ambiguities in the standard where
the behaviour is *implicitly* undefined. There are a lot of them.

-- 
David Hopwood [EMAIL PROTECTED]
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Search String for Word

2006-06-26 Thread Tim Chase
 What's the best way to search a string for a particular word and get a
 booleen value indicating whether it exists in the string or not?

  substring = 'foo'
  targetstring = 'blah foo bar'
  substring in targetstring
True
  if substring in targetstring: print 'yup'
yup

http://docs.python.org/lib/typesseq.html

-tkc




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


Re: 2Qs

2006-06-26 Thread JW
  2nd question:
 [snip]
  if x10 and y10 and z10 and summ(tritup(x,y,z)): print OK

 Others have already suggested you use the built-in sum() function.

 I'll suggest you don't need it at all, because it is redundant.

 If the sum is zero, either all three values are zero or at least one of
 the values is negative. In either case the first test will fail.

 There are no circumstances where each of x, y and z are greater than 10
 but the sum is zero; nor are there any circumstances where the sum is
 zero but x, y and z are still all greater than 10.

Unless, of course, the function tritup returns negative values.  My
guess is that the  10 tests are protecting the tritup function, and
possibly should be moved there.  Without the details of the function, I
can't tell, but it may be incorrect to remove those tests.

Which brings us to the other bit of advice - unit tests protect you
from yourself and from those who optimize too quickly.

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


Re: Formatted string to object

2006-06-26 Thread janama
Thankyou everyone for help last time:

The following works ok when setting a
wx.lib.buttons.GenBitmapTextButton's disabled bitmap in using wxpython

instead of this:
self.b1.SetBitmapDisabled(self.yellow)

i can use this:
aaa = 1
result1 = eval(self.b%s.SetBitmapDisabled(self.yellow) % aaa)
result

YAY!


How would i to achieve this with getattr() ?

getattr(locals()['parent'], aaa)???

Why would this be better as recommended in previous post here

http://groups.google.com.au/group/comp.lang.python/browse_frm/thread/2529515bc85cd954/c2f080b21d668081?q=janamarnum=1#c2f080b21d668081

Any help appreciated

ta

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


Re: Search String for Word

2006-06-26 Thread digitalorganics
I thought I'd seen that somewhere! Thanks Tim. I was previously using
re.search(substring, targetstring).

Tim Chase wrote:
  What's the best way to search a string for a particular word and get a
  booleen value indicating whether it exists in the string or not?

   substring = 'foo'
   targetstring = 'blah foo bar'
   substring in targetstring
 True
   if substring in targetstring: print 'yup'
 yup
 
 http://docs.python.org/lib/typesseq.html
 
 -tkc

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


Re: Python taught in schools?

2006-06-26 Thread Alex Martelli
Lawrence D'Oliveiro [EMAIL PROTECTED] wrote:

 In article [EMAIL PROTECTED],
  [EMAIL PROTECTED] (Alex Martelli) wrote:
 
 ... let's try some google searches and see the number of million hits...:
 
 But how reliable are those estimates of numbers of hits, anyway? More
 than once I've got a page showing something like Results 1 - 10 of 
 about 36 hits, only to find that there were no more pages after the 
 second one. If it could get estimates so wrong with such small numbers,
 how can you trust the large ones?

If your experience in the matter dates from a few months ago (and most
of us may have done Google searches for years, contributing to form our
impressions) it may perhaps not be all that applicable any more,
according to rumors from early this year (e.g.
http://www.eweek.com/article2/0,1895,1916406,00.asp) and blogging
notes by Matt Cutts at http://www.mattcutts.com/blog/bigdaddy/ .

If you can give examples of a query which estimates the (small) number
of results very badly, net of course of Duncan Booth's observation
regarding Google's attempts to filter out near-duplicates, I'll be glad
to look further into the matter (my group is Production Systems, just
about as far from such issues as you can imagine -- rather, we write
software to keep our clusters, networks c smoothly running, monitor
them, and so forth -- but, of course, I do have friends over in Search
Quality and related groups... fortunately, Google has so far managed to
avoid much of the silos syndrome... so I'll be glad to check it out,
but I do need specific examples!-).


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


Re: pypy-0.9.0: stackless, new extension compiler

2006-06-26 Thread Carl Friedrich Bolz
Hi all!

Michael Hudson wrote:
  The PyPy development team has been busy working and we've now packaged
  our latest improvements, completed work and new experiments as
  version 0.9.0, our fourth public release.

Unfortunately the download links for the release tarballs did not work
until very recently. They are now working though. You can download the
0.9 release of PyPy under:

http://codespeak.net/download/pypy/pypy-0.9.0.tar.bz2
http://codespeak.net/download/pypy/pypy-0.9.0.tar.gz
http://codespeak.net/download/pypy/pypy-0.9.0.zip

For detailed notes about how to get started into the world of PyPy see
here:

http://codespeak.net/pypy/dist/pypy/doc/getting-started.html

Sorry for the fuss and cheers,

Carl Friedrich Bolz


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


Dr. Dobb's Python-URL! - weekly Python news and links (Jun 26)

2006-06-26 Thread Cameron Laird
QOTW:  In short, it's never what you think it is ;-) - timbot,
probably on the subject of performance

Real efficiency comes from elegant solutions, not optimized programs.
Optimization is always just a few correctness-preserving transformations
away. - Jonathan Sobel
http://www.cs.indiana.edu/~jsobel/c455-c511.updated.txt


Microsoft is (again) structuring its current marketing around
platforms, and apparently Python is starting to show up in
the campaigns:

http://www.microsoft.com/presspass/press/2006/jun06/06-20MSRoboticsStudioPR.mspx

Intel puts Python to good use in commercial program slicing:

http://groups.google.com/group/comp.lang.python/browse_thread/thread/98cd59f90b169896/

Transcoding PVRs?  Constructing collaborative whiteboards?
Streaming multimedia in all directions?  Apparently you can
construct very impressive network-aware audiovisual
applications *visually* with Kamaelia:

http://groups.google.com/group/comp.lang.python/browse_thread/thread/36c89411fba299b6/
If you only care about advanced concurrency methods, pipeline-
based methods, and componentry, well, that's in there, too,
wrapped as Axon:
http://groups.google.com/group/comp.lang.python/msg/7a5f189e886d9fc0

Discussion about the new Python icons might inspire a reader
to try them:

http://groups.google.com/group/comp.lang.python/browse_thread/thread/204f2792a882648d/

Wow:  PyPy is up to 0.9.0:
 
http://groups.google.com/group/comp.lang.python.announce/msg/6fa325e6c0cdd526

Life becomes more sophisticated than ever before:
http://golly.sourceforge.net/

Timbot illustrates how an experienced file-comparer thinks
about performance hacks (and Windows):
http://groups.google.com/group/comp.lang.python/msg/15d45c2b268fa410
... and how much deeper one can analyze recursion and numerics
than merely the tastes great!  less filling! level:
http://groups.google.com/group/comp.lang.python/msg/e67403fcaa06c022
http://groups.google.com/group/comp.lang.python/msg/4451e63833a0c1c1



Everything Python-related you want is probably one or two clicks away in
these pages:

Python.org's Python Language Website is the traditional
center of Pythonia
http://www.python.org
Notice especially the master FAQ
http://www.python.org/doc/FAQ.html

PythonWare complements the digest you're reading with the
marvelous daily python url
 http://www.pythonware.com/daily
Mygale is a news-gathering webcrawler that specializes in (new)
World-Wide Web articles related to Python.
 http://www.awaretek.com/nowak/mygale.html
While cosmetically similar, Mygale and the Daily Python-URL
are utterly different in their technologies and generally in
their results.

For far, FAR more Python reading than any one mind should
absorb, much of it quite interesting, several pages index
much of the universe of Pybloggers.
http://lowlife.jp/cgi-bin/moin.cgi/PythonProgrammersWeblog
http://www.planetpython.org/
http://mechanicalcat.net/pyblagg.html

comp.lang.python.announce announces new Python software.  Be
sure to scan this newsgroup weekly.

http://groups.google.com/groups?oi=djqas_ugroup=comp.lang.python.announce

Python411 indexes podcasts ... to help people learn Python ...
Updates appear more-than-weekly:
http://www.awaretek.com/python/index.html

Steve Bethard, Tim Lesher, and Tony Meyer continue the marvelous
tradition early borne by Andrew Kuchling, Michael Hudson and Brett
Cannon of intelligently summarizing action on the python-dev mailing
list once every other week.
http://www.python.org/dev/summary/

The Python Package Index catalogues packages.
http://www.python.org/pypi/

The somewhat older Vaults of Parnassus ambitiously collects references
to all sorts of Python resources.
http://www.vex.net/~x/parnassus/

Much of Python's real work takes place on Special-Interest Group
mailing lists
http://www.python.org/sigs/

Python Success Stories--from air-traffic control to on-line
match-making--can inspire you or decision-makers to whom you're
subject with a vision of what the language makes practical.
http://www.pythonology.com/success

The Python Software Foundation (PSF) has replaced the Python
Consortium as an independent nexus of activity.  It has official
responsibility for Python's development and maintenance.
http://www.python.org/psf/
Among the ways you can support PSF is with a donation.
http://www.python.org/psf/donate.html

Kurt B. Kaiser publishes a weekly report on faults and patches.
http://www.google.com/groups?as_usubject=weekly%20python%20patch

Although unmaintained 

Re: What is Expressiveness in a Computer Language [off-topic]

2006-06-26 Thread Matthias Blume
David Hopwood [EMAIL PROTECTED] writes:

 Matthias Blume wrote:
 I agree with Bob Harper about safety being language-specific and all
 that.  But, with all due respect, I think his characterization of C is
 not accurate.
 [...]
 AFAIC, C is C-unsafe by Bob's reasoning.

 Agreed.

 Of course, C can be made safe quite easily:
 
 Define a state undefined that is considered safe and add a
 transition to undefined wherever necessary.

 I wouldn't say that was quite easy at all.

 C99 4 #2:
 # If a shall or shall not requirement that appears outside of a constraint
 # is violated, the behavior is undefined. Undefined behavior is otherwise
 # indicated in this International Standard by the words undefined behavior
 # *or by the omission of any explicit definition of behavior*. [...]

 In other words, to fix C to be a safe language (compatible with Standard C89
 or C99), you first have to resolve all the ambiguities in the standard where
 the behaviour is *implicitly* undefined. There are a lot of them.

Yes, if you want to make the transition system completely explict, it
won't be easy. I was thinking of a catch-all rule that says:
transition to undefined unless specified otherwise.  (Note that I am
not actually advocating this approach to making a language safe.
For practical purposes, C is unsafe.  (And so is C++.))
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Get List of Classes

2006-06-26 Thread Tim Chase
 Is there a method or attribute I can use to get a list of
 classes defined or in-use within my python program? I tried
 using pyclbr and readmodule but for reason that is dogslow.

Well, given that so  much in python is considered a class, the 
somewhat crude code below walks an object/module and emits 
details regarding what's going on.  I couldn't find any nice 
method for determining if a variable referenced a module other 
than checking to see if that item had both a __file__ and a 
__name__ attribute.  Likewise, the check for whether something 
is an object is a bit crude.


  def inspect(thing, name = '', indent=0):
... if hasattr(thing, __file__) and hasattr(thing, __name__):
... #assume it's a module
... print %sModule %s % (\t * indent, thing.__name__)
... for subthing in dir(thing):
... objname = ..join([name, 
subthing]).lstrip(.)
... inspect(eval(objname),
... objname, indent+1)
... elif isinstance(thing, object):
... print %s%s is an object % (\t * indent, name)
...
  import m1
  # m1 is a junk module that references module m2 and has
  # some junk classes in it
  inspect(m1, m1)
Module m1
 m1.M1Class is an object
 m1.M1ObjectClass is an object
 m1.__builtins__ is an object
 m1.__doc__ is an object
 m1.__file__ is an object
 m1.__name__ is an object
 Module m2
 m1.m2.M2Class is an object
 m1.m2.M2ObjectClass is an object
 m1.m2.__builtins__ is an object
 m1.m2.__doc__ is an object
 m1.m2.__file__ is an object
 m1.m2.__name__ is an object



You could also filter out builtin object properties by wrapping 
that last print statement in something like

if not name.startswith(_): print ...

which might cut down on some of the noise.

Just a few ideas.

-tkc




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


Re: Python database access

2006-06-26 Thread vasudevram

The odbc module is part of the Python Standard Library. So you can
search for docs on using it in the Python2x.chm help file (or the HTML
version of the same docs) that comes with the Windows Python
disttribution. Its quite easy to use ODBC from Python, at least for
simple tasks like select * from tablename.

Vasudev Ram
http://www.geocities.com/vasudevram
PDF conversion toolkt:
http://sourceforge.net/projects/xtopdf


BartlebyScrivener wrote:
  But I don't know how to make the connectivity or rather which module to
  import.
 
 Try mxODBC
 
 http://www.egenix.com/files/python/mxODBC.html

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


Re: Search String for Word

2006-06-26 Thread digitalorganics
And what if I want to search for an item in a tuple, is there a
similarly easy method?

Tim Chase wrote:
  What's the best way to search a string for a particular word and get a
  booleen value indicating whether it exists in the string or not?

   substring = 'foo'
   targetstring = 'blah foo bar'
   substring in targetstring
 True
   if substring in targetstring: print 'yup'
 yup
 
 http://docs.python.org/lib/typesseq.html
 
 -tkc

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


Re: style question

2006-06-26 Thread Claudio Grondi
Hari Sekhon wrote:
 Is it better to do:
 
 message = This is line1.
 This is line2
 This is line3\n
 
 or
 
 message = This is line1.\n
 message = message + This is line2\n
 message = message + This is line3\n
 
 
 Since the first method does not follow python's clean and easy looking 
 indentation structure but the second just looks crude and ugly anyway.
 
 If I indent the first version so the text is lined up to match code 
 indentation then this comes out in the input and isn't aligned there.
 
What about

   message = 
   This is line 1
   This is line 2
   This is line 3
   

When it is necessary to skip first empty line):
   message = 
   This is line 1
   This is line 2
   This is line 3
   [1:]


When necessary to skip first line _and_ indentation:
   message = 
   This is line 1
   This is line 2
   This is line 3
   .replace('\n  ', '\n')[1:] # adjust here '\n  ' to indentation
   # ^-- gives 'This is line 1\nThis is line 2\nThis is line 3\n'

?

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


Re: Termination and type systems

2006-06-26 Thread Dirk Thierbach
David Hopwood [EMAIL PROTECTED] wrote:
 Marshall wrote:
 David Hopwood wrote:

 A type system that required an annotation on all subprograms that
 do not provably terminate, OTOH, would not impact expressiveness
 at all, and would be very useful.

 Interesting. I have always imagined doing this by allowing an
 annotation on all subprograms that *do* provably terminate. 

Maybe the paper Linear types and non-size-increasing polynomial time
computation by Martin Hofmann is interesting in this respect.
From the abstract:

  We propose a linear type system with recursion operators for inductive
  datatypes which ensures that all definable functions are polynomial
  time computable. The system improves upon previous such systems in
  that recursive definitions can be arbitrarily nested; in particular,
  no predicativity or modality restrictions are made.

It does not only ensure termination, but termination in polynomial time,
so you can use those types to carry information about this as well.

 If the annotation marks not-provably-terminating subprograms, then it
 calls attention to those subprograms. This is what we want, since it is
 less safe/correct to use a nonterminating subprogram than a terminating
 one (in some contexts).

That would be certainly nice, but it may be almost impossible to do in
practice. It's already hard enough to guarantee termination with the
extra information present in the type annotation. If this information
is not present, then the language has to be probably restricted so
severely to ensure termination that it is more or less useless.

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


Re: Get List of Classes

2006-06-26 Thread digitalorganics
Wow, more than I had asked for, thank you Tim!

I ended up doing this:

def isClass(object):
if 'classobj' in str(type(object)):
return 1
elif 'type' in str(type(object)):
return 1
else:
return 0
def listClasses():
classes = []
for eachobj in globals().keys():
if isClass(globals()[eachobj]):
classes.append(globals()[eachobj])
print eachobj
return classes

Tim Chase wrote:
  Is there a method or attribute I can use to get a list of
  classes defined or in-use within my python program? I tried
  using pyclbr and readmodule but for reason that is dogslow.

 Well, given that so  much in python is considered a class, the
 somewhat crude code below walks an object/module and emits
 details regarding what's going on.  I couldn't find any nice
 method for determining if a variable referenced a module other
 than checking to see if that item had both a __file__ and a
 __name__ attribute.  Likewise, the check for whether something
 is an object is a bit crude.


   def inspect(thing, name = '', indent=0):
 ... if hasattr(thing, __file__) and hasattr(thing, __name__):
 ... #assume it's a module
 ... print %sModule %s % (\t * indent, thing.__name__)
 ... for subthing in dir(thing):
 ... objname = ..join([name,
 subthing]).lstrip(.)
 ... inspect(eval(objname),
 ... objname, indent+1)
 ... elif isinstance(thing, object):
 ... print %s%s is an object % (\t * indent, name)
 ...
   import m1
   # m1 is a junk module that references module m2 and has
   # some junk classes in it
   inspect(m1, m1)
 Module m1
  m1.M1Class is an object
  m1.M1ObjectClass is an object
  m1.__builtins__ is an object
  m1.__doc__ is an object
  m1.__file__ is an object
  m1.__name__ is an object
  Module m2
  m1.m2.M2Class is an object
  m1.m2.M2ObjectClass is an object
  m1.m2.__builtins__ is an object
  m1.m2.__doc__ is an object
  m1.m2.__file__ is an object
  m1.m2.__name__ is an object



 You could also filter out builtin object properties by wrapping
 that last print statement in something like

   if not name.startswith(_): print ...

 which might cut down on some of the noise.
 
 Just a few ideas.
 
 -tkc

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


Re: Python taught in schools?

2006-06-26 Thread Gary Duzan
In article [EMAIL PROTECTED],
Mirco Wahab  [EMAIL PROTECTED] wrote:
Thus spoke Cameron Laird (on 2006-06-25 13:08):

 I'll gratuitously add that, even though I'm personally fond of
 C++, I think teaching it as is done in colleges and high schools
 (!) amounts to child abuse.  It's wildly inappropriate.

C++ programming requires you to
massively invest your thinking
first into the setup of your
build environment (can only be
beaten by Java here).

   A while back I had the opportunity to teach a section of an
introductory computer science course in C++. They had recently
abandoned Pascal in favor of C++ as the language of choice. There
was certainly some spinup on the development environment to do,
but it wasn't too terrible.

   I think the real problem with C++ is that there is a lot of
conceptual baggage to work around to get to a useful program without
having the students unlearn things later. Just basic things like
const (in its various forms), pointers vs. references, class basics,
headers, etc., are necessary for idiomatic C++ programming, but
they get in the way of teaching more basic concepts of program
construction.

   I understand that the school switched to Java a short time later,
   which is some improvement, but still has a good bit of baggage.
Now the Schemers have taken over, so they teach Scheme as the
introductory language. One thing about Scheme is that it doen't
have a lot of baggage; there is no room for it in the spec.  :-)

   To return to topicality for a moment, I think exposing new
students to a combination of Scheme and Python might work well,
providing different views of how to build programs, and leaving
the students with both theoretical and practical foundations on
which to build.

Gary Duzan
Motorola CHS



p.s. Then sock them with ML or Haskell to weed out the weak ones. ;-)
 Then if they survive Occam, throw Java at them, so they'll
 know what they are missing but can still get a job...
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Get List of Classes

2006-06-26 Thread Maric Michaud
Le lundi 26 juin 2006 17:25, Tim Chase a écrit :
  I couldn't find any nice
 method for determining if a variable referenced a module other
 than checking to see if that item had both a __file__ and a
 __name__ attribute.
Why not :

In [8]: import types, sys

In [9]: isinstance(sys, types.ModuleType)
Out[9]: True

?
Seems rather explicit IMO.

-- 
_

Maric Michaud
_

Aristote - www.aristote.info
3 place des tapis
69004 Lyon
Tel: +33 426 880 097
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Search String for Word

2006-06-26 Thread Tim Williams
On 26 Jun 2006 08:24:54 -0700, [EMAIL PROTECTED]
[EMAIL PROTECTED] wrote:
 And what if I want to search for an item in a tuple, is there a
 similarly easy method?

 Tim Chase wrote:
   What's the best way to search a string for a particular word and get a
   booleen value indicating whether it exists in the string or not?
 
substring = 'foo'
targetstring = 'blah foo bar'
substring in targetstring
  True
if substring in targetstring: print 'yup'
  yup

 t = ('a', 'b', 'c', 'd', 'e')
 a = 'a'
 a in t
True
 y = 'y'
 y in t
False

 t = ('test', 'black', 'white')
 a = 'a'
 [i for i in t if a in i]
['black']


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


Re: Get List of Classes

2006-06-26 Thread Tim Chase
 I couldn't find any nice method for determining if a
 variable referenced a module other than checking to see if
 that item had both a __file__ and a __name__ attribute.

 Why not :
 
 In [8]: import types, sys
 
 In [9]: isinstance(sys, types.ModuleType)
 Out[9]: True

Yes...this is the best way to do it.  I hadn't explored (or even 
noticed, before your reply) the types module, which seems to 
have a large toolset for doing exactly what I wanted to.  Thanks!

A good programming language has users asking how did I miss 
that? rather than why can't I make it do what I want?.  Yet 
another feather in Python's cap.

-tkc




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


Replace Whole Object Through Object Method

2006-06-26 Thread digitalorganics
How can an object replace itself using its own method? See the
following code:

class Mixin:
def mixin(object, *classes):
NewClass = type('Mixin', (object.__class__,) + classes, {})
newobj = NewClass()
newobj.__dict__.update(object.__dict__)
return newobj

def isClass(object):
if 'classobj' in str(type(object)):
return 1
elif 'type' in str(type(object)):
return 1
else:
return 0
def listClasses():
classes = []
for eachobj in globals().keys():
if isClass(globals()[eachobj]):
classes.append(globals()[eachobj])
print eachobj
return classes

def MixInto(Class, Mixin):
if Mixin not in Class.__bases__:
Class.__bases__ += (Mixin,)


Okay, so the mixin function becomes part of whatever class I choose and
hence its instances, but the problem is that the way I currently have
it setup mixin() returns a new object, instead of replacing whatever
class instance that calls it into that new object. I hope I'm making
sense here.

Basically what I need is for the method to be able to find out the name
of the instance, then I can just go to the globals dictionary to do the
replacement.

Advance thanks to all who can help...

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


Re: Pygame.draw challenge is over!

2006-06-26 Thread Matthew Nuzum
Hey, just a quick note... when I visit http://pyweek.org I get a
message that the site is not configured. www.pyweek.org works as
expected. When I received this e-mail my e-mail client made pyweek.org
clickable which is how I noticed the problem.

On 6/25/06, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
 It was quite successful too! Download the submissions from the pyweek.org
 site:

 http://media.pyweek.org/static/pgd-200606.zip

 Congratulations to all who participated!


 Richard

 --
 Visit the PyWeek website:
   http://www.pyweek.org/
 --
 http://mail.python.org/mailman/listinfo/python-announce-list

 Support the Python Software Foundation:
 http://www.python.org/psf/donations.html



-- 
Matthew Nuzum
www.bearfruit.org
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Search String for Word

2006-06-26 Thread digitalorganics
Thank you thank you!

Tim Williams wrote:
 On 26 Jun 2006 08:24:54 -0700, [EMAIL PROTECTED]
 [EMAIL PROTECTED] wrote:
  And what if I want to search for an item in a tuple, is there a
  similarly easy method?
 
  Tim Chase wrote:
What's the best way to search a string for a particular word and get a
booleen value indicating whether it exists in the string or not?
  
 substring = 'foo'
 targetstring = 'blah foo bar'
 substring in targetstring
   True
 if substring in targetstring: print 'yup'
   yup

  t = ('a', 'b', 'c', 'd', 'e')
  a = 'a'
  a in t
 True
  y = 'y'
  y in t
 False

  t = ('test', 'black', 'white')
  a = 'a'
  [i for i in t if a in i]
 ['black']
 
 
 HTH :)

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


Re: What is Expressiveness in a Computer Language

2006-06-26 Thread Joe Marshall

Marshall wrote:

 I stand corrected: if one is using C and writing self-modifying
 code, then one *can* zip one's pants.

Static proofs notwithstanding, I'd prefer a dynamic check just prior to
this operation.

I want my code to be the only self-modifying thing around here.

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


Re: Mix-In Class Methods At Run-Time

2006-06-26 Thread Bruno Desthuilliers
[EMAIL PROTECTED] wrote:
 Bruno Desthuilliers wrote:
 
[EMAIL PROTECTED] wrote:
(snip)

and 2) what's the reason to use newstyle classes
versus the old?

All this is explained on python.org (there's a menu entry for this in
the documentation menu). AFAICT, newstyle classes can do whatever
oldstyle classes did, *and much more* (descriptors and usable
metaclasses) - and they are somewhat faster too. So - compatibility with
older Python versions ( 2.2 IIRC) set aside -, there's just no reason
to use oldstyle classes.


 In order to create the dynamic class NewClass in the
code above I called type() but that requires at least one new style
class as a base. Thus, I had to have at least one of my animals inherit
from object and this seemed a nuisance since

OMG, eight more keystrokes - talk about a nuisance...
 
 
 Like, Oh My God! *claps hand to mouth*  lol   You humor me. Yes, eight
 more keystrokes. I follow the general rule of, if I'm going to put in
 extra effort,

OMG, eight more keystrokes - talk about extra effort !-)

 I'd like to know why.

The only reason for *not* doing it would be compat issues with pre 2.2.x
versions.

 So you see, it's not so much an
 adversion to the eight keystrokes (multiplied by however many classes I
 have mind you),

Strange enough, I do write my share of Python code, and don't even
notice typing the EightKeystrokes.

 but to not knowing why I should use them. 

Because they are kind of the standard Python object model since 2.2.x ?-)

Did you at least take time to read the doc on newstyle classes on
python.org ?

FWIW, with 2.5, even exceptions are now newstyle classes. No more
oldstyle classes in the builtins. And AFAICT, no more oldstyle classes
in the standard lib neither. Does that ring a bell ?

 If I don't
 care for descriptors or metaclasses,

You *do* care for descriptors. Without descriptors, no properties, no
classmethods, no staticmethods... What a desolation :(

More seriously, given what you're into actually, not caring about what
one can do with newstyle classes seems really strange to me - like
digging a swimming-pool with a pick and a shovel when you have an
excavator... (disclaimer : google translation, not sure it makes sens in
english...)

 I don't see why I should feel
 compelled to use them.

them - newstyle classes or descriptors and metaclasses ?

 And when I decide I want/need these features, I
 can put the eight keystroke in at that time. 

What can I say ? That's your code, not mine...

-- 
bruno desthuilliers
python -c print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for
p in '[EMAIL PROTECTED]'.split('@')])
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Replace Whole Object Through Object Method

2006-06-26 Thread Maric Michaud
Le lundi 26 juin 2006 17:57, [EMAIL PROTECTED] a écrit :
 How can an object replace itself using its own method? See the
 following code:

 class Mixin:
 def mixin(object, *classes):
 NewClass = type('Mixin', (object.__class__,) + classes, {})
 newobj = NewClass()
 newobj.__dict__.update(object.__dict__)
 return newobj


Variables in python are names, not the objects, and instances shouldn't know 
nothing about how they are referenced.

I guess what you want to do is, in fact, very simple somethig like :

a = SomeClass()
a = a.some_method_wich_return_a_new_object()

or :

for k, v in globals().iteritems() :
if isinstance(v, SomeClass) :
globlals()[k] = v.some_method_wich_return_a_new_object()


 def isClass(object):
Don't mask builtin names.
 if 'classobj' in str(type(object)):
Why don't you test the type directly ?
 return 1
Python has boolean for clarity.

 elif 'type' in str(type(object)):
 return 1
 else:
 return 0
should be :

import types

def isClass(object_) :
if isinstance(object_, type) :
return True # new style class
elif isinstance(object_, types.ClassType) :
return True # old-style class
else : return False

or if you don't need to diferentiate the cases :

def isClass(object_) :
return isinstance(object_, type) or \
isinstance(object_, types.ClassType)



 def listClasses():
 classes = []
 for eachobj in globals().keys():
 if isClass(globals()[eachobj]):
 classes.append(globals()[eachobj])
 print eachobj
 return classes

 def MixInto(Class, Mixin):
 if Mixin not in Class.__bases__:
 Class.__bases__ += (Mixin,)

This doesn't work in most cases (with new style classes), better recreat a 
type which inherit from Class and Mixin, or Class.__dict__ with 
Mixin.__dict__.

 

 Okay, so the mixin function becomes part of whatever class I choose and
 hence its instances, but the problem is that the way I currently have
 it setup mixin() returns a new object, instead of replacing whatever
 class instance that calls it into that new object. I hope I'm making
 sense here.

 Basically what I need is for the method to be able to find out the name
 of the instance, then I can just go to the globals dictionary to do the
 replacement.

 Advance thanks to all who can help...

-- 
_

Maric Michaud
_

Aristote - www.aristote.info
3 place des tapis
69004 Lyon
Tel: +33 426 880 097
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: What is Expressiveness in a Computer Language

2006-06-26 Thread Joe Marshall

David Hopwood wrote:
  Joe Marshall wrote:
 
 I do this quite often.  Sometimes I'll develop `in the debugger'.  I'll
 change some piece of code and run the program until it traps.  Then,
 without exiting the debugger, I'll fix the immediate problem and
 restart the program at the point it trapped.  This technique takes a
 bit of practice, but if you are working on something that's complex and
 has a lot of state, it saves a lot of time because you don't have to
 reconstruct the state every time you make a change.

 The problem with this is that from that point on, what you're running
 is neither the old nor the new program, since its state may have been
 influenced by the bug before you corrected it.

Yes.  The hope is that it is closer to the new program than to the old.

 I find it far simpler to just restart the program after correcting
 anything. If this is too difficult, I change the design to make it
 less difficult.

In the most recent case where I was doing this, I was debugging
transaction rollback that involved multiple database extents.  It was
somewhat painful to set up a clean database to the point where I wanted
to try the rollback, and I wanted a pristine database for each trial so
I could examine the raw bits left by a rollback.  It was pretty easy to
deal with simple errors in the debugger, so I chose to do that instead.






  Wow, interesting.
 
  (I say the following only to point out differing strategies of
  development, not to say one or the other is right or bad or
  whatever.)
 
  I occasionally find myself doing the above, and when I do,
  I take it as a sign that I've screwed up. I find that process
  excruciating, and I do everything I can to avoid it. Over the
  years, I've gotten more and more adept at trying to turn
  as many bugs as possible into type errors, so I don't have
  to run the debugger.
 
  Now, there might be an argument to be made that if I had
  been using a dynamic language, the process wouldn't be
  so bad, and I woudn't dislike it so much. But mabe:
 
  As a strawman: suppose there are two broad categories
  of mental strategies for thinking about bugs, and people
  fall naturally into one way or the other, the way there
  are morning people and night people. One group is
  drawn to the static analysis, one group hates it.
  One group hates working in the debugger, one group
  is able to use that tool very effectively and elegantly.
 
  Anyway, it's a thought.

 I don't buy this -- or at least, I am not in either group.

 A good debugger is invaluable regardless of your attitude to type
 systems. Recently I was debugging two programs written to do similar
 things in the same statically typed language (C), but where a debugger
 could not be used for one of the programs. It took maybe 5 times
 longer to find and fix each bug without the debugger, and I found it
 a much more frustrating experience.
 
 -- 
 David Hopwood [EMAIL PROTECTED]

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


Re: Replace Whole Object Through Object Method

2006-06-26 Thread Bruno Desthuilliers
[EMAIL PROTECTED] wrote:
 How can an object replace itself using its own method? 

AFAIK, It can't (but I can be wrong - some guru around ?).

 See the
 following code:
 
 class Mixin:
 def mixin(object, *classes):
 NewClass = type('Mixin', (object.__class__,) + classes, {})
 newobj = NewClass()
 newobj.__dict__.update(object.__dict__)
 return newobj
 
 def isClass(object):
 if 'classobj' in str(type(object)):
 return 1
 elif 'type' in str(type(object)):
 return 1
 else:
 return 0
 def listClasses():
 classes = []
 for eachobj in globals().keys():
 if isClass(globals()[eachobj]):
 classes.append(globals()[eachobj])
 print eachobj
 return classes

FWIW:
Python 2.4.3 (#1, Jun  3 2006, 17:26:11)
[GCC 3.4.6 (Gentoo 3.4.6-r1, ssp-3.4.5-1.0, pie-8.7.9)] on linux2
Type help, copyright, credits or license for more information.
 def dumbfactory():
... class Dumb(object): pass
... class Dummy: pass
... return Dumb, Dummy
...
 globals()
{'__builtins__': module '__builtin__' (built-in), '__name__':
'__main__', '__doc__': None, 'dumbfactory': function dumbfactory at
0x2ab66e60}
 def fun():
... dumb, dummy = dumbfactory()
... return
...
 fun()
 globals()
{'__builtins__': module '__builtin__' (built-in), '__name__':
'__main__', 'fun': function fun at 0x2ab66ed8, '__doc__': None,
'dumbfactory': function dumbfactory at 0x2ab66e60}


Looks like dumb and dummy won't get listed... And also:

 class Mymeta(type):
... pass
...
 class Foo(object):
... __metaclass__ = Mymeta
...
 'type' in str(type(globals()['Mymeta']))
True

Looks like this will list metaclasses too... May or may not be a problem...

 def MixInto(Class, Mixin):

You're aware that in this function's scope, the 'Mixin' arg name will
shadow the Mixin class name ? (sorry for asking dumb question).

 if Mixin not in Class.__bases__:
 Class.__bases__ += (Mixin,)
 
 
 Okay, so the mixin function becomes part of whatever class I choose and
 hence its instances, but the problem is that the way I currently have
 it setup mixin() returns a new object, instead of replacing whatever
 class instance that calls it into that new object. I hope I'm making
 sense here.
 
 Basically what I need is for the method to be able to find out the name
 of the instance, then I can just go to the globals dictionary to do the
 replacement.

 Advance thanks to all who can help...
 

Instead of exposing problems with your solution, you may want to expose
the real use case ?


-- 
bruno desthuilliers
python -c print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for
p in '[EMAIL PROTECTED]'.split('@')])
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Replace Whole Object Through Object Method

2006-06-26 Thread digitalorganics

Maric Michaud wrote:
 Le lundi 26 juin 2006 17:57, [EMAIL PROTECTED] a écrit :
  How can an object replace itself using its own method? See the
  following code:
 
  class Mixin:
  def mixin(object, *classes):
  NewClass = type('Mixin', (object.__class__,) + classes, {})
  newobj = NewClass()
  newobj.__dict__.update(object.__dict__)
  return newobj
 

 Variables in python are names, not the objects, and instances shouldn't know
 nothing about how they are referenced.

 I guess what you want to do is, in fact, very simple somethig like :

 a = SomeClass()
 a = a.some_method_wich_return_a_new_object()

 or :

 for k, v in globals().iteritems() :
   if isinstance(v, SomeClass) :
   globlals()[k] = v.some_method_wich_return_a_new_object()


  def isClass(object):
 Don't mask builtin names.

You mean object? The shadow/mask only exists within the scope of the
function. But anyhow, point well taken.

  if 'classobj' in str(type(object)):
 Why don't you test the type directly ?

Thanks.

  return 1
 Python has boolean for clarity.

Thanks.


  elif 'type' in str(type(object)):
  return 1
  else:
  return 0
 should be :

 import types

 def isClass(object_) :
 if isinstance(object_, type) :
 return True # new style class
 elif isinstance(object_, types.ClassType) :
 return True # old-style class
 else : return False

 or if you don't need to diferentiate the cases :

 def isClass(object_) :
 return isinstance(object_, type) or \
 isinstance(object_, types.ClassType)

Very clean! Thank you.




  def listClasses():
  classes = []
  for eachobj in globals().keys():
  if isClass(globals()[eachobj]):
  classes.append(globals()[eachobj])
  print eachobj
  return classes
 
  def MixInto(Class, Mixin):
  if Mixin not in Class.__bases__:
  Class.__bases__ += (Mixin,)

 This doesn't work in most cases (with new style classes), better recreat a
 type which inherit from Class and Mixin, or Class.__dict__ with
 Mixin.__dict__.

What doesn't work exactly? The whole purpose of the mixin is to add
functionality to the class and hence to all its instances on the fly.
Creating a new type would not achieve this, unless there's something
I'm missing (a very real possibility!). And what do you mean doesn't
work in most newstyleclass cases? Seems to be working just fine...


  
 
  Okay, so the mixin function becomes part of whatever class I choose and
  hence its instances, but the problem is that the way I currently have
  it setup mixin() returns a new object, instead of replacing whatever
  class instance that calls it into that new object. I hope I'm making
  sense here.
 
  Basically what I need is for the method to be able to find out the name
  of the instance, then I can just go to the globals dictionary to do the
  replacement.

Any answers my primary question though?

 
  Advance thanks to all who can help...

 --
 _

 Maric Michaud
 _

 Aristote - www.aristote.info
 3 place des tapis
 69004 Lyon
 Tel: +33 426 880 097

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


Re: style question

2006-06-26 Thread Scott David Daniels
Claudio Grondi wrote:
clever stuff to di indentation
 When necessary to skip first line _and_ indentation:
   message = 
   This is line 1
   This is line 2
   This is line 3
   .replace('\n  ', '\n')[1:] # adjust here '\n  ' to indentation

Riffing on this idea:
 message = 
   This is line 1
   This is line 2
   This is line 3
   .replace(
   , '\n')[1:]

--Scott David Daniels
[EMAIL PROTECTED]
-- 
http://mail.python.org/mailman/listinfo/python-list


Beginner Programmer Question

2006-06-26 Thread kydavis77
I am doing alot of reading and trying to teach myself how to program.
I can not figure out how to make Write a program that continually
reads in numbers from the user and adds them together until the sum
reaches 100. this work. If someone could show me the correct code so i
can learn from that it would be much appreciated. Thanks

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


Re: Replace Whole Object Through Object Method

2006-06-26 Thread digitalorganics

Bruno Desthuilliers wrote:
 [EMAIL PROTECTED] wrote:
  How can an object replace itself using its own method?

 AFAIK, It can't (but I can be wrong - some guru around ?).

  ...

 FWIW:
 Python 2.4.3 (#1, Jun  3 2006, 17:26:11)
 [GCC 3.4.6 (Gentoo 3.4.6-r1, ssp-3.4.5-1.0, pie-8.7.9)] on linux2
 Type help, copyright, credits or license for more information.
  def dumbfactory():
 ... class Dumb(object): pass
 ... class Dummy: pass
 ... return Dumb, Dummy
 ...
  globals()
 {'__builtins__': module '__builtin__' (built-in), '__name__':
 '__main__', '__doc__': None, 'dumbfactory': function dumbfactory at
 0x2ab66e60}
  def fun():
 ... dumb, dummy = dumbfactory()
 ... return
 ...
  fun()
  globals()
 {'__builtins__': module '__builtin__' (built-in), '__name__':
 '__main__', 'fun': function fun at 0x2ab66ed8, '__doc__': None,
 'dumbfactory': function dumbfactory at 0x2ab66e60}
 

 Looks like dumb and dummy won't get listed... And also:

  class Mymeta(type):
 ... pass
 ...
  class Foo(object):
 ... __metaclass__ = Mymeta
 ...
  'type' in str(type(globals()['Mymeta']))
 True

 Looks like this will list metaclasses too... May or may not be a problem...

  def MixInto(Class, Mixin):

 You're aware that in this function's scope, the 'Mixin' arg name will
 shadow the Mixin class name ? (sorry for asking dumb question).

No sorry necessary, but yes, I am aware of it. Poor programming
practice I'm sure...


...
 
  Basically what I need is for the method to be able to find out the name
  of the instance, then I can just go to the globals dictionary to do the
  replacement.
 
  Advance thanks to all who can help...
 

 Instead of exposing problems with your solution, you may want to expose
 the real use case ?

***
I'm working with a team that's doing social modeling, and for example,
I need to model workers that at some point in the program may or may
not also become employers. Now, I want the workers to take on all
behaviors and attributes of an employer in addition to their
pre-existing worker behaviors and attributes. Also, as I'm sure you
guessed, the workers' attributes need to retain their values at that
point in the program, so a brand new worker-employer object wouldn't in
itself do the trick.
***



 --
 bruno desthuilliers
 python -c print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for
 p in '[EMAIL PROTECTED]'.split('@')])

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


VPW: Talk schedule available

2006-06-26 Thread Brian Quinlan
What's New?
===

The talk schedule for the Vancouver Python Workshop is now available:
http://www.vanpyz.org/conference/talkschedule.html

This years line-up might be even stronger than in 2004, so check it out!

About the Vancouver Python Workshop
===

The conference will begin with keynote addresses on August 4st by Guido
van Rossum [1] and Jim Hugunin [2]. Further talks (and tutorials for 
beginners) will take place on August 5th and 6th. Ian Cavén [3] will 
give the closing address. The Vancouver Python Workshop is a community 
organized and designed for both the beginner and for the experienced 
Python programmer with:

   * tutorials for beginning programmers
   * advanced lectures for Python experts
   * case studies of Python in action
   * after-hours social events
   * informative keynote speakers
   * tracks on multimedia, Web development, education and more

More information see: http://www.vanpyz.org/conference/
or contact Brian Quinlan at: [EMAIL PROTECTED]

Vancouver
=

In addition to the opportunity to learn and socialize with fellow
Pythonistas, the Vancouver Python Workshop also gives visitors the
opportunity to visit one of the most extraordinary cities in the world
[4]. For more information about traveling to Vancouver, see:

http://www.vanpyz.org/conference/vancouver.html
http://www.tourismvancouver.com
http://en.wikipedia.org/wiki/Vancouver

Important dates
===

Talk proposals accepted: May 15th to June 15th
Early registration (discounted): May 22nd to June 30th
Normal registration: from July 1st
Keynotes: August 4th
Conference and tutorial dates: August 5th and 6th

[1] Guido van Rossum (Google) is the inventor of Python and has managed
  its growth and development for more than a decade. Guido was
  awarded the Free Software Foundation Award in 2002 and Dr.Dobb's
  1999 Excellence in Programming Award. Guido works at Google and
  spends half of his time on Python.

[2] Jim Hugunin (Microsoft) is the creator of numerous innovations that
 take Python into new application domains. Jim's most recent project,
 IronPython integrates Python into Microsoft's .NET runtime. Jim's
 previous project, Jython is Python for the Java runtime and was the
 second production-quality implementation of Python. Before that,
 Jim's Numeric Python adapted Python to the needs of number crunching
 applications. Jim works at Microsoft adapting the .NET runtime to
 the needs of dynamic languages like Python.

[3] Ian Cavén is the primary developer of the Lowry Digital Images
 motion picture restoration system. This Python and Zope-based system
 has been used to restore over 150 motion pictures. Highlights
 include Citizen Kane, Sunset Boulevard and both the Indiana Jones
 and Star Wars trilogies. While Ian was Chief Scientist at Lowry
 Digital, his rack of computers grew from a few Macintoshes on his
 desktop to over six hundred Macintosh and Linux servers - at
 one point earning Lowry the title as the second biggest installation
 of parallel processing Maintoshes in the world. In 2005, Lowry
 Digital Images was acquired by DTS (the famous movie audio company)
 and renamed DTS Digital Images. The motion picture restoration
 system has been discussed in publications as diverse as IEEE
 Spectrum, USA Today, the BBC NEWS, the New York Times and Apple.com.
 Ian has been a Python enthusiast since 1999.

[4] http://news.bbc.co.uk/2/hi/business/2299119.stm
 http://edition.cnn.com/2006/BUSINESS/06/15/btn.cities/index.html

Cheers,
Brian




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


Re: Beginner Programmer Question

2006-06-26 Thread Claudio Grondi
[EMAIL PROTECTED] wrote:
 I am doing alot of reading and trying to teach myself how to program.
 I can not figure out how to make Write a program that continually
 reads in numbers from the user and adds them together until the sum
 reaches 100. this work. If someone could show me the correct code so i
 can learn from that it would be much appreciated. Thanks
 
Isn't it your homework?
Why can't you figure it out?
What have you tried?

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


Re: Beginner Programmer Question

2006-06-26 Thread [EMAIL PROTECTED]

Claudio Grondi wrote:
 [EMAIL PROTECTED] wrote:
  I am doing alot of reading and trying to teach myself how to program.
  I can not figure out how to make Write a program that continually
  reads in numbers from the user and adds them together until the sum
  reaches 100. this work. If someone could show me the correct code so i
  can learn from that it would be much appreciated. Thanks
 
 Isn't it your homework?
 Why can't you figure it out?
 What have you tried?

 Claudio

I am doing alot of reading, and the problem didnt come with an answer.
I dont understand how to get it to continually input numbers and add
all those together

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


Re: Beginner Programmer Question

2006-06-26 Thread [EMAIL PROTECTED]

[EMAIL PROTECTED] wrote:
 Claudio Grondi wrote:
  [EMAIL PROTECTED] wrote:
   I am doing alot of reading and trying to teach myself how to program.
   I can not figure out how to make Write a program that continually
   reads in numbers from the user and adds them together until the sum
   reaches 100. this work. If someone could show me the correct code so i
   can learn from that it would be much appreciated. Thanks
  
  Isn't it your homework?
  Why can't you figure it out?
  What have you tried?
 
  Claudio

 I am doing alot of reading, and the problem didnt come with an answer.
 I dont understand how to get it to continually input numbers and add
 all those together

#Add up to 100 program

#What number are you adding up to?
bigone = 100

number = input(Whats the first number?)
number2 = input (Whats the second number?)
nu3 = number+number2
while nu3  bigone:
print (Not there yet, next number please)


print Finally there!

thats what i thought maybe it was...but after the first two numbers it
just continually scrolls on the screen with finally there

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


Re: Beginner Programmer Question

2006-06-26 Thread Rune Strand

 I am doing alot of reading, and the problem didnt come with an answer.
 I dont understand how to get it to continually input numbers and add
 all those together

Use while, raw_input, sys.argv[1] and int() and break the loop when the
sum is above 100.

;-)

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


  1   2   3   >