Re: Help with Threading

2005-01-24 Thread Pierre Barbier de Reuille
Philip Smith a écrit :
Hi
I am fairly new to Python threading and my needs are simple(!)
I want to establish a number of threads each of which work on the same 
computationally intensive problem in different ways.

I am using the thread module rather than the threading module.
My problem is I can't see how (when one thread completes) to ensure that the 
other threads terminate immediately.

Appreciate some simple advice
Phil 


With Python's threads, you have to handle this kindd a feature yourself. 
For example, you can create a single object containing a boolean set to 
False by default. When one of your algorithm finishes, the boolean is 
set to True. All your algorithm should regularly test this boolean and 
exit if it is True ! Note that the boolean has to be inside another 
object because Boolean types is not mutable. Now, if you really want to 
be able to "kill" your threads, you will need another thread interface. 
For example, Qt threads allows that ... and WxPython offers you some 
functions to do exactly what I described.

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


pygsl-0.3.1 released

2005-01-24 Thread Pierre Schnizer
pyGSL is a wrapper for the GNU Scientific Library. Get it from
http://sourceforge.net/projects/pygsl.

Up to now it provides the following modules:
Blas, Chebyshev, Combination, Const
Diff, Deriv, Eigen, Fit, FFT, Ieee, Integrate
Interpolation, Linalg, Math
Minimize, Multifit, Multifit_nlin,
Multimin, Multiroots, Odeiv, Permutation
Poly, Qrng, Rng, Roots, Siman (Simulated Annealing)
Special Functions, Spline

GSL >= 1.3 and numerical python are required.

It requires either Numeric or numarray.

Please send all bug reports, requests, patches to
[EMAIL PROTECTED]


Yours sincerely
  Pierre Schnizer



-- 
Please remove the nospam for direct reply
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: best way to do a series of regexp checks with groups

2005-01-24 Thread Alex Martelli
Nick Craig-Wood <[EMAIL PROTECTED]> wrote:

> Here is a different solution...
> 
> class Result:
> def set(self, value):
> self.value = value
> return value
> 
> m = Result()
> 
> if m.set(re.search(r'add (\d+) (\d+)', line)):
> do_add(m.value.group(1), m.value.group(2))
> elif m.set(re.search(r'mult (\d+) (\d+)', line)):
> do_mult(m.value.group(1), m.value.group(2))
> elif m.set(re.search(r'help (\w+)', line)):
> show_help(m.value.group(1))

This is roughly the same as my Cookbook recipe for test-and-set, but if
all you're using it for is RE search and MO access you might be better
off giving more responsibilities to your auxiliary class, such as:

class ReWithMemory(object):
def search(self, are, aline):
self.mo = re.search(are, aline)
return self.mo
def group(self, n):
return self.mo.group(n)

m = ReWithMemory()

if m.search(r'add (\d+) (\d+)', line):
do_add(m.group(1), m.group(2))
elif m.search(r'mult (\d+) (\d+)', line):
do_mult(m.group(1), m.group(2))
elif m.search(r'help (\w+)', line):
show_help(m.group(1))

Demeter's Law suggests that the 'm.value.group' accesses in your
approach are better handled by having m delegate to its `value'; and the
repeated m.set(re.search( ... seem to be a slight code smell, violating
"once and only once", which suggests merging into a single `set' method.
Your approach is more general, of course.


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


Re: compile python to binary

2005-01-24 Thread Alex Martelli
Doug Holton <[EMAIL PROTECTED]> wrote:
   ...
> > oh, you mean that "python compiler" didn't mean "the python compiler".
> 
> I wouldn't assume a novice uses terms the same way you would.  It was
> quite clear from his message that py2exe and the like were what he was
> referring to, if you had read his first sentence:
> 
> "I have seen some software written in python and delivered as binary form."

Sorry, Doug, not clear to me.  I have seen, for example, some games
delivered with binary files with names such as something.pyc -- and
those ARE binary files made by the python compiler.


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


PyWin32 installation

2005-01-24 Thread mg
Hi all,
I have reinstalled my Win32 computer last week and I did an update of 
the project PyWin32 to complete my Python installation.
(I have to use sources from CVS for my project !)

So, when I run 'python setup.py' in my PyWin32 directory, I have two 
problem : the version indacated in windows.h and some symbols who are 
not defined. See the trace :

   running install
   running build
   running build_py
   running build_ext
   Warning - can't find an installed platform SDK
   Found WINDOWS.H version 0x501 in C:\Program Files\Microsoft 
Visual Studio .NET 2003\Vc7\PlatformSDK\include
   building 'win32print' extension
   C:\Program Files\Microsoft Visual Studio .NET 
2003\Vc7\bin\link.exe /DLL /nologo /INCREMENTAL:NO 
/LIBPATH:C:\ext_projects\python\dist\src\libs 
/LIBPATH:C:\ext_projects\python\dist\src\PCBuild 
/LIBPATH:build\temp.win32-2.5\Release winspool.lib user32.lib 
/EXPORT:initwin32print 
build\temp.win32-2.5\Release\win32\src\win32print\win32print.obj 
/OUT:build\lib.win32-2.5\win32\win32print.pyd 
/IMPLIB:build\temp.win32-2.5\Release\win32\src\win32print\win32print.lib 
/MACHINE:ix86
   Creating library 
build\temp.win32-2.5\Release\win32\src\win32print\win32print.lib and 
object build\temp.win32-2.5\Release\win32\src\win32print\win32print.exp
   win32print.obj : error LNK2019: unresolved external symbol 
[EMAIL PROTECTED] referenced in function "struct _object * __cdecl 
PyStartDoc(struct _object *,struct _object *)" 
(?PyStartDoc@@YAPAU_object@@[EMAIL PROTECTED]@Z)
   win32print.obj : error LNK2019: unresolved external symbol 
[EMAIL PROTECTED] referenced in function "struct _object * __cdecl 
PyEndDoc(struct _object *,struct _object *)" 
(?PyEndDoc@@YAPAU_object@@[EMAIL PROTECTED]@Z)

Then, I don't kwnow how to solve theses problem ! Is there someone tho 
help me ?
Thank,

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


Re: Alternative Ways to install Python 2.4?

2005-01-24 Thread Michael Goettsche
On Monday 24 January 2005 00:29, "Martin v. Löwis" wrote:
> Michael Goettsche wrote:
> > I convinced my CS teacher to use Python in school. We currently have 2.2
> > installed on a Windows 2000 Terminal server. I asked the system
> > administrator to upgrade to Python 2.4, but he didn't succeed in doing
> > it. He used the microsoft installer package, which according to him
> > crashed when starting. So my question is if there's an alternative way to
> > install it(must be easy). Would it be an option to remove 2.2 first and
> > then try to install 2.4 again?
>
> That would be an option, but I doubt it helps. Please have a look at
>
> http://www.python.org/2.4/bugs.html
>
> Most likely, you need to upgrade Visual Basic on that machine.
>
> Of course, without a precise error description, it is hard to tell.
>
> Regards,
> Martin

Hi Martin,

thanks for your answer, I'll let him know!

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


Re: best way to do a series of regexp checks with groups

2005-01-24 Thread Duncan Booth
Mark Fanty wrote:

> No nesting, but the while is misleading since I'm not looping and this
> is a bit awkward.  I don't mind a few more key strokes, but I'd like
> clarity.  I wish I could do
> 
> if m =  re.search(r'add (\d+) (\d+)', $line):
> do_add(m.group(1), m.group(2))
> elif m = re.search(r'mult (\d+) (\d+)', $line):
> do_mult(m.group(1), m.group(2))
> else m = re.search(r'help (\w+)', $line):
> show_help(m.group(1))
> 
> Now that's what I'm looking for, but I can't put the assignment in an 
> expression.  Any recommendations?  Less "tricky" is better. 

Try thinking along the following lines. It is longer, but clearer and 
easily extended to more commands. For more complete command processing use 
the 'cmd' module.

import sys

class Command:
def do_add(self, a, b):
'''add  '''
return int(a)+int(b)

def do_mult(self, a, b):
'''mult  '''
return int(a)*int(b)

def do_help(self, *what):
'''help [words] - give some help'''
if not what:
what = sorted(s[3:] for s in dir(self) if s.startswith('do_'))
def error(): '''Unknown command'''
for w in what:
cmd = getattr(self, 'do_'+w, error)
print "Help for %r:\n%s\n" % (w, cmd.__doc__)

def do_exit(self):
'''exit - the program'''
sys.exit(0)

def __call__(self, line):
words = line.split()
if not words:
return
command = words.pop(0)
cmdfn = getattr(self, 'do_'+command, None)
if not cmdfn:
print "Unknown command %r. Use 'help' for help" % command
return

result = None
try:
result = cmdfn(*words)
except TypeError, msg:
print msg
if result is not None:
print "result is",result

cmd = Command()

while 1:
cmd(sys.stdin.readline())
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: best way to do a series of regexp checks with groups

2005-01-24 Thread Steven Bethard
Alex Martelli wrote:
class ReWithMemory(object):
def search(self, are, aline):
self.mo = re.search(are, aline)
return self.mo
def group(self, n):
return self.mo.group(n)
m = ReWithMemory()
if m.search(r'add (\d+) (\d+)', line):
do_add(m.group(1), m.group(2))
elif m.search(r'mult (\d+) (\d+)', line):
do_mult(m.group(1), m.group(2))
elif m.search(r'help (\w+)', line):
show_help(m.group(1))
Demeter's Law suggests that the 'm.value.group' accesses in your
approach are better handled by having m delegate to its `value'; and the
repeated m.set(re.search( ... seem to be a slight code smell, violating
"once and only once", which suggests merging into a single `set' method.
Your approach is more general, of course.
I get a bit uneasy from the repeated calls to m.group...  If I was going 
to build a class around the re, I think I might lean towards something like:

class ReWithMemory(object):
def search(self, are, aline):
self.mo = re.search(are, aline)
return self.mo
def groups(self, *indices):
return [self.mo.group(i) for i in indices]
m = ReWithMemory()
if m.search(r'add (\d+) (\d+)', line):
do_add(*m.groups(1, 2))
elif m.search(r'mult (\d+) (\d+)', line):
do_mult(*m.groups(1, 2))
elif m.search(r'help (\w+)', line):
show_help(*m.groups(1))
Of course, this is even less general-purpose than yours...
(And if I saw myself using this much regex code, I'd probably reconsider 
my strategy anyway.) ;)

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


Why can't use cursor.nextset() in adodbapi package?

2005-01-24 Thread nightmarch
I want use crsr.nextset() , But I got errors like following:


>>> connStr = "Provider=MSDAORA.1;Password=jmpower;User
ID=jmpower;Data Source=jmgis_agps3;Persist Security Info=True"
>>> import adodbapi
>>> conn= adodbapi.connect( connStr )
>>> crsr = conn.cursor()
>>> sql = "select * from wjtmp"
>>> crsr.execute(sql)
>>> rec = crsr.fetchone()
>>> crsr.nextset()
Traceback (most recent call last):
  File "", line 1, in ?
  File "C:\Python24\Lib\site-packages\adodbapi\adodbapi.py", line 711,
in nextset
rsTuple=self.rs.NextRecordset()
  File "", line 2, in NextRecordset
  File "C:\Python24\Lib\site-packages\win32com\client\dynamic.py",
line 251, in _ApplyTypes_
result = self._oleobj_.InvokeTypes(*(dispid, LCID, wFlags,
retType, argTypes) + args)
com_error: (-2147352567, '\xb7\xa2\xc9\xfa\xd2\xe2\xcd\xe2\xa1\xa3',
(0, 'ADODB.Recordset', 'Current provider does not support returning
multiple recordsets from a single execution.',
'C:\\WINNT\\HELP\\ADO210.CHM', 0, -2146825037), None)




Why? 

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


Re: best way to do a series of regexp checks with groups

2005-01-24 Thread Alex Martelli
Steven Bethard <[EMAIL PROTECTED]> wrote:

> I get a bit uneasy from the repeated calls to m.group...  If I was going
> to build a class around the re, I think I might lean towards something like:
> 
> class ReWithMemory(object):
>  def search(self, are, aline):
>  self.mo = re.search(are, aline)
>  return self.mo
>  def groups(self, *indices):
>  return [self.mo.group(i) for i in indices]
> 
> m = ReWithMemory()
> 
> if m.search(r'add (\d+) (\d+)', line):
>  do_add(*m.groups(1, 2))
> elif m.search(r'mult (\d+) (\d+)', line):
>  do_mult(*m.groups(1, 2))
> elif m.search(r'help (\w+)', line):
>  show_help(*m.groups(1))
> 
> Of course, this is even less general-purpose than yours...

I'm not sure what advantage it's supposed to give.  Would you have any
problems writing, say, somecall(X[1], X[2]) ...?  Python normally relies
on indexing one thing at a time, and I see calling m.group(1) etc as
just the same kind of approach.

 
> (And if I saw myself using this much regex code, I'd probably reconsider
> my strategy anyway.) ;)

Surely joining all the regexp's into one big one with | would be faster
and more compact, but, with variable numbers of groups per sub-regexp,
determining which regexp matched can perhaps be tricky (issues with
matching mo.lastindex to the correct sub-regexp).  So, I can understand
the desire to do it sequentially, regexp by regexp.


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


Re: Keyboard problems with Python shell over SSH

2005-01-24 Thread Nils Emil P.Larsen
Hello Stian

>Your Python installation is probably compiled without readline support. 
>It is the readline library that enables arrow keys and Ctrl-R and stuff 
>to work.
>Try "import readline" - you will probably get an error.

You are indeed right. "import readline" generated an error.

I downloaded, compiled and installed GNU readline.
Then I downloaded Python 2.4 source and configured it with
./configure --with-readline
make
make install

This did the trick!
Thank you!

Nils Emil P. Larsen
--
My reply-address is valid.   www.bios-flash.dk
Min svar-adresse er gyldig.  Redning af døde BIOS'er
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Help on project, anyone?

2005-01-24 Thread Fuzzyman
Hello Chap,

I work on various projects. Several of them would *greatly* benefit
from input from another programmer. You can see them at :

http://www.voidspace.org.uk/python/index.shtml

Specifically, I have three projects that I'm looking for someone to
work on, but they are all on the 'small' scale. I couldn't tell whether
you would be happy with that, or if you wanted to join a larger team.

I have listed them in order of difficulty (easiest first). With all of
them I would work with you or offer whatever level of support you want.


1) My dateutils module is out of date and needs work on it.
http://www.voidspace.org.uk/python/modules.shtml#dateutils [1]

2) I need an online bookmarks manager. This is a CGI script that will
allow you to keep/manage an online bookmarks page. [2]

3) Simple Version Control program for single programmer. A very simple
way of doing version control/releases for small projects with only a
single programmer. [3]

If any of these interest you then please contact me - fuzzyman _AT_
voidspace _DOT_ org _DOT_ uk (in preference to my gmail account).

Whatever you decide to do, good luck with your pythoneering.

Regards,


Fuzzyman

[1] Several of the functions shadow functions in the standard library
calender.py. Some of the return values are in illogical orders and a
couple don't behave *exactly* as documented (when adding months to a
date that is at the end of a month). Basically it's in need of an
update/clean up. It is incorporated into a couple of other projects -
and it works fine for those, so *I* don't need it cleaned up. However,
it's one of my most popular downloads - so it's obviously something
people want and would appreciate an updated version.

[2] I work in several locations and really *need* a single bookmarks
repository. I have a clear idea of what I would like *and* how to do
ti. I just don't have the time to work on it. None of the existing
perl/php ones I explored did quite what I hoped. The advantage of this
project is that you could start simple and just incrementally add
features. You could have something working *very* quickly. Basically
phase 1 - a simple bookmark manager with add/delete links. Phase 2 -
parse IE/Firefox/opera bookmark files and check for duplicates
(including sections). Phase 3 - multiple users, client prorgram with
automatic synchronization. (plus lots more)

[3] I think lots of people would find this useful. A version control
system for projects where CVS/Subversion is overkill. This would be
based on DirWatcher/FSDM (
http://www.voidspace.org.uk/python/programs.shtml#dirwatcher ) - All
the code for finding which files have changed is already there, and
there is an existing Tkinter GUI for Dirwatcher.

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


Re: delay and force in Python

2005-01-24 Thread Will Stuyvesant
Just for the record, an implementation without using generators,
somewhat like in Sect. 3.5 of the Wizard book, and without recursion
limit problems.
.
. def stream_hd(s): # the head of the stream
. return s[0]
.
. def stream_tl(s): # the tail of the stream
. return s[1]()
.
. ##
. # The low argument is required: the first element of the stream.
. # You either use high= or stop_f= to define the end of the
. # stream.  Omit both for an infinite stream.  stop_f is a function
. # that takes low as argument and returns True or False.
. # The next_f function takes one argument (an element of the stream,
. # same type as the low argument has)
. # The stop_f function takes one argument (same type as low)
. # @param low object
. # @param high object
. # @param next_f function
. # @param stop_f function
. # @return list, a stream
. def make_stream(low, high=None, next_f=None, stop_f=None):
. if next_f is None: next_f = lambda x: x + 1
. if high is not None:# using high
. if low > high:
. return None
. else:
. return [low, lambda: make_stream(
.   next_f(low), high=high, next_f=next_f)]
. elif stop_f is not None:# using stop_f
. if low > stop_f(low):
. return None
. else:
. return [low, lambda: make_stream(
.   next_f(low), next_f=next_f, stop_f=stop_f)]
. else:   # infinite stream
. return [low, lambda: make_stream(
.   next_f(low), next_f=next_f)]
.
. ##
. # iterative version of filter
. # @param pred function, (stream-element) -> bool
. # @param s list, a stream
. # @return list, a stream
. def stream_filter(pred, s):
. if s is None: return []
. while True:
. elem = stream_hd(s)
. if pred(elem):
. return [elem, lambda: stream_filter(pred, stream_tl(s))]
. else:
. s = stream_tl(s)
. if s is None: return []
.
.
. if __name__ == '__main__':
.
. def is100some(x): return x % 100 == 0
. assert(stream_hd(stream_tl(stream_tl(stream_filter(
. is100some,
. make_stream(1, 11) == 300)
.
. def add_33(x): return x + 33
. assert(stream_hd(stream_tl(stream_filter(
. is100some,
. # stream 1,34,67,100,...
. make_stream(1,9, next_f = add_33 == 3400)
.
. assert(stream_hd(stream_tl(stream_filter(
. is100some,
. # infinite stream 1,2,...
. make_stream(1 == 200)
.
. def mod_2(x): return x % 2 == 0
. # this will need more evaluations than the recursion limit count
. infinite_filter = stream_filter(mod_2, make_stream(1))
. assert( stream_hd(stream_tl(infinite_filter)) == 4 )
.

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


Re: Class introspection and dynamically determining functionarguments

2005-01-24 Thread harold fellermann
On 20.01.2005, at 12:24, Mark English wrote:
I'd like to write a Tkinter app which, given a class, pops up a
window(s) with fields for each "attribute" of that class. The user 
could
enter values for the attributes and on closing the window would be
returned an instance of the class. The actual application I'm 
interested
in writing would either have simple type attributes (int, string, 
etc.),
or attributes using types already defined in a c-extension, although 
I'd
prefer not to restrict the functionality to these requirements.
I am working on nearly the same thing! Small sort of generic attribute 
editor
in Tkinter (and Tix). Altough my implementation is still very unpythonic
(== ugly) in many places, it can edit the attributes of instances and 
classes,
as well as generate new instances / classes. I would like to create new
attributes or delete them as well, but haven't done it so far.
A still faraway dream would be, to allow the user to enter source code, 
that
will be compiled into byte code and assign it to the instance, so the 
user can
modify code at run time (if it is possible to disallow access to 
insecure
modules while code is compiled).

Secondly, the code won't know exactly how to initialise the class
instance used to determinte the attributes. Do I need to make it a
prerequesite that all instances can be created with no arguments ?
I did it this way, too.
Maybe you can provide a parameterless __new__ in addition to the 
__init__.
I imagine this is the way that e.g. pickle does the job. Well, I don't
know. Let this sentence just be an invitation for an expert to write 
something
here.

Should I force/allow the user to pass an instance instead of a class ?
However you like. I prefer passing classes, otherwise you end up in a
situation where you need to create dummy instances that are only used
as "copying templates". If you get an instance: foo = type(bar)()
would give you an instance of the same class as bar. But this just
looks like a hack to me when compared to foo = Bar().
Passing an instance allows you to look at its __dict__ of course.
But you have no assurance that the variables you find there are present
in all instances of that class. Phython is just to dynamic for that.
Should I be using inspect.getargspec on the class __init__ method and
then a loop with a try and a lot of except clauses, or is there a nicer
way to do this ? Presumably the pickling code knows how do
serialise/deserialise class instances but I'm not sure how I'd use this
without already having a class instance to hand.
Personally, I ended up writing a class Attribute that provides access to
the attributes and allows more finetuning than a generic approach would
do (think of e.g. validation). My overall setting works like this:
For each attribute that you want to appear in the GUI you define an 
Attribute

class Attribute(object) :
def __init__(self,
 name,   # name of the attribute
 type,   # specifies the widget type
 values=None,# then OptionMenu is used instead
 validate=None,  # if given, a callable that returns
  # either True or False
 get=None,   # callable to get the actual value
  # None: generic getattr()
 widget_options={}   # passed to the Tix widget used
) :
pass # [...]
The "controller" of an editable object gets the object and a list
of those Attribute()'s. There is a generic one that handles validation
and generic setattr(), but can be overwritten to allow more 
sophisticated
stuff.

When creating a new instance, I ask for initial arguments which I know
(like __name__ and __doc__ if its a class that I create) in nearly the
same way.
If you already have your instance, it is possible to generate the
Attribute()-list from the dict of this instance:
attributes = [
Attribute(name,type(getattr(instance,name))) for name in 
dir(instance)
]

Lastly, does such an app already exist ?
As you see, my solution is not as general as what you might have in 
mind.
I needed to finetune so much of the underlying generic plan, that it
looks more like declaration-based now.

Anyway, if you are interested: This is the edit part of my app (It's 
only
the mapping from attributes to widgets, so no instance creation in this 
part).
As this was only a short snippet in the project I am doing, I could, 
never
give it the time it deserved. So I am sure that my code is not the best 
sollution,
but maybe it serves as a starting point for further discussion.

All the best,
- harold -

import Tkinter
import Tix
class Attribute(object) :
def __init__(self,
 name,
 type,
 values=None,
 validate=None,
 get=None,
 widget_options={}
) :
 

Re: how to write a tutorial

2005-01-24 Thread Jonathan Burd
Xah Lee wrote:
adding to my previosu comment...

*plonk*
--
"Women should come with documentation." - Dave
--
http://mail.python.org/mailman/listinfo/python-list


Re: Asynchronous event handling...?

2005-01-24 Thread Pedro Werneck
Hi,

Maybe something like this...



from Tkinter import *
import itertools

class Application(Frame):
def __init__(self, master=None):
Frame.__init__(self, master)
self.grid()
self.createWidgets()
def createWidgets(self):
self.stop = Button(self,text='Emergency Stop!',command=self.stop)
self.count = Button(self,text='Count',command=self.count)
self.count.grid(row=0,column=0)
self.stop. grid(row=0,column=1)

def count(self):
self._counter = itertools.count()
self._id = self.after(0, self._count)

def _count(self, event=None):
i = self._counter.next()
print i
self.update_idletasks()
self._id = self.after(0, self._count)

def stop(self):
self.after_cancel(self._id)


app = Application()
app.mainloop()


On Mon, 24 Jan 2005 16:52:51 +1100
"Chris Line" <[EMAIL PROTECTED]> wrote:

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


RE: Class introspection and dynamically determining function arguments

2005-01-24 Thread Mark English
Thanks for the pointers to traits, BasicProperty, and harold
fellermann's sample code...


---
The information contained in this e-mail is confidential and solely 
for the intended addressee(s). Unauthorised reproduction, disclosure, 
modification, and/or distribution of this email may be unlawful. If you 
have received this email in error, please notify the sender immediately 
and delete it from your system. The views expressed in this message 
do not necessarily reflect those of LIFFE Holdings Plc or any of its subsidiary 
companies.
---

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


Re: What's so funny? WAS Re: rotor replacement

2005-01-24 Thread Fuzzyman
I also feel the lack of a standard cryptography module in the core...
even a *basic* one. At least rotor provided that, before it was
deprecated. I (along with many other python users) write CGIs where the
only extension modules that I can use are either pure python, or ones
my web hoster is willing to install. Luckily my hoster will install
modules without too much fuss - others aren't so lucky. Cryptography is
a pretty 'standard' requirement these days.. and IMHO ought to be in
the 'standard library'.

Without commenting (or reading properly) on this exchange... it does
seem that many of ''s contributions have been very bad tempered
recently. Hmmm.
Regards,

Fuzzy
http://www.voidspace.org.uk/python/index.shtml

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


Pointer: CfV de.comp.lang.python

2005-01-24 Thread Christian Helmbold
hi
I ask german speaking python programmers to contest the election to 
establish the german python newsgroup de.comp.lang.python. You can find 
the ballot in de.admin.news.annouce 
<[EMAIL PROTECTED]> 
or via Google http://tinyurl.com/5g5gf.

Thank You!
Christian
--
http://mail.python.org/mailman/listinfo/python-list


RE: Pointer: CfV de.comp.lang.python

2005-01-24 Thread Tim Golden
[Christian Helmbold]
| I ask german speaking python programmers to contest the election to 
| establish the german python newsgroup de.comp.lang.python. 

It strikes me that this would have been one of the few
occasions when it *would* have made sense to write in
a language other than English on c.l.py.

Although, thinking about it, us non-German speakers
wouldn't have known that the post wouldn't apply to
us by definition!

TJG


This e-mail has been scanned for all viruses by Star. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk

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


Re: delay and force in Python

2005-01-24 Thread Nick Coghlan
Nick Coghlan wrote:
Will Stuyvesant wrote:
The program below creates a stream with the numbers 1..995
and then filters the stream, keeping only the even numbers,
and then prints the second number in the stream (implemented
as the first number of the tail, just like in the 3.5
Section in the Wizard book).

How's this:
Py> from itertools import islice
Py> print islice((x for x in xrange(1, 996) if x % 2 == 0), 1, 2).next()
4
Wouldn't it be nice if this could be spelt:
print (x for x in xrange(1, 996) if x % 2 == 0)[2]
Well, I just put a patch on SF to enable exactly that:
http://www.python.org/sf/1108272
Cheers,
Nick.
--
Nick Coghlan   |   [EMAIL PROTECTED]   |   Brisbane, Australia
---
http://boredomandlaziness.skystorm.net
--
http://mail.python.org/mailman/listinfo/python-list


Re: compile python to binary

2005-01-24 Thread Fredrik Lundh
Daniel Bickett wrote:

>> oh, you mean that "python compiler" didn't mean "the python compiler".
>> [snip]
>
> I simply inferred that he was using the wrong terminology, being that
> he said "binary" twice ;-)

yeah, but PYC files (which is what the standard compiler produces) are binary
files too, in all the usual senses of that word -- and it's not that uncommon 
that
people ship Python programs as a bunch of EXEs/DLLs (or equivalents), and
PYC files.

 



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


Re: delay and force in Python

2005-01-24 Thread Fredrik Lundh
Nick Coghlan wrote:

>> How's this:
>>
>> Py> from itertools import islice
>> Py> print islice((x for x in xrange(1, 996) if x % 2 == 0), 1, 2).next()
>> 4
>
> Wouldn't it be nice if this could be spelt:
>
> print (x for x in xrange(1, 996) if x % 2 == 0)[2]

as I've always said, the sooner we can all use the itertools goodies without
even noticing, the better.

 



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


Re: finding name of instances created

2005-01-24 Thread Nick Coghlan
Steven Bethard wrote:
That is, you can just keep track of all the names of a Robot in the 
Robot object.  In the simple case, where there's only one name, you can 
display it as such.  In the more complicated case, where there's some 
aliasing, you can display the multiple aliases.  This means you don't 
have to teach about aliasing right off the bat, but if a student 
accidentally discovers it on their own, the machinery's there to explain 
it...
Incidentally, this discussion made me realise the real reason why using a lambda 
to create a named function is evil:

Py> def f(): pass
...
Py> f.func_name
'f'
Py> f = lambda: None
Py> f.func_name
''
I think I've heard that explanation before, but it never really clicked.
Cheers,
Nick.
--
Nick Coghlan   |   [EMAIL PROTECTED]   |   Brisbane, Australia
---
http://boredomandlaziness.skystorm.net
--
http://mail.python.org/mailman/listinfo/python-list


Wrapping functions in modules or packages.

2005-01-24 Thread Antoon Pardon
I'm writing some utilty functions for use with gtk. But
in order to use them correctly I have to know whether
they are called in the gtk-thread or an other.

So my idea was to wrap the gtk.main function so that
it would registrate the thread_id that called it.

So I was thinking about doing something like the
following.


import gtk

import thread

_gtkmain = gtk.main


def main():

  global _gtkthread

  _gtk_thread = thread.get_ident()
  _gtkmain()


gtk.main = main


Is this acceptable? Are there better ways to do things like
this?
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: short programming projects for kids

2005-01-24 Thread Adrian Casey
André Roberge wrote:

> bobdc wrote:
>> I will be teaching an "Introduction to Programming" class to some
>> middle school aged children and will be using Python, obviously. Does
>> anyone have suggestions for simple little programs to create and
>> analyze with them after I get past turtle graphics?
>> 
>> Turtle graphics will be plenty for the first session, and I will leave
>> time to ask them what they'd like to do in later sessions, but I was
>> curious if anyone on the list has experience picking pedagogical
>> programming examples appropriate for twelve-year-olds' attention spans.
>> thanks,
>> 
>> Bob
>> 
> While it is not python per se, I suggest you have a look at GvR
> (Guido van Robot) (The app is written in Python but is too complicated
> for beginners).  It is hosted on sourceforge (gvr.sourceforge.net).
> It is a very interesting way (imho) to learn about programming, in
> a pythonic way.
> 
> (somewhat shameless plug follows:)
> A 'more advanced version' of GvR which uses the full Python syntax
> is RUR-PLE  (rur-ple.sourceforge.net).  The version currently hosted
> there does NOT work under Linux (untested on Mac).
> It uses wxPython 2.4 and will not work with 2.5.
> An updated release that will work under both Linux and Windows,
> and under both wxPython 2.4 and 2.5 will come out very soon, I hope.
> 
> I'm working on it :-)  I have two kids (ages 11 and 13) and plan to use
> rur-ple to teach them about programming.   Note that, even though
> I plan it to be suitable for motivated children (with some guidance),
> the end product (to be finished in a year?) is planned to be suitable
> for a complete first-year university computer science.
> 
> Andre Roberge

I started teaching my 11 year old first of all by doing silly stuff like -:
for i in range(10):
print "Silly me!"

Moving on to more useful stuff like times tables (which they have to learn
anyway).

After times tables, I plan to work on a simple number guessing game where
the computer picks a random number between 1 and 100 and asks the user to
take a guess.  This will help demonstrate many basic programming concepts.

Not sure how to introduce graphics though as so much is relatively abstract.

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


Re: Help with Threading

2005-01-24 Thread [EMAIL PROTECTED]
I use threading.Thread as outlined in this recipe:
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/65448

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


Re: finding name of instances created

2005-01-24 Thread Fredrik Lundh
Nick Coghlan wrote:

> Incidentally, this discussion made me realise the real reason why using a 
> lambda to create a named 
> function is evil:
>
> Py> def f(): pass
> ...
> Py> f.func_name
> 'f'
> Py> f = lambda: None
> Py> f.func_name
> ''
>
> I think I've heard that explanation before, but it never really clicked.

that's nothing you cannot fix, though:

>>> f = lambda: None
>>> f.func_name = "f"

>>> f.func_name
'f'

(only works in 2.4 and later, from what I can tell)

 



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


Re: short programming projects for kids

2005-01-24 Thread Steve Holden
Adrian Casey wrote:
André Roberge wrote:

bobdc wrote:
I will be teaching an "Introduction to Programming" class to some
middle school aged children and will be using Python, obviously. Does
anyone have suggestions for simple little programs to create and
analyze with them after I get past turtle graphics?
Turtle graphics will be plenty for the first session, and I will leave
time to ask them what they'd like to do in later sessions, but I was
curious if anyone on the list has experience picking pedagogical
programming examples appropriate for twelve-year-olds' attention spans.
thanks,
Bob
While it is not python per se, I suggest you have a look at GvR
(Guido van Robot) (The app is written in Python but is too complicated
for beginners).  It is hosted on sourceforge (gvr.sourceforge.net).
It is a very interesting way (imho) to learn about programming, in
a pythonic way.
(somewhat shameless plug follows:)
A 'more advanced version' of GvR which uses the full Python syntax
is RUR-PLE  (rur-ple.sourceforge.net).  The version currently hosted
there does NOT work under Linux (untested on Mac).
It uses wxPython 2.4 and will not work with 2.5.
An updated release that will work under both Linux and Windows,
and under both wxPython 2.4 and 2.5 will come out very soon, I hope.
I'm working on it :-)  I have two kids (ages 11 and 13) and plan to use
rur-ple to teach them about programming.   Note that, even though
I plan it to be suitable for motivated children (with some guidance),
the end product (to be finished in a year?) is planned to be suitable
for a complete first-year university computer science.
Andre Roberge

I started teaching my 11 year old first of all by doing silly stuff like -:
for i in range(10):
print "Silly me!"
Moving on to more useful stuff like times tables (which they have to learn
anyway).
After times tables, I plan to work on a simple number guessing game where
the computer picks a random number between 1 and 100 and asks the user to
take a guess.  This will help demonstrate many basic programming concepts.
Not sure how to introduce graphics though as so much is relatively abstract.
Have them type in guesses to make something hit a target that appears in 
a different position each time to introduce the notion of 2-D position, 
then you can talk about drawing lines between two positions, then the 
next thing you know they're writing algorithms to compute convex hulls 
(well, maybe not, but you probably get the idea).

regards
 Steve
--
Steve Holden   http://www.holdenweb.com/
Python Web Programming  http://pydish.holdenweb.com/
Holden Web LLC  +1 703 861 4237  +1 800 494 3119
--
http://mail.python.org/mailman/listinfo/python-list


Py2.4 .exe installer

2005-01-24 Thread Batista, Facundo
Title: Py2.4 .exe installer





I'm trying to get everybody at the office to become a Python programmer.


The bigger problem I'm facing is that the "official" operating system installed in the PCs is Win NT 4.0, tweaked and restricted, and it's impossible to install the Microsoft package that enables the .msi as a installer.

Result: they can not install Py24.msi.


There's somewhere a Py24.exe installer?


Thanks!


Facundo Batista
Desarrollo de Red
[EMAIL PROTECTED]
(54 11) 5130-4643
Cel: 15 5097 5024




  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

ADVERTENCIA.


La informaciÃn contenida en este mensaje y cualquier archivo anexo al mismo, son para uso exclusivo del destinatario y pueden contener informaciÃn confidencial o propietaria, cuya divulgaciÃn es sancionada por la ley.

Si Ud. No es uno de los destinatarios consignados o la persona responsable de hacer llegar este mensaje a los destinatarios consignados, no està autorizado a divulgar, copiar, distribuir o retener informaciÃn (o parte de ella) contenida en este mensaje. Por favor notifÃquenos respondiendo al remitente, borre el mensaje original y borre las copias (impresas o grabadas en cualquier medio magnÃtico) que pueda haber realizado del mismo.

Todas las opiniones contenidas en este mail son propias del autor del mensaje y no necesariamente coinciden con las de TelefÃnica Comunicaciones Personales S.A. o alguna empresa asociada.

Los mensajes electrÃnicos pueden ser alterados, motivo por el cual TelefÃnica Comunicaciones Personales S.A. no aceptarà ninguna obligaciÃn cualquiera sea el resultante de este mensaje.

Muchas Gracias.



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

Re: Py2.4 .exe installer

2005-01-24 Thread Fredrik Lundh
Facundo Batista:

> The bigger problem I'm facing is that the "official" operating system
> installed in the PCs is Win NT 4.0, tweaked and restricted, and it's
> impossible to install the Microsoft package that enables the .msi as a
> installer.
>
> Result: they can not install Py24.msi.
>
> There's somewhere a Py24.exe installer?

you could of course install it on a W2K or WXP box, and zip it up (don't
forget the python24.dll under /windows/system32; you can copy it to the
\python24 directory before zipping it all).  copy, unzip, and you're done.

if you need to register the interpreter on the target machine (so you can 
install
extensions), use this little script:

http://effbot.org/zone/python-register.htm

 



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


Re: delay and force in Python

2005-01-24 Thread Peter Otten
Nick Coghlan wrote:

>> Py> print islice((x for x in xrange(1, 996) if x % 2 == 0), 1, 2).next()
>> 4
> 
> Wouldn't it be nice if this could be spelt:
> 
> print (x for x in xrange(1, 996) if x % 2 == 0)[2]
> 
> Well, I just put a patch on SF to enable exactly that:
> http://www.python.org/sf/1108272
 
I like it. Of course you always have to bear in mind that one giant leap for
a list could be _many_ small steps for an iterator.

Peter

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


Re: short programming projects for kids

2005-01-24 Thread Duncan Booth
bobdc wrote:

> I will be teaching an "Introduction to Programming" class to some
> middle school aged children and will be using Python, obviously. Does
> anyone have suggestions for simple little programs to create and
> analyze with them after I get past turtle graphics?
> 
> Turtle graphics will be plenty for the first session, and I will leave
> time to ask them what they'd like to do in later sessions, but I was
> curious if anyone on the list has experience picking pedagogical
> programming examples appropriate for twelve-year-olds' attention spans.
> thanks,
> 
Have you looked at http://www.livewires.org.uk/python/ ?
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: wx.BoxSizer problem

2005-01-24 Thread Laszlo Zsolt Nagy

My problem is that only one of the buttons is visible and that one is 
not expanded. (System: Windows, Python 2.3.4, wxPython 2.5.3)

Works as expected on Mac OS X 10.3.7, python 2.3.4, wxPython 2.5.2.8.
Thanks. Probably the problem is with my bitmap (I used a bitmap instead 
of a button).
Please do not spend more time on it - I'll handle.
Best,

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


Re: Weakref.ref callbacks and eliminating __del__ methods

2005-01-24 Thread Richie Hindle

[Tim]
> I'll note that one fairly obvious pattern works very well for weakrefs
> and __del__ methods (mutatis mutandis):  don't put the __del__ method
> in self, put it in a dead-simple object hanging *off* of self.  Like
> the simple:
> 
> class BTreeCloser:
> def __init__(self, btree):
> self.btree = btree
> 
> def __del__(self):
> if self.btree:
> self.btree.close()
> self.btree = None
> 
> Then give self an attribute refererring to a BTreeCloser instance, and
> keep self's class free of a __del__ method.  The operational
> definition of "dead simple" is "may or may not be reachable only from
> cycles, but is never itself part of a cycle".

This is very nice - I've been wondering about just this problem recently,
and this will be very useful.  Many thanks!

One question: why the `self.btree = None` in the last line?  Isn't
`self.btree` guaranteed to go away at this point anyway?  (If the answer
is "it's necessary for weird cases that would take an hour to explain"
then I'll be more than happy to simply use it.  8-)

-- 
Richie Hindle
[EMAIL PROTECTED]

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


Re: Classical FP problem in python : Hamming problem

2005-01-24 Thread Francis Girard
Ok, I think that the bottom line is this :

For all the algorithms that run after their tail in an FP way, like the 
Hamming problem, or the Fibonacci sequence, (but unlike Sieve of Eratosthene 
-- there's a subtle difference), i.e. all those algorithms that typically 
rely upon recursion to get the beginning of the generated elements in order 
to generate the next one ...

... so for this family of algorithms, we have, somehow, to abandon recursion, 
and to explicitely maintain one or many lists of what had been generated.

One solution for this is suggested in "test_generators.py". But I think that 
this solution is evil as it looks like recursion is used but it is not and it 
depends heavily on how the m235 function (for example) is invoked. 
Furthermore, it is _NOT_ memory efficient as pretended : it leaks ! It 
internally maintains a lists of generated results that grows forever while it 
is useless to maintain results that had been "consumed". Just for a gross 
estimate, on my system, percentage of memory usage for this program grows 
rapidly, reaching 21.6 % after 5 minutes. CPU usage varies between 31%-36%.
Ugly and inefficient.

The solution of Jeff Epler is far more elegant. The "itertools.tee" function 
does just what we want. It internally maintain a list of what had been 
generated and deletes the "consumed" elements as the algo unrolls. To follow 
with my gross estimate, memory usage grows from 1.2% to 1.9% after 5 minutes 
(probably only affected by the growing size of Huge Integer). CPU usage 
varies between 27%-29%.
Beautiful and effecient.

You might think that we shouldn't be that fussy about memory usage on 
generating 100 digits numbers but we're talking about a whole family of 
useful FP algorithms ; and the best way to implement them should be 
established.

For this family of algorithms, itertools.tee is the way to go.

I think that the semi-tutorial in "test_generators.py" should be updated to 
use "tee". Or, at least, a severe warning comment should be written.

Thank you,

Francis Girard
FRANCE

Le dimanche 23 Janvier 2005 23:27, Jeff Epler a ÃcritÂ:
> Your formulation in Python is recursive (hamming calls hamming()) and I
> think that's why your program gives up fairly early.
>
> Instead, use itertools.tee() [new in Python 2.4, or search the internet
> for an implementation that works in 2.3] to give a copy of the output
> sequence to each "multiply by N" function as well as one to be the
> return value.
>
> Here's my implementation, which matched your list early on but
> effortlessly reached larger values.  One large value it printed was
> 6412351813189632 (a Python long) which indeed has only the distinct
> prime factors 2 and 3. (2**43 * 3**6)
>
> Jeff
>
> from itertools import tee
> import sys
>
> def imerge(xs, ys):
> x = xs.next()
> y = ys.next()
> while True:
> if x == y:
> yield x
> x = xs.next()
> y = ys.next()
> elif x < y:
> yield x
> x = xs.next()
> else:
> yield y
> y = ys.next()
>
> def hamming():
> def _hamming(j, k):
> yield 1
> hamming = generators[j]
> for i in hamming:
> yield i * k
> generators = []
> generator = imerge(imerge(_hamming(0, 2), _hamming(1, 3)), _hamming(2,
> 5)) generators[:] = tee(generator, 4)
> return generators[3]
>
> for i in hamming():
> print i,
> sys.stdout.flush()

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


RE: on the way to find pi!

2005-01-24 Thread Batista, Facundo
Title: RE: on the way to find pi!





[Fredrik Lundh]


#- what's the point of that?  the math module already contains 
#- pi with as many
#- decimals as you can put in a Python float:
#- 
#- $ python
#- >>> pi = 3.1415926535897932384
#- >>> pi
#- 3.1415926535897931
#- >>> import math
#- >>> math.pi
#- 3.1415926535897931
#- >>> pi = math.pi
#- True


And if you want to go beyond that, check http://www.python.org/dev/doc/devel/lib/decimal-recipes.html


>>> from decimal import *
>>> getcontext().prec = 60
>>> pi()
Decimal("3.14159265358979323846264338327950288419716939937510582097494")
>>> 


.    Facundo


Bitácora De Vuelo: http://www.taniquetil.com.ar/plog
PyAr - Python Argentina: http://pyar.decode.com.ar/



  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

ADVERTENCIA.


La información contenida en este mensaje y cualquier archivo anexo al mismo, son para uso exclusivo del destinatario y pueden contener información confidencial o propietaria, cuya divulgación es sancionada por la ley.

Si Ud. No es uno de los destinatarios consignados o la persona responsable de hacer llegar este mensaje a los destinatarios consignados, no está autorizado a divulgar, copiar, distribuir o retener información (o parte de ella) contenida en este mensaje. Por favor notifíquenos respondiendo al remitente, borre el mensaje original y borre las copias (impresas o grabadas en cualquier medio magnético) que pueda haber realizado del mismo.

Todas las opiniones contenidas en este mail son propias del autor del mensaje y no necesariamente coinciden con las de Telefónica Comunicaciones Personales S.A. o alguna empresa asociada.

Los mensajes electrónicos pueden ser alterados, motivo por el cual Telefónica Comunicaciones Personales S.A. no aceptará ninguna obligación cualquiera sea el resultante de este mensaje.

Muchas Gracias.



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

Re: finding name of instances created

2005-01-24 Thread Ryan Paul
On Mon, 24 Jan 2005 13:19:45 +, Ryan Paul wrote:

> 
> A working solution:
> 
> class A:
>   pass
> 
> a = A()
> b = A()
> c = A()
> 
> [x for x,y in locals().items() if
>   hasattr(y,"__class__") and y.__class__ == A]
> 

Just wanted to clarify, because I know that the intellectually deficient
amongst you will say that isinstance is better than using __class__...

In this case isinstance isnt desirable because it will catch
instances of any objects that inherit A, not just instances of A. Observe:

class A: pass
class B(A): pass

a = A()
b = A()
c = A()
d = B()

>>> [x for x,y in locals().items() if isinstance(y,A)]
['a', 'c', 'b', 'd']

>>> [x for x,y in locals().items() if
... hasattr(y,"__class__") and y.__class__ == A]
['a', 'c', 'b']

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


Re: finding name of instances created

2005-01-24 Thread Antoon Pardon
Op 2005-01-24, Nick Coghlan schreef <[EMAIL PROTECTED]>:
> Steven Bethard wrote:
>> That is, you can just keep track of all the names of a Robot in the 
>> Robot object.  In the simple case, where there's only one name, you can 
>> display it as such.  In the more complicated case, where there's some 
>> aliasing, you can display the multiple aliases.  This means you don't 
>> have to teach about aliasing right off the bat, but if a student 
>> accidentally discovers it on their own, the machinery's there to explain 
>> it...
>
> Incidentally, this discussion made me realise the real reason why using a 
> lambda 
> to create a named function is evil:

It is not a named function, it is just a lamda that is assigned to a
name.
>
> Py> def f(): pass
> ...
> Py> f.func_name
> 'f'
> Py> f = lambda: None
> Py> f.func_name
> ''
>
> I think I've heard that explanation before, but it never really clicked.

I just don't see what is so evil about it.

Why is it so trouble some that a function wouldn't have a name, while
most objects don't have a name. Why is it a problem doing something
like:

   f = lambda: None

But isn't it a problem doing something like

   v = None.


Why don't we demand something like

   Py> assign v: None
   Py> v.obj_name
   'v'

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


Re: short programming projects for kids

2005-01-24 Thread [EMAIL PROTECTED]
I was just about to suggest Livewires. I'm a programming newb (35 yrs
old ) haha- and I'm finding the lIvewires course pretty helpful, even
though it's geared for teens. I suppose my brain works on that
functional level.  :) And a book that's great for beginner's (know you
probably don't want to buy books but just wanted to throw this info out
there in case it helps somehow) is Python Programming for the Absolute
Beginner by Michael Dawson. I'm working through that too and it's
wonderful. It had many fairly simple to implement programs (lots of
them simple games) that build on each other in a very easily
comprehended, step-by-step manner. 
Hope htis helps-

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


Re: Zen of Python

2005-01-24 Thread Aahz
In article <[EMAIL PROTECTED]>,
Tim Peters  <[EMAIL PROTECTED]> wrote:
>[Paul Rubin]
>> 
>> And you can break out of a containing loop from a nested loop
>> with try/raise.
>
>Heh heh.  Yes, you can.  I've never seen a real Python program that
>did, but there's nothing to stop you.  What did you think the "direct"
>in "direct way" might have been intended to mean?

Actually, I like breaking out of nested "search" loops with try/except.
-- 
Aahz ([EMAIL PROTECTED])   <*> http://www.pythoncraft.com/

"19. A language that doesn't affect the way you think about programming,
is not worth knowing."  --Alan Perlis
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: finding name of instances created

2005-01-24 Thread André

Ryan Paul wrote:
> On Mon, 24 Jan 2005 13:19:45 +, Ryan Paul wrote:
>
> >
> > A working solution:
> >
> > class A:
> >   pass
> >
> > a = A()
> > b = A()
> > c = A()
> >
> > [x for x,y in locals().items() if
> >   hasattr(y,"__class__") and y.__class__ == A]
> >
>
> Just wanted to clarify, because I know that the intellectually
deficient
> amongst you will say that isinstance is better than using
__class__...
>
> In this case isinstance isnt desirable because it will catch
> instances of any objects that inherit A, not just instances of A.
Observe:
>
> class A: pass
> class B(A): pass
>
> a = A()
> b = A()
> c = A()
> d = B()
>
> >>> [x for x,y in locals().items() if isinstance(y,A)]
> ['a', 'c', 'b', 'd']
>
> >>> [x for x,y in locals().items() if
> ... hasattr(y,"__class__") and y.__class__ == A]
> ['a', 'c', 'b']

Actually, it this case, isinstance *is* desirable (or rather *would
have been*), exactly for the reason that you point out.  After teaching
about objects, one of the next subject would be that of inheritance.
E.G.

class BetterRobot(Robot):
...  # create a robot that can turn right directly...

However, I have been convinced that it would be much truer to Python to
give the robot fake names (robot1, robot2, ...), and then have students
name their own robots through declarations like:

cleese = Robot(name="Cleese")

or
cleese = Robot()
cleese.name = "Cleese"
=
André
> 
> -- SegPhault

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


Re: compile python to binary

2005-01-24 Thread Peter Hansen
sam wrote:
Peter Hansen wrote:
After all, source code is stored in binary too...
Sorry for the vagues terms. I meant compile a python script into a 
binary program.
As I said, "binary" is a very ambiguous term, so your
clarification by itself wouldn't have helped.  (That is,
while the defined meaning is fairly precise, many people
use "binary" to mean something different.)
Anyway, the phrase you were actually looking for is
"stand-alone executable".  That's what py2exe and the
like produce, and that's what distinguishes what you want
from, for example, what some suggested in the first place.
(In a Windows-only environment, asking "how do I create
an EXE" would pretty much mean the same thing.)
-Peter
--
http://mail.python.org/mailman/listinfo/python-list


Re: Memory Usage

2005-01-24 Thread Peter Hansen
rbt wrote:
Would a Python process consume more memory on a PC with lots of memory?
For example, say I have the same Python script running on two WinXP 
computers that both have Python 2.4.0. One computer has 256 MB of Ram 
while the other has 2 GB of Ram. On the machine with less Ram, the 
process takes about 1 MB of Ram. On the machine with more Ram, it uses 9 
MB of Ram.

Is this normal and expected behavior?
It's probably not normal if this is *really* the memory usage, but
I would expect to see such behaviour, given how difficult it is
to measure *actual* memory usage.  How are you measuring it?
Just by looking at the Mem Usage column in the Task Manager?
-Peter
--
http://mail.python.org/mailman/listinfo/python-list


Re: is there better 32 clock() timing?

2005-01-24 Thread Claudio Grondi
On my 2.8GHz P4, Windows 2000 SP4 with Python 2.3.4 I am getting
totally different results compared to Ray. Does Python 2.3.4 already
use the Pentium RTDSC instruction for clock()?

Claudio
# \>  Claudio Grondi, 2.8GHz P4 Python 2.3.4 (2005-01-24 14:32)
# time of taking time:
#   0.01396825574200073100
#   0.01676190689040086400
#   0.01396825574200074000
#   0.01676190689040088100
#   0.0195803880100500
#   0.01620317666072084300 (average)
# statistics of 1.000.000 times of taking time in a while loop:
#   0.01396825573429794100 (min)
#   0.00237069236453235630 (max)
#   0.01598858514140937100 (avg)
# >>> Ray Schumacher, 2.4GHz P4 Python 2.3.3 (#51, Dec 18 2003, 20:22:39)
[MSC v.1200 32 bit (Intel)] on win32
#  0.000321028401686
#  0.00030348379596
#  0.000297101358228
#  0.000295895991258
#  0.000342754564927 (average)

Here my code:
# Tests show, that the first call takes longer than subsequent calls,
# so it makes sense to run  t = clock() just one time before the next calls
# are used:
t  = clock()
t0 = clock()
t1 = clock()
t2 = clock()
t3 = clock()
t4 = clock()
t5 = clock()
print 'time of taking time: '
print '  %25.24f'%((t1-t0),)
print '  %25.24f'%((t2-t1),)
print '  %25.24f'%((t3-t2),)
print '  %25.24f'%((t4-t3),)
print '  %25.24f'%((t5-t4),)
print '  %25.24f (average)'%( ((-t0+t5)/5.),)
intCounter=100
fltTotTimeOfTakingTime = 0.0
fltMaxTimeOfTakingTime   = 0.0
fltMinTimeOfTakingTime   = 1.0
while(intCounter > 0):
  t1 = clock()
  t2 = clock()
  timeDiff = t2-t1
  if(timeDiff < fltMinTimeOfTakingTime): fltMinTimeOfTakingTime = timeDiff
  if(timeDiff > fltMaxTimeOfTakingTime): fltMaxTimeOfTakingTime = timeDiff
  fltTotTimeOfTakingTime+=timeDiff
  intCounter-=1
#:while
fltAvgTimeOfTakingTime = fltTotTimeOfTakingTime / 100.0
print 'statistics of 1.000.000 times of taking time in a while loop:'
print '  %25.24f (min)'%(fltMinTimeOfTakingTime,)
print '  %25.24f (max)'%(fltMaxTimeOfTakingTime,)
print '  %25.24f (avg)'%(fltAvgTimeOfTakingTime,)

"Ray Schumacher" <[EMAIL PROTECTED]> schrieb im Newsbeitrag
news:[EMAIL PROTECTED]
> I have a need for a time.clock() with >0.16 second (16us) accuracy.
> The sleep() (on Python 2.3, Win32, at least) has a .001s limit.
>
> Are they lower/better on other's platforms?
>
> Test code, 2.4GHz P4
> Python 2.3.3 (#51, Dec 18 2003, 20:22:39) [MSC v.1200 32 bit (Intel)] on
win32
>
> import time
> t0 = time.clock()
> t1 = time.clock()
> t2 = time.clock()
> t3 = time.clock()
> t4 = time.clock()
> t5 = time.clock()
> print (-t0+t5)/5.
> print t1-t0
> print t2-t1
> print t3-t2
> print t4-t3
> print t5-t4
>
> >>>
> ave 0.000342754564927
> 0.000321028401686
> 0.00030348379596
> 0.000297101358228
> 0.000295895991258
>
> I had also considered forking a thread that would spin a loop checking
time.clock() and firing the TTL pulse after the appropriate interval, but
the real, ultimate resolution of time.clock() appears to be ~.00035s. If I
increase process priority to real-time, it is ~.00028s
> The alternative appears to be more C code...
>
> Ray
> BCI/Congitive Vision
>
"Paul Rubin"  schrieb im Newsbeitrag
news:[EMAIL PROTECTED]
> Ray Schumacher <[EMAIL PROTECTED]> writes:
> > I have a need for a time.clock() with >0.16 second (16us) accuracy.
> > The sleep() (on Python 2.3, Win32, at least) has a .001s limit.
> >
> > Are they lower/better on other's platforms?
> >
> > The alternative appears to be more C code...
>
> C code is your best bet.  The highest resolution timer on x86's these
> days is the Pentium RTDSC instruction which counts the number of cpu
> cycles since power-on.  There's various C routines floating around
> that let you access that instruction.


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


RE: Help on project, anyone?

2005-01-24 Thread Batista, Facundo
Title: RE: Help on project, anyone?





[Georg Brandl]


#- Does anyone run, or participate in, a project looking for fellow
#- programmers? I don't have a special area of interest, well, 
#- perhaps web
#- programming...


You can join us in SiGeFi: http://sf.net/projects/sigefi


---


SiGeFi is a Financial Management System, with focus in the needs of
the administration of the money in each personal life and house.


Always keeping the easy usage and concepts, SiGeFi has features of a 
complex Management system:


- Complies with Double Entry Accounting


- Has a Budget-based Money Distribution system


- Allow to make Loans between accounts (with associated financial
  costs)


---


Any doubt, contact us through sigefi-list or to me personally.


Regards,


.    Facundo


Bitácora De Vuelo: http://www.taniquetil.com.ar/plog
PyAr - Python Argentina: http://pyar.decode.com.ar/



  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

ADVERTENCIA.


La información contenida en este mensaje y cualquier archivo anexo al mismo, son para uso exclusivo del destinatario y pueden contener información confidencial o propietaria, cuya divulgación es sancionada por la ley.

Si Ud. No es uno de los destinatarios consignados o la persona responsable de hacer llegar este mensaje a los destinatarios consignados, no está autorizado a divulgar, copiar, distribuir o retener información (o parte de ella) contenida en este mensaje. Por favor notifíquenos respondiendo al remitente, borre el mensaje original y borre las copias (impresas o grabadas en cualquier medio magnético) que pueda haber realizado del mismo.

Todas las opiniones contenidas en este mail son propias del autor del mensaje y no necesariamente coinciden con las de Telefónica Comunicaciones Personales S.A. o alguna empresa asociada.

Los mensajes electrónicos pueden ser alterados, motivo por el cual Telefónica Comunicaciones Personales S.A. no aceptará ninguna obligación cualquiera sea el resultante de este mensaje.

Muchas Gracias.



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

TCP server

2005-01-24 Thread assaf
i am try to create a server
what am i suppose to send to SocketServer.TCPServer
what is the client_address ("127.0.0.1:80" ?)
and BaseRequestHandler = ?

thanks

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


Re: [OT] XML design intent ... further musings

2005-01-24 Thread Istvan Albert
Paul Rubin wrote:

I love this old rant about XML:
http://groups-beta.google.com/group/comp.lang.lisp/msg/9a30c508201627ee
This is my favorite:
http://weblog.burningbird.net/archives/2002/10/08/the-parable-of-the-languages
"I’m considered the savior, the ultimate solution, the final word.
Odes are written to me, flowers strewn at my feet, virgins sacrificed at
my altar. Programmers speak my name with awe. Companies insist on using
me in all their projects, though they’re not sure why. And whenever a
problem occurs, someone somewhere says, “Let’s use XML", and miracles
occur and my very name has become a talisman against evil. And yet, all
I am is a simple little markup, from humble origins.
It’s a burden, being XML."
--
http://mail.python.org/mailman/listinfo/python-list


Re: finding name of instances created

2005-01-24 Thread Ryan Paul
On Fri, 21 Jan 2005 16:13:19 -0800, André wrote:

> Short version of what I am looking for:
> 
> Given a class "public_class" which is instantiated a few times e.g.
> 
> a = public_class()
> b = public_class()
> c = public_class()
> 
> I would like to find out the name of the instances so that I could
> create a list of them e.g.
> ['a', 'b', 'c']
> 


A working solution:

class A:
  pass

a = A()
b = A()
c = A()

[x for x,y in locals().items() if
  hasattr(y,"__class__") and y.__class__ == A]

That said, you probably dont want to do it. I doubt that it will work
consistently.

BTW, based on my understanding of the other stuff you said, this is
probably not the best way to do whatever it is you are trying to do.

--SegPhault




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


Re: Py2.4 .exe installer

2005-01-24 Thread Fuzzyman
I built Movable Python for use on a windows box where I didn't have
admin rights.

See :

http://sourceforge.net/projects/movpy
Regards,

Fuzzy
http://www.voidspace.org.uk/python/index.shtml

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


Memory Usage

2005-01-24 Thread rbt
Would a Python process consume more memory on a PC with lots of memory?
For example, say I have the same Python script running on two WinXP 
computers that both have Python 2.4.0. One computer has 256 MB of Ram 
while the other has 2 GB of Ram. On the machine with less Ram, the 
process takes about 1 MB of Ram. On the machine with more Ram, it uses 9 
MB of Ram.

Is this normal and expected behavior?
Thanks,
rbt
--
http://mail.python.org/mailman/listinfo/python-list


Python curses wizard

2005-01-24 Thread Damjan
Is there some tool that can help me design a simple curses wizards,
preferably one that uses Python, but if there's some other sollution I'd be
happy to hear. The important requirement is that its curses based (or
similar text based UI).


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


Re: What YAML engine do you use?

2005-01-24 Thread Istvan Albert
rm wrote:
http://www.theinquirer.net/?article=20868 :-)
There's a lot of nonsense out there propagated by people who do not
understand XML. You can't possibly blame that on XML...
For me XSLT transformations are the main reason for using XML.
If I have an XML document I can turn it into other
formats with a few lines of code. Most importantly these
are much safer to run than a program.
I think of an XML document as a "mini-database" where one
can easily and efficiently access content via XPath. So there
is a lot more to XML than just markup and that's
why YAML vs XML comparisons make very little sense.
Istvan.
--
http://mail.python.org/mailman/listinfo/python-list


[perl-python] 20050124 classes & objects

2005-01-24 Thread Xah Lee
© # -*- coding: utf-8 -*-
© # Python
©
© # in Python, one can define a boxed set
© # of data and functions, which are
© # traditionally known as "class".
©
© # in the following, we define a set of data
© # and functions as a class, and name it xxx
© class xxx:
© "a class extempore! (^_^)"
© i=1 # i'm a piece of data
© def okaydokey(self): return "okaydokey"
© def square(self,a): return a**a
©
© # in the following,
© # we create an object, of the class xxx.
© # also known as "instantiate a class".
© x = xxx()
©
© # data or functions defined in a class
© # are called the class's attributes or
© # methods.
© # to use them, append a dot and
© # their name after the object's name.
© print 'value of attribute i is:', x.i
© print "3 squared is:", x.square(3)
© print "okaydokey called:", x.okaydokey()
©
© # in the definition of function inside a
© # class, the first parameter "self" is
© # necessary. (you'll know why when you need to)
©
© # the first line in the class definition
© # is the class's documentation. It can
© # be accessed thru the __doc__
© # attribute.
© print "xxx's doc string is:", x.__doc__
©
© # one can change data inside the class
© x.i = 400
©
© # one can also add new data to the class
© x.j=4
© print x.j
©
© # or even override a method
© x.square = 333
© # (the following line will no longer work)
© # print "3 squared is:", x.square(3)
©
© # in Python, one must be careful not to
© # overwrite data or methods defined in a
© # class.

--

for a obfuscated treatment with a few
extra info, see
http://python.org/doc/2.3.4/tut/node11.html

in Python terminal, type help() then
topic CLASSES to read about existing
datatypes as classes, and classes in
Python

try to write a class with one data of
integer and two functions, one
increases it by 1, one decreases it by
1.  note: inside a class definition,
to refer to data inside itself use
self. e.g. self.i

--
Perl does not support classes or
objects in the so-called "Object
Oriented" programing. However, a
complete set of emulations of OO
style of programing have been done,
resulting in modules and books and
many documentations and tutorials.

here is a quote from
perldoc perlobj

First you need to understand what
references are in Perl. See perlref for
that. Second, if you still find the
following reference work too
complicated, a tutorial on
object-oriented programming in Perl can
be found in perltoot and perltooc.

it goes on and sayz:

If you're still with us, then here are
three very simple definitions that you
should find reassuring.

1.  An object is simply a reference
that happens to know which class
it belongs to.

2.  A class is simply a package that
happens to provide methods to deal
with object references.

3.  A method is simply a subroutine
that expects an object reference
(or a package name, for class
methods) as the first argument.

Good luck.


Note: this post is from the Perl-Python a-day mailing list at
http://groups.yahoo.com/group/perl-python/
to subscribe, send an email to perl-python-subscribe @ yahoogroups.com
if you are reading it on a web page, program examples may not run
because html conversion often breaks the code.
Xah
 [EMAIL PROTECTED]
 http://xahlee.org/PageTwo_dir/more.html

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


Re: TCP server

2005-01-24 Thread Pedro Werneck

A quick example for you:

###
import SocketServer


class EchoRequestHandler(SocketServer.BaseRequestHandler):
def setup(self):
print self.client_address, 'connected!'
self.request.send('hi ' +  str(self.client_address) + '\n')

def handle(self):
while 1:
data = self.request.recv(1024)
self.request.send(data)
if data.strip() == 'bye':
return

def finish(self):
print self.client_address, 'disconnected!'
self.request.send('bye ' +  str(self.client_address) + '\n')

#server host is a tuple ('host', port)
server = SocketServer.ThreadingTCPServer(('', 5000), EchoRequestHandler)
server.serve_forever()

###

Telnet to localhost 5000 and any data you sent will be echoed back to you... 
send 'bye' and the connection is closed




On 24 Jan 2005 06:25:18 -0800
"assaf" <[EMAIL PROTECTED]> wrote:

> i am try to create a server
> what am i suppose to send to SocketServer.TCPServer
> what is the client_address ("127.0.0.1:80" ?)
> and BaseRequestHandler = ?
> 
> thanks
> 
> -- 
> http://mail.python.org/mailman/listinfo/python-list
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: What is print? A function?

2005-01-24 Thread david . tolpin

> Is it possible to create own statements, such that it would be
possible to do:
>
> printDebug "test"
>
> ?
This question is well addressed in a neighbour group comp.lang.lisp .

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


Re: What YAML engine do you use?

2005-01-24 Thread Sion Arrowsmith
Paul Rubin   wrote:
>YAML looks to me to be completely insane, even compared to Python
>lists.  I think it would be great if the Python library exposed an
>interface for parsing constant list and dict expressions, e.g.:
>   [1, 2, 'Joe Smith', 8237972883334L,   # comment
>  {'Favorite fruits': ['apple', 'banana', 'pear']},  # another comment
>  'xyzzy', [3, 5, [3.14159, 2.71828, [
> [ ... ]
>Note that all the values in the above have to be constant literals.
>Don't suggest using eval.  That would be a huge security hole.

I'm probably not thinking deviously enough here, but how are you
going to exploit an eval() which has very tightly controlled
globals and locals (eg. eval(x, {"__builtins__": None}, {}) ?

-- 
\S -- [EMAIL PROTECTED] -- http://www.chaos.org.uk/~sion/
  ___  |  "Frankly I have no feelings towards penguins one way or the other"
  \X/  |-- Arthur C. Clarke
   her nu becomeþ se bera eadward ofdun hlæddre heafdes bæce bump bump bump
-- 
http://mail.python.org/mailman/listinfo/python-list


¤Ñ¤ô³ò¤Ñ´I­bA®y¤K¦Ê¤Ø³æ¦ì©Ð¶¡¤À¯²..............................................................................................................................................................................................................................................................................................

2005-01-24 Thread noreplyemail
[EMAIL PROTECTED]
´N¦b¹|´I°Ó³õ³ÄÃä
ªþªñ¥æ³qª½³q¦U­«­n¦a°Ï
»´ÅK¦èÅK¥þ³¡´N¸}

[EMAIL PROTECTED]
[EMAIL PROTECTED]
©Ð¶¡¦³§N®ð¾÷
[EMAIL PROTECTED]
¥þ«Î­±¿n¬ù¤C¦Ê¤Ø,©Ð¶¡¬ù80¤Ø
¹q±èª½¨ì¤G¤Q¤C¼Ó

¥u­­³æ¨­¤H¥K,¥¿·í¤H®a,
¤£©â·Ï,¤£¶¼°s,µL¤£¨}”ܦnªÌ

¥»¤H³æ¨­,[EMAIL PROTECTED]

¦³·N½Ð¹q¶l±zªº­Ó¤H¸ê®Æ¥]¬A ©Ê§O/¦~ÄÖ/¾·~
¨ì : [EMAIL PROTECTED]
¸ê®Æ¤£·|®¤¤£¦^ÂÐ.

»P¥»¤HÁpµ¸..
.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Memory Usage

2005-01-24 Thread rbt
Peter Hansen wrote:
rbt wrote:
Would a Python process consume more memory on a PC with lots of memory?
For example, say I have the same Python script running on two WinXP 
computers that both have Python 2.4.0. One computer has 256 MB of Ram 
while the other has 2 GB of Ram. On the machine with less Ram, the 
process takes about 1 MB of Ram. On the machine with more Ram, it uses 
9 MB of Ram.

Is this normal and expected behavior?

It's probably not normal if this is *really* the memory usage, but
I would expect to see such behaviour, given how difficult it is
to measure *actual* memory usage.  How are you measuring it?
Just by looking at the Mem Usage column in the Task Manager?
-Peter
That's right. I look at that column. Should I measue mem usage in some 
other way?
--
http://mail.python.org/mailman/listinfo/python-list


Re: What YAML engine do you use?

2005-01-24 Thread Doug Holton
rm wrote:
Doug Holton wrote:
rm wrote:
this implementation of their idea. But I'd love to see a generic, 
pythonic data format.

That's a good idea.  But really Python is already close to that.  A 
lot of times it is easier to just write out a python dictionary than 
using a DB or XML or whatever.  Python is already close to YAML in 
some ways. 
true, it's easy enough to separate the data from the functionality in 
python by putting the data in a dictionary/list/tuple, but it stays 
source code.
Check out JSON, an alternative to XML for data interchange.  It is 
basically just python dictionaries and lists:
http://www.crockford.com/JSON/example.html

I think I would like this better than YAML or XML, and it looks like it 
already parses as valid Python code, except for the /* */ multiline 
comments (which boo supports).

It was mentioned in a story about JSON-RPC-Java:
http://developers.slashdot.org/article.pl?sid=05/01/24/125236
--
http://mail.python.org/mailman/listinfo/python-list


Re: Weakref.ref callbacks and eliminating __del__ methods

2005-01-24 Thread Mike C. Fletcher
Richie Hindle wrote:
[Tim]
 

I'll note that one fairly obvious pattern works very well for weakrefs
and __del__ methods (mutatis mutandis):  don't put the __del__ method
in self, put it in a dead-simple object hanging *off* of self.  Like
the simple:
class BTreeCloser:
   def __init__(self, btree):
   self.btree = btree
   def __del__(self):
   if self.btree:
   self.btree.close()
   self.btree = None
Then give self an attribute refererring to a BTreeCloser instance, and
keep self's class free of a __del__ method.  The operational
definition of "dead simple" is "may or may not be reachable only from
cycles, but is never itself part of a cycle".
   

This is very nice - I've been wondering about just this problem recently,
and this will be very useful.  Many thanks!
 

From me too :)
One question: why the `self.btree = None` in the last line?  Isn't
`self.btree` guaranteed to go away at this point anyway?  (If the answer
is "it's necessary for weird cases that would take an hour to explain"
then I'll be more than happy to simply use it.  8-)
 

It's to allow the Closer object to act as a substitute for a .close() 
method on the object, the final full code of the Closer looks like this:

class Closer( object ):
   """Close the OIDStore"""
   def __init__( self, client ):
   """Initialise the closer object"""
   self.btree = client.btree
   def __call__( self ):
   """Close and cleanup to prevent multiple calls"""
   if self.btree:
   self.btree.close()
   self.btree = None
   def __del__( self ):
   """Handle deletion of the closer object (close btree if 
necessary)"""
   self()

and we store one of these as self.close in the OIDStore instance' 
dictionary.

   self.close = Closer( self )
If the user explicitly calls storage.close() we don't want the __del__ 
trying to re-close the storage later.  In other words, its an explicit 
requirement for *this* __del__, not a general requirement.

Have fun,
Mike

 Mike C. Fletcher
 Designer, VR Plumber, Coder
 http://www.vrplumber.com
 http://blog.vrplumber.com
--
http://mail.python.org/mailman/listinfo/python-list


Re: What is print? A function?

2005-01-24 Thread Sion Arrowsmith
Michael Hoffman  <[EMAIL PROTECTED]> wrote:
>Frans Englich wrote:
>> Nah, I don't think it's a function, but rather a builtin "statement". But 
>> it's 
>> possible to invoke it as an function; print( "test" ) works fine.
>That is not invoking it as a function. The parentheses are only for 
>ordering the expression on the right
>
>You can do this too:
>
> >>> print("abc"),("def"),("ghi")
>abc def ghi

And for further enlightenment:

.>>> print("abc", "def", "ghi")
('abc', 'def', 'ghi')

-- 
\S -- [EMAIL PROTECTED] -- http://www.chaos.org.uk/~sion/
  ___  |  "Frankly I have no feelings towards penguins one way or the other"
  \X/  |-- Arthur C. Clarke
   her nu becomeþ se bera eadward ofdun hlæddre heafdes bæce bump bump bump
-- 
http://mail.python.org/mailman/listinfo/python-list


urllib2 and proxy question

2005-01-24 Thread Fuzzyman
urllib2 (under windows) will auto-detect your proxy settings and use
those.

Normally that's a good thing (I guess), except when it's not !

How do I switch off this behaviour ? I'm behind a censoring proxy and
wanting to test things *locally*. IE is set to not use the proxy when
fetching local adresses, but urllib2 ignores that part of the setting
and uses the proxy for everything.

The only way I can test are changing my IE settings back and forth
every time. Most annoying.

I can see how to *add* a new proxy to urllib2, but not how to force it
to not use a proxy. I may well be missing something obvious though.
Anyone able to help ?
Regards,

Fuzzy
http://www.voidspace.org.uk/python/index.shtml

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


Re: Classical FP problem in python : Hamming problem

2005-01-24 Thread Francis Girard
The following implementation is even more speaking as it makes self-evident 
and almost mechanical how to translate algorithms that run after their tail 
from recursion to "tee" usage :

*** BEGIN SNAP
from itertools import tee, imap
import sys

def imerge(xs, ys):
  x = xs.next()
  y = ys.next()
  while True:
if x == y:
  yield x
  x = xs.next()
  y = ys.next()
elif x < y:
  yield x
  x = xs.next()
else:
  yield y
  y = ys.next()

  
def hamming():
  def _hamming():
yield 1
hamming2 = hammingGenerators[0]
hamming3 = hammingGenerators[1]
hamming5 = hammingGenerators[2]
for n in imerge(imap(lambda h: 2*h, iter(hamming2)),
imerge(imap(lambda h: 3*h, iter(hamming3)),
   imap(lambda h: 5*h, iter(hamming5:
  yield n
  hammingGenerators = tee(_hamming(), 4)
  return hammingGenerators[3]
  
for i in hamming():
  print i,
  sys.stdout.flush()
*** END SNAP

Here's an implementation of the fibonacci sequence that uses "tee" : 

*** BEGIN SNAP
from itertools import tee
import sys

def fib():
  def _fib():
yield 1
yield 1
curGen = fibGenerators[0]
curAheadGen = fibGenerators[1]
curAheadGen.next()
while True:
  yield curGen.next() + curAheadGen.next()
  fibGenerators = tee(_fib(), 3)
  return fibGenerators[2]
  
for n in fib():
  print n,
  sys.stdout.flush()
*** END SNAP

Francis Girard
FRANCE


Le lundi 24 Janvier 2005 14:09, Francis Girard a ÃcritÂ:
> Ok, I think that the bottom line is this :
>
> For all the algorithms that run after their tail in an FP way, like the
> Hamming problem, or the Fibonacci sequence, (but unlike Sieve of
> Eratosthene -- there's a subtle difference), i.e. all those algorithms that
> typically rely upon recursion to get the beginning of the generated
> elements in order to generate the next one ...
>
> ... so for this family of algorithms, we have, somehow, to abandon
> recursion, and to explicitely maintain one or many lists of what had been
> generated.
>
> One solution for this is suggested in "test_generators.py". But I think
> that this solution is evil as it looks like recursion is used but it is not
> and it depends heavily on how the m235 function (for example) is invoked.
> Furthermore, it is _NOT_ memory efficient as pretended : it leaks ! It
> internally maintains a lists of generated results that grows forever while
> it is useless to maintain results that had been "consumed". Just for a
> gross estimate, on my system, percentage of memory usage for this program
> grows rapidly, reaching 21.6 % after 5 minutes. CPU usage varies between
> 31%-36%. Ugly and inefficient.
>
> The solution of Jeff Epler is far more elegant. The "itertools.tee"
> function does just what we want. It internally maintain a list of what had
> been generated and deletes the "consumed" elements as the algo unrolls. To
> follow with my gross estimate, memory usage grows from 1.2% to 1.9% after 5
> minutes (probably only affected by the growing size of Huge Integer). CPU
> usage varies between 27%-29%.
> Beautiful and effecient.
>
> You might think that we shouldn't be that fussy about memory usage on
> generating 100 digits numbers but we're talking about a whole family of
> useful FP algorithms ; and the best way to implement them should be
> established.
>
> For this family of algorithms, itertools.tee is the way to go.
>
> I think that the semi-tutorial in "test_generators.py" should be updated to
> use "tee". Or, at least, a severe warning comment should be written.
>
> Thank you,
>
> Francis Girard
> FRANCE
>
> Le dimanche 23 Janvier 2005 23:27, Jeff Epler a ÃcritÂ:
> > Your formulation in Python is recursive (hamming calls hamming()) and I
> > think that's why your program gives up fairly early.
> >
> > Instead, use itertools.tee() [new in Python 2.4, or search the internet
> > for an implementation that works in 2.3] to give a copy of the output
> > sequence to each "multiply by N" function as well as one to be the
> > return value.
> >
> > Here's my implementation, which matched your list early on but
> > effortlessly reached larger values.  One large value it printed was
> > 6412351813189632 (a Python long) which indeed has only the distinct
> > prime factors 2 and 3. (2**43 * 3**6)
> >
> > Jeff
> >
> > from itertools import tee
> > import sys
> >
> > def imerge(xs, ys):
> > x = xs.next()
> > y = ys.next()
> > while True:
> > if x == y:
> > yield x
> > x = xs.next()
> > y = ys.next()
> > elif x < y:
> > yield x
> > x = xs.next()
> > else:
> > yield y
> > y = ys.next()
> >
> > def hamming():
> > def _hamming(j, k):
> > yield 1
> > hamming = generators[j]
> > for i in hamming:
> > yield i * k
> > generators = []
> > generator = imerge(imerge(_hamming(0, 2), _hamming(1, 3)),
> > _hamming(2

Re: Python serial data aquisition

2005-01-24 Thread Miki
Hello Flávio,
> My problem is to how to recover my reading from these bytes, since
> pyserial gives me a character (string) from each byte... I dont know
> how to throw away the   unneeded bits and concatenate the remaining
> bits to form a number...
See the array module.
Also http://tebeka.bizhat.com/Software/bitter.py

HTH.
Miki

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


Configuring Python for Tk on Mac (continued)

2005-01-24 Thread Martyn Quick
From: Alex Martelli ([EMAIL PROTECTED])
> 
> No idea about any 10.2, sorry, but on 10.3 that's not the problem: Tk
> support is there alright, it's Tcl/Tk which _isn't_.  Get MacPython, its
> PackageManager will explain where to get Tcl/Tk Aqua from, as a prereq
> for Tkinter and IDLE!

Ok, I've installed MacPython.  It doesn't seem to work right though...
for example, if I try to run the 00-HELLO-WORLD.py example then it
crashes and tells me the IDE has unexpectedly crashed.

I can't really see how to run things either.  (I'm used to just typing
"python" in a terminal on Unix but that seems to just run the version
that comes pre-installed.)

Sorry for not knowing much about Macs and being a bit clueless.

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


Re: urllib2 and proxy question

2005-01-24 Thread rbt
Fuzzyman wrote:
urllib2 (under windows) will auto-detect your proxy settings and use
those.
Normally that's a good thing (I guess), except when it's not !
How do I switch off this behaviour ? I'm behind a censoring proxy and
wanting to test things *locally*. IE is set to not use the proxy when
fetching local adresses, but urllib2 ignores that part of the setting
and uses the proxy for everything.
The only way I can test are changing my IE settings back and forth
every time. Most annoying.
I can see how to *add* a new proxy to urllib2, but not how to force it
to not use a proxy. I may well be missing something obvious though.
Anyone able to help ?
Regards,
Fuzzy
http://www.voidspace.org.uk/python/index.shtml
"Alternatively, the optional proxies argument may be used to explicitly 
specify proxies.
It must be a dictionary mapping scheme names to proxy URLs, where an 
empty dictionary causes no proxies to be used"

# Don't use any proxies
filehandle = urllib.urlopen(some_url, proxies={})
--
http://mail.python.org/mailman/listinfo/python-list


Re: Weakref.ref callbacks and eliminating __del__ methods

2005-01-24 Thread Richie Hindle

[me]
> why the `self.btree = None` in the last line?

[Mike]
> It's to allow the Closer object to act as a substitute for a .close() 
> method on the object [...] If the user explicitly calls storage.close()
> we don't want the __del__ trying to re-close the storage later.  In
> other words, its an explicit requirement for *this* __del__, not a general
> requirement.

I see, yes.  Very clever - thanks for the explanation!

-- 
Richie Hindle
[EMAIL PROTECTED]

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


Re: urllib2 and proxy question

2005-01-24 Thread Fuzzyman

rbt wrote:
> Fuzzyman wrote:
> > urllib2 (under windows) will auto-detect your proxy settings and
use
> > those.
> >
> > Normally that's a good thing (I guess), except when it's not !
> >
> > How do I switch off this behaviour ? I'm behind a censoring proxy
and
> > wanting to test things *locally*. IE is set to not use the proxy
when
> > fetching local adresses, but urllib2 ignores that part of the
setting
> > and uses the proxy for everything.
> >
> > The only way I can test are changing my IE settings back and forth
> > every time. Most annoying.
> >
> > I can see how to *add* a new proxy to urllib2, but not how to force
it
> > to not use a proxy. I may well be missing something obvious though.
> > Anyone able to help ?
> > Regards,
> >
> > Fuzzy
> > http://www.voidspace.org.uk/python/index.shtml
> >
>
> "Alternatively, the optional proxies argument may be used to
explicitly
> specify proxies.
> It must be a dictionary mapping scheme names to proxy URLs, where an
> empty dictionary causes no proxies to be used"
>
> # Don't use any proxies
> filehandle = urllib.urlopen(some_url, proxies={})

Wikkid... I'll try that. Nice one, thanks for your help.
It *still* means I have to have a different version for testing locally
- but it's better than the alternative.
Regards, 


Fuzzy
http://www.voidspace.org.uk/python/index.shtml

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


Re: Weakref.ref callbacks and eliminating __del__ methods

2005-01-24 Thread Mike C. Fletcher
Tim Peters wrote:
[Mike C. Fletcher]
 

I'm looking at rewriting parts of Twisted and TwistedSNMP to eliminate
__del__ methods (and the memory leaks they create).
   

A worthy goal!
 

Well, as of now it seems to have eliminated the last leaks in 
TwistedSNMP, and that's likely going to eliminate the last of our leaks 
in our products, so yes, I suppose it was :) .

A callback is strongly referenced from the weakref(s) containing it.
 

Thanks.
It would really help to give a minimal example of self-contained
executable code.  I'm not sure how you're using this code, and
guessing takes too long.
 

Sorry about that.  I was expecting a theoretical problem, not a 
practical one, so didn't think to provide a practical example.

The "2" there is important, just because this is an interactive
session.  The point of it was to stop `_` from holding a reference to
the created weakref.  In your code
   weakref.ref( self, self.close )
the weakref itself becomes trash immediately after it's created, so
the weakref is thrown away entirely (including its strong reference to
self.close, and its weak reference to self) right after that line
ends.  Of course callbacks aren't *supposed* to be called when the
weakref itself goes away, they're supposed to be called when the thing
being weakly referenced goes away.  So this all looks vanilla and
inevitable to me -- the callback is never invoked because the weakref
itself goes away long before self goes away.
 

Alex already scooped you on this "smack yourself on the head, Mikey".  I 
was assuming the weakref object was a proxy for a reference in an 
internal structure; I was expecting a list of weak references that was 
nothing but a series of functions to call after finalising the object.  
My bad.

I'm pretty sure it's just because there's nothing here to keep the
weakref itself alive after it's created.  You could try, e.g.,
   self.wr = weakref.ref( self, self.close )
to keep it alive, but things get fuzzy then if self becomes part of
cyclic trash.
 

Yes, so it requires an external storage mechanism and code to clean that 
up... ick.  __del__ looks cleaner and cleaner by comparison.  You'd 
think I would have noticed the huge tables of weakref objects in 
PyDispatcher as I was working in there...

I can work around it in this particular case by defining a __del__ on
the Closer, but that just fixes this particular instance (and leaves
just as many __del__'s hanging around).  I'm wondering if there's a
ready recipe that can *always* replace a __del__'s operation?
   

In the presence of cycles it gets tricky; there's a lot of
more-or-less recent words (less than a year old ) about that on
python-dev.  It gets complicated quickly, and it seems nobody can make
more time to think about it.
 

Sigh, guess I should stop listening to rumours just because they are 
saying something about that for which I yearn.

I know I heard a rumour somewhere about Uncle Timmy wanting to eliminate
__del__ in 2.5 or thereabouts,
   

Python 3 at the earliest.  That's the earliest everything nobody can
make time for lands <0.5 wink>.
 

Well, we darn well better solve it by then!  Don't want memory leaks 
when we're hard-wired into someone's brain.

There are unresolved issues about how to get all this stuff to work
sanely.  The driving principle behind cyclic-trash weakref endcases
right now is "do anything defensible that won't segfault".
I'll note that one fairly obvious pattern works very well for weakrefs
and __del__ methods (mutatis mutandis):  don't put the __del__ method
in self, put it in a dead-simple object hanging *off* of self.  Like
the simple:
class BTreeCloser:
   def __init__(self, btree):
   self.btree = btree
   def __del__(self):
   if self.btree:
   self.btree.close()
   self.btree = None
 

Yes, this was the "work around" I'd implemented (well, with __call__ 
instead and del just calling it).  Of course, that didn't actually 
eliminate any __del__ methods, but oh well, if we're not losing those 
until 3.x it doesn't really matter :) .

The fix for the Deferred in Twisted got a little hideous (there the 
__del__ is poking around into lots of different attributes of the 
Deferred.  To hack that I created a descriptor class that forwards a 
variable to the held object and wrapped each of the needed variables in 
one of those... I'm going to have to find something a little less 
baroque if I'm going to get it into Twisted... really, it doesn't look 
like any of it's necessary, it's just logging an error if the Deferred 
ended on a Failure.  Something should be done though, leaking memory 
from a core object in the framework is just a PITA.

When a weakref and its weak referent are both in cyclic trash, Python
currently says "the order in which they die is undefined, so we'll
pretend the weakref dies first", and then, as at the start of this
msg, the callback is never invoked.  

So external storage of a weakref is basically a requirement to make it 

Right place for third party modules (here: fixedpoint)

2005-01-24 Thread Sibylle Koczian
Hello,
for the first time since getting Python I can't get a third party module 
to work.

I got fixedpoint.0.1.2.tar.gz from SourceForge for use with KinterbasDB. 
After unpacking I had a directory called "fixedpoint" which I put under 
my site-packages directory. There are no installation instructions and 
just the one module fixedpoint.py (and some documentation and examples).

All of this under Windows XP, with Python 2.4.
Now I try to use the module, but
import fixedpoint
says "ImportError: No module named fixedpoint".
I suppose fixedpoint is no package as described in the tutorial and so 
"site-packages" might not be the right place for it. But where does it 
belong? I think it should go somewhere in the Python directory tree, not 
among my own scripts.

Thank you,
Koczian
--
Dr. Sibylle Koczian
Universitaetsbibliothek, Abt. Naturwiss.
D-86135 Augsburg
Tel.: (0821) 598-2400, Fax : (0821) 598-2410
e-mail : [EMAIL PROTECTED]
--
http://mail.python.org/mailman/listinfo/python-list


Finding a script's home directory?

2005-01-24 Thread Gabriel Cooper
In one of my python programs has a data file I need to load. My solution 
was to say:

   if os.path.exists(os.path.join(os.getcwd(), "config.xml")):
   self.cfgfile = os.path.join(os.getcwd(), "config.xml")
Which works fine... as long as you're *in* the script's home directory 
when you run it (as in, run it as: ./startApp.py as opposed to 
./myApp/startApp.py).

If I run it from an alternate directory the program looks for the 
config.xml file in my current directory not the app's home directory. So 
how do I get the script's home directory?
--
http://mail.python.org/mailman/listinfo/python-list


RE: Finding a script's home directory?

2005-01-24 Thread Pieter Claerhout
The following should work:

os.path.split( os.path.realpath( sys.argv[0] ) )[0]
 
Cheers,


pieter


-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf
Of Gabriel Cooper
Sent: 24 January 2005 16:40
To: [email protected]
Subject: Finding a script's home directory?

In one of my python programs has a data file I need to load. My solution 
was to say:

if os.path.exists(os.path.join(os.getcwd(), "config.xml")):
self.cfgfile = os.path.join(os.getcwd(), "config.xml")

Which works fine... as long as you're *in* the script's home directory 
when you run it (as in, run it as: ./startApp.py as opposed to 
./myApp/startApp.py).

If I run it from an alternate directory the program looks for the 
config.xml file in my current directory not the app's home directory. So 
how do I get the script's home directory?
-- 
http://mail.python.org/mailman/listinfo/python-list
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Memory Usage

2005-01-24 Thread Fredrik Lundh
"rbt" wrote:

> For example, say I have the same Python script running on two WinXP computers 
> that both have 
> Python 2.4.0. One computer has 256 MB of Ram while the other has 2 GB of Ram. 
> On the machine with 
> less Ram, the process takes about 1 MB of Ram. On the machine with more Ram, 
> it uses 9 MB of Ram.
>
> Is this normal and expected behavior?

1 MB sounds low, 9 MB sounds more reasonable for a script that uses a few mega-
bytes of data.  what tool are you using to determine the process size?

 



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


Re: Finding a script's home directory?

2005-01-24 Thread Mark McEahern
Gabriel Cooper wrote:
In one of my python programs has a data file I need to load. My 
solution was to say:

   if os.path.exists(os.path.join(os.getcwd(), "config.xml")):
   self.cfgfile = os.path.join(os.getcwd(), "config.xml")
Which works fine... as long as you're *in* the script's home directory 
when you run it (as in, run it as: ./startApp.py as opposed to 
./myApp/startApp.py).

If I run it from an alternate directory the program looks for the 
config.xml file in my current directory not the app's home directory. 
So how do I get the script's home directory?
import os.path
dirname = os.path.dirname(__file__)
// m
--
http://mail.python.org/mailman/listinfo/python-list


Re: What YAML engine do you use?

2005-01-24 Thread Fredrik Lundh
Sion Arrowsmith wrote:

> I'm probably not thinking deviously enough here, but how are you
> going to exploit an eval() which has very tightly controlled
> globals and locals (eg. eval(x, {"__builtins__": None}, {}) ?

try this:

eval("'*'*100*2*2*2*2*2*2*2*2*2")

(for more on eval and builtins, see the "Evaluating Python expressions"
section here: http://effbot.org/librarybook/builtin.htm )

 



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


Re: Memory Usage

2005-01-24 Thread Peter Hansen
rbt wrote:
Peter Hansen wrote:
I would expect to see such behaviour, given how difficult it is
to measure *actual* memory usage.  How are you measuring it?
Just by looking at the Mem Usage column in the Task Manager?
That's right. I look at that column. Should I measue mem usage in some 
other way?
Probably, but for a start, have you noticed that even just
switching to another window can drastically affect the
memory apparently used by an application?  For example,
running the wxPython demo, clicking on a few controls and
getting memory usage up to 27MB, then minimizing the window
will drop it down aboiut 2MB.  Restoring the window will
bring the amount back to only about 4MB, at least until
you click on stuff.  Even then, it might climb to only
about 14MB or so.
This particular phenomenon might not be affecting your
application, but it's an indication of how bad this
measurement technique can be.
Inside the Control Panel, you will find "Administrative Tools".
In there is a "Performance" gadget.  It's not trivial to
use, and I can't give a tutorial here, but if you can
manage to display the Working Set for the specific Process
in which you are interested, that's probably a better
way to view the information.  (To be honest, I think it's
actually this particular value which the "Mem Usage"
field shows in the Task Manager, but at least this way
you get a real-time graph and more precision, and a
record of the usage.)  There are also dozens of other
parameters you can examine to help you track down the
actual usage, or to help find out what is going if it turns
out that you really are using such different amounts on
the two machines.
More important than any of this, however, might be making
sure you have similar conditions on the two machines.  Are
you terminating as many other processes as you can?  Making
sure there is ample Physical Memory Available (see the
Performance tab of Task Manager, for example)?  If you
have one of the machines running out of memory because
of other applications running, it is quite possible that
the OS will steal memory from the Python process to feed
the other apps, and that can show up in the working set size.
As I said, this stuff isn't exactly straightforward, so
it's not necessarily surprising you are seeing this behaviour.
There's probably a relatively simple explanation, however,
but it might come only after a bit of exploration.
-Peter
--
http://mail.python.org/mailman/listinfo/python-list


Re: Right place for third party modules (here: fixedpoint)

2005-01-24 Thread Steve Holden
Sibylle Koczian wrote:
Hello,
for the first time since getting Python I can't get a third party module 
to work.

I got fixedpoint.0.1.2.tar.gz from SourceForge for use with KinterbasDB. 
After unpacking I had a directory called "fixedpoint" which I put under 
my site-packages directory. There are no installation instructions and 
just the one module fixedpoint.py (and some documentation and examples).

All of this under Windows XP, with Python 2.4.
Now I try to use the module, but
import fixedpoint
says "ImportError: No module named fixedpoint".
I suppose fixedpoint is no package as described in the tutorial and so 
"site-packages" might not be the right place for it. But where does it 
belong? I think it should go somewhere in the Python directory tree, not 
among my own scripts.

Thank you,
Koczian
Instead, just move the "fixedpoint.py" file to your site-packages 
directory. You can then delete the empty fixedpoint directory, as it 
won't do anything except get in the way.

Packages are implemented as directories, but modules are single Python 
files. "Site-packages" is a perfectly acceptable place to put "site 
modules" as well ;-)

regards
 Steve
--
Steve Holden   http://www.holdenweb.com/
Python Web Programming  http://pydish.holdenweb.com/
Holden Web LLC  +1 703 861 4237  +1 800 494 3119
--
http://mail.python.org/mailman/listinfo/python-list


Re: Memory Usage

2005-01-24 Thread Stuart McGarrity
Do you have a page file?

The Mem column should be RAM usage and not total working set. Some of it 
could be swapped to the page file. A free tool like process explorer can 
give you better informaton than the task manager.

"rbt" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> Would a Python process consume more memory on a PC with lots of memory?
>
> For example, say I have the same Python script running on two WinXP 
> computers that both have Python 2.4.0. One computer has 256 MB of Ram 
> while the other has 2 GB of Ram. On the machine with less Ram, the process 
> takes about 1 MB of Ram. On the machine with more Ram, it uses 9 MB of 
> Ram.
>
> Is this normal and expected behavior?
>
> Thanks,
>
> rbt 


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


Re: What YAML engine do you use?

2005-01-24 Thread Peter Hansen
Sion Arrowsmith wrote:
Paul Rubin   wrote:
YAML looks to me to be completely insane, even compared to Python
lists.  I think it would be great if the Python library exposed an
interface for parsing constant list and dict expressions, e.g.:
 [1, 2, 'Joe Smith', 8237972883334L,   # comment
{'Favorite fruits': ['apple', 'banana', 'pear']},  # another comment
'xyzzy', [3, 5, [3.14159, 2.71828, [
[ ... ]
Note that all the values in the above have to be constant literals.
Don't suggest using eval.  That would be a huge security hole.

I'm probably not thinking deviously enough here, but how are you
going to exploit an eval() which has very tightly controlled
globals and locals (eg. eval(x, {"__builtins__": None}, {}) ?
See, for example, Alex Martelli's post in an old thread from 2001:
http://groups.google.ca/groups?selm=9db3oi01aph%40news2.newsguy.com
-Peter
--
http://mail.python.org/mailman/listinfo/python-list


Re: Right place for third party modules (here: fixedpoint)

2005-01-24 Thread Fredrik Lundh
Sibylle Koczian wrote:

> for the first time since getting Python I can't get a third party module to 
> work.
>
> I got fixedpoint.0.1.2.tar.gz from SourceForge for use with KinterbasDB. 
> After unpacking I had a 
> directory called "fixedpoint" which I put under my site-packages directory. 
> There are no 
> installation instructions and just the one module fixedpoint.py (and some 
> documentation and 
> examples).
>
> All of this under Windows XP, with Python 2.4.
>
> Now I try to use the module, but
>
> import fixedpoint
>
> says "ImportError: No module named fixedpoint".
>
> I suppose fixedpoint is no package as described in the tutorial and so 
> "site-packages" might not 
> be the right place for it.

site-packages sure works on my windows xp / python 2.4 configuration.

what is your sys.path set to?

>>> import sys
>>> sys.path
['', 'C:\\WINDOWS\\system32\\python24.zip', ... 'C:\\python24',
'C:\\python24\\lib\\site-packages', ... ]

if you fire up a command window and run

python -v -v -c "import fixedpoint"

you get a list of places where python looks for that module.  does it look
in right directory?

(this can be very verbose; you might wish to do

python -v -v -c "import fixedpoint" 2> out
notepad out

instead)

 



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


"bad argument type for built-in operation"

2005-01-24 Thread Gilles Arnaud
Hello,
I've got a nasty bug and no idea to deal with :
here is the method :

def denormer(self, var) :
" denorme un vecteur d'entree "
try:
#a = map(self.decerner, self.param, var)
#a = [self.decerner(x, y) for x, y in map(None, 
self.param, var)]
a = []
print 'in', None, self.param, var, len(self.param), 
len(var), str(self.decerner)
#return map(undoc, self.param, var)
print map(None, var)
print map(None, self.param)
#print zip(var, var)
#print zip(self.param, self.param)
#print map(lambda x, y: (x,y), self.param, var)
#print zip(self.param, var)
b = []
print '$',
ii = range(len(var))
print ii, '$',
for i in ii :
print '%',
b.append((self.param[i], var[i]))
print b, '/',
print '$',
print b
for x,y in b :
print x, y
z = undoc(x, y)
print z
a.append(z)
except TypeError, c :
print 'E', str(self.decerner), self.param, var
print 'E2', str(c)
raise
return a

in fact the method was initially reduce to

return map(self.decerner, self.param, var)

all the commented line produced the same exception raised

this method unnormalize an input vector (var)
and the trace

in None [(-2.0, 2.0), (-2.0, 2.0)] [0.1385039192456847, 
0.87787941093093491] 2 2 
[0.1385039192456847, 0.87787941093093491]
[(-2.0, 2.0), (-2.0, 2.0)]
$ [0, 1] $ % [((-2.0, 2.0), 0.1385039192456847)] / % [((-2.0, 
2.0), 0.1385039192456847), ((-2.0, 2.0), 0.87787941093093491)] / $ 
[((-2.0, 2.0), 0.1385039192456847), ((-2.0, 2.0), 
0.87787941093093491)]
(-2.0, 2.0) 0.138503919246
% 0.277007838491
(-2.0, 2.0) 0.877879410931
% 1.75575882186
in None [(-2.0, 2.0), (-2.0, 2.0)] [0.38111874838950943, 
0.74880175070169164] 2
2 
[0.38111874838950943, 0.74880175070169164]
[(-2.0, 2.0), (-2.0, 2.0)]
$ [0, 1] $ % [((-2.0, 2.0), 0.38111874838950943)] / % [((-2.0, 
2.0), 0.38111874838950943), ((-2.0, 2.0), 0.74880175070169164)] / 
E 
[(-2.0, 2.0), (-2.0, 2.0)] [0.38111874838950943, 0.74880175070169164]
E2 bad argument type for built-in operation

[...]

the first call of the methode succeed
all following call failed.
I've got different scenario which call this low level methode,
many succeed, some failed this way.
what's happened ?
If someone got an idea ?
what can raise this exception ?
My program is written partially in python and partially in C.
the top level is in python which call a C optimisation routine
which use a callback (PyObject_CallMethod) to evaluate the cost in
python again.
--
http://mail.python.org/mailman/listinfo/python-list


ANN: Leo 4.3-a1 released

2005-01-24 Thread Edward K. Ream
Leo 4.3 alpha 1 is now available at http://sourceforge.net/projects/leo/

Leo 4.3 is the culmination of more than four months of work.  In spite
of its alpha status, I recommend Leo 4.3a1 over any 4.2 release.

The defining features of Leo 4.3:
-
1. Leo now stores options in @settings trees, that is, outlines whose
headline is '@settings'. When opening a .leo file, Leo looks for
@settings trees not only in the outline being opened but also in
various leoSettings.leo files.

The key design goal of @settings trees was that Leo's user options
must be infinitely flexible. That goal has been accomplished. Indeed,
users can create arbitrarily complex user options with @settings
trees. Leo settings outlines are, in fact, infinitely more flexible
and powerful than any scheme based on flat text. Readers of Python's
configParser shootout take note.

2. The Preferences command temporarily replaces the outline pane with
an outline showing all the @settings trees in effect. The Preferences
command also replaces the body pane with a "settings pane". This
settings pane allows you to change the settings selected in the
outline pane using standard gui widgets. The settings pane is
dynamically created from nodes in the settings tree; it is as
extensible as the @settings tree itself.

3. Leo's read/write code in leoAtFile.py has been rewritten to support
user-defined tangling and untangling. This is a major cleanup of
Leo's core.

4. Leo now boasts a wonderful new Plugins Manager plugin. This plugin
enables and disables plugins automatically. You never have to mess
with pluginsManager.txt again. This plugin also tells you everything
you need to know about each plugin. Finally, this plugin also lets you
download plugins from Leo's cvs site.

5. You can install third-party extensions in Leo's extensions
directory. Leo will attempt to import such extensions from the
extensions directory if normal imports fail.

As usual, version 4.3 contains many other improvements and bug fixes.

What people are saying about Leo

"I am using Leo since a few weeks and I brim over with enthusiasm for
it. I think it is the most amazing software since the invention of the
spreadsheet." -- juergen_r

"We who use Leo know that it is a breakthrough tool and a whole new
way of writing code."  -- Joe Orr

"I am a huge fan of Leo. I think it's quite possibly the most
revolutionary programming tool I have ever used and it (along with the
Python language) has utterly changed my view of programming (indeed of
writing) forever."  -- Shakeeb Alireza

"Thank you very much for Leo. I think my way of working with data will
change forever...I am certain [Leo] will be a revolution. The
revolution is as important as the change from sequential linear
organization of a book into a web-like hyperlinked pages. The main
concept that impress me is that the source listing isn't the main
focus any more. You focus on the non-linear, hierarchical, collapsible
outline of the source code."  -- Korakot Chaovavanich

"Leo is a quantum leap for me in terms of how many projects I can
manage and how much information I can find and organize and store in a
useful way."  -- Dan Winkler

"Wow, wow, and wow...I finally understand how to use clones and I
realized that this is exactly how I want to organize my information.
Multiple views on my data, fully interlinkable just like my thoughts."
-- Anon.

"A few years back I would have said Zope was #1 Python showcase, but I
agree 100% that Leo is tops now." -- Jason Cunliffe

"Leo is the most interesting Python project I know of...I see lots of
stuff posted on the Daily Python page, but I usually yawn and come
over to this forum to see what's cooking."  -- Anon

More quotes at: http://webpages.charter.net/edreamleo/testimonials.html

What makes Leo special?
---
- Leo's outlines add a new dimension to programming.
- Leo shows you your code and data the way _you_ want to see them.
- Leo extends, completes and simplifies literate programming.
- Leo's script buttons bring scripts to data.

What is Leo?

- A programmer's editor, an outlining editor and a flexible browser.
- A literate programming tool, compatible with noweb and CWEB.
- A data organizer and project manager. Leo provides multiple views
   of projects within a single outline.
- Fully scriptable using Python. Leo saves its files in XML format.
- Portable. leo.py is 100% pure Python.
- Open Software, distributed under the Python License.

Leo requires Python 2.2.1 or above and tcl/tk 8.4 or above.
Leo works on Linux, Windows and MacOs X.

Links:
--
Leo:  http://webpages.charter.net/edreamleo/front.html
Home: http://sourceforge.net/projects/leo/
Download: http://sourceforge.net/project/showfiles.php?group_id=3458
CVS:  http://sourceforge.net/cvs/?group_id=3458
Quotes:   http://webpages.charter.net/edreamleo/testimonials.html
Wiki: http://leo.hd1.org/

Edward K. Ream
Jan

pylibpcap and multiple threads

2005-01-24 Thread Örjan Gustavsson
Hi All!
Sorry if this is not the correct forum for this kind of question (I did 
not find any pylibpcap related lists).

I am trying to use pylibpcap to capture network traffic from several 
ethernet devices at the same time, each nic having a separate thread 
assigned to it.

My problem is that when one thread is blocking inside pcap.loop() for 
instance, it seems to have acquired the GIL, so that no other threads 
can run.

Does anyone know a way to do this with threads, or is the only way to 
have separate processes for each NIC?

Regards,
Örjan Gustavsson
--
http://mail.python.org/mailman/listinfo/python-list


Re: What is print? A function?

2005-01-24 Thread Ryan Paul
On Sun, 23 Jan 2005 18:01:50 +, Frans Englich wrote:

> 
> Nah, I don't think it's a function, but rather a builtin "statement". But
> it's  possible to invoke it as an function; print( "test" ) works fine.
> 
> So I wonder, what _is_ exactly the print statement? The untraditional
> way of invoking it(without paranteses) makes me wonder.
> 
> The reason I thinks about this is I need to implement a debug print for
> my program; very simple, a function/print statement that conditionally
> prints its message whether a bool is true. Not overly complex.
> 
> I tried this by overshadowing the print keyword, but that obviously
> didn't work.. Is defining a two-liner function the right way to go, or
> is there better ways to approach it?
> 
> 
> Cheers,
> 
>   Frans

Unfortunately, it isnt possible to add new kinds of statements to python.
you might want to have a look at Ruby, in which paren are entirely
optional. Ruby is similar to python in a lot of ways, but its also quite
different. It provides lots of syntactic sugar and a superior object
model, but its a resource hog compared to python.

You may also be interested in Logix. Logix is a language framework built
on top of python that allows you to dynamically extend python syntax at
run-time. Unfortunately, Logix is still rather new, and its incredibly
slow.

http://logix.livelogix.com/
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Right place for third party modules (here: fixedpoint)

2005-01-24 Thread Fredrik Lundh
>> I suppose fixedpoint is no package as described in the tutorial and so 
>> "site-packages" might not 
>> be the right place for it.
>
> site-packages sure works on my windows xp / python 2.4 configuration.

ah, forget what I said.  you need to put the fixedpoint.py *file* under 
site-packages,
not the entire directory.  as that "python -v -v" would have told you:

> more out
...
# trying C:\python24\lib\site-packages\fixedpoint.pyd
# trying C:\python24\lib\site-packages\fixedpoint.dll
# trying C:\python24\lib\site-packages\fixedpoint.py
# trying C:\python24\lib\site-packages\fixedpoint.pyw
# trying C:\python24\lib\site-packages\fixedpoint.pyc
Traceback (most recent call last):
  File "", line 1, in ?
ImportError: No module named fixedpoint
...

 



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


Re: Memory Usage

2005-01-24 Thread Tim Peters
[<[EMAIL PROTECTED]>]
> Would a Python process consume more memory on a PC with lots of
> memory?
>
> For example, say I have the same Python script running on two WinXP
> computers that both have Python 2.4.0. One computer has 256 MB of Ram
> while the other has 2 GB of Ram. On the machine with less Ram, the
> process takes about 1 MB of Ram. On the machine with more Ram, it uses
> 9 MB of Ram.
>
> Is this normal and expected behavior?

[and later confirms he's looking at Mem Usage in Task Manager]

256MB is on the low end for an XP system, and will generally cause
lots of swap space (virtual memory residing on disk -- kinda) to get
used.  Mem Usage doesn't count swap space, just RAM currently in use. 
Under Task Manager it's better to look at the VM Size column, which
tells roughly how much virtual address space is assigned to the
process, and regardless of how it's currently split between RAM and
disk.  You may need to use View -> Select Columns to get this
statistic displayed.  If your process is in fact using a fixed amount
of address space, the VM Size column will stay steady but Mem Usage
may jump all over the place as time goes on.  In general, I would
expect VM Size to be about the same on your two boxes; I would not
expect Mem Usage to be the same.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: on the way to find pi!

2005-01-24 Thread Ali Polatel
when we change the code that way the programme gets awful slow when I want to calculate say 100 digits or more .Can't we just get the numbers out of there without changing the code radically thus not making the programme sloww?
		Do you Yahoo!? 
Yahoo! Search presents - Jib Jab's 'Second Term'-- 
http://mail.python.org/mailman/listinfo/python-list

how to ncurses on win32 platform

2005-01-24 Thread Brane
please advice
regards
brane
-- 
http://mail.python.org/mailman/listinfo/python-list


Python 2.1 - 2.4 differences

2005-01-24 Thread BOOGIEMAN
I found some e-book about Python 2.1, I want to print it but just to check
first if sintax of Python 2.1 is same as 2.4 ? Also does anybody know where 
can I download any newer Python related e-book, because there isn't any 
published yet in my country.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python 2.1 - 2.4 differences

2005-01-24 Thread Fredrik Lundh
"BOOGIEMAN" <[EMAIL PROTECTED]> wrote:

>I found some e-book about Python 2.1, I want to print it but just to check
> first if sintax of Python 2.1 is same as 2.4 ?

almost everything that works under 2.1 works under 2.4.  the opposite
isn't always true, though.  for more information on new stuff, see:

http://www.python.org/doc/2.2.3/whatsnew/
http://www.python.org/doc/2.3.4/whatsnew/
http://www.python.org/doc/2.4/whatsnew/whatsnew24.html

and

http://effbot.org/zone/librarybook-py21.htm
http://effbot.org/zone/librarybook-py22.htm
http://effbot.org/zone/librarybook-py23.htm





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


Re: Python 2.1 - 2.4 differences

2005-01-24 Thread Simon Brunning
On Mon, 24 Jan 2005 17:13:44 +0100, BOOGIEMAN <[EMAIL PROTECTED]> wrote:
> I found some e-book about Python 2.1, I want to print it but just to check
> first if sintax of Python 2.1 is same as 2.4 ?

Pretty musch the same, but naturally, some things have changed. See
these documents for the major changes, by release:
 * http://www.python.org/doc/2.2.3/whatsnew/
 * http://www.python.org/doc/2.3/whatsnew/
 * http://www.python.org/doc/2.4/whatsnew/

-- 
Cheers,
Simon B,
[EMAIL PROTECTED],
http://www.brunningonline.net/simon/blog/
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: [perl-python] 20050124 classes & objects

2005-01-24 Thread Chris Mattern
Xah Lee wrote:

> Perl does not support classes or
> objects in the so-called "Object
> Oriented" programing. 

Boy, the ignorance never stops, does it?

> However, a 
> complete set of emulations of OO
> style of programing have been done,
> resulting in modules and books and
> many documentations and tutorials.
> 

It doesn't have OO, but it emulates in software!
Better go with python, which has hardware OO. :-)
-- 
 Christopher Mattern

"Which one you figure tracked us?"
"The ugly one, sir."
"...Could you be more specific?"
-- 
http://mail.python.org/mailman/listinfo/python-list


Import from database

2005-01-24 Thread Steve Holden
I'm trying to load module code from a database, which stores for each 
module its full name, code, load date and a Boolean indicating whether 
it's a package or not.

The following simple program:
import dbimp, sys
if __name__ == "__main__":
dbimp.install()
#import bsddb.db
import a.b.c.d
import bsddb
gives a traceback from its last line. The whole output is
$ python -i test.py
Accepted *db*
found a in db
load_module: a
a loaded:  pkg: 1
found a.b in db
load_module: a.b
a.b loaded:  pkg: 1
found a.b.c in db
load_module: a.b.c
a.b.c loaded:  pkg: 1
found a.b.c.d in db
load_module: a.b.c.d
a.b.c.d loaded:  pkg: 0
found bsddb in db
load_module: bsddb
found weakref in db
load_module: weakref
weakref loaded:  pkg: 0
Traceback (most recent call last):
  File "test.py", line 7, in ?
import bsddb
  File "/c/steve/Projects/Python/dbimp/dbimp.py", line 49, in load_module
exec code in module.__dict__
  File "db:bsddb", line 62, in ?
  File "/usr/lib/python2.4/os.py", line 133, in ?
from os.path import (curdir, pardir, sep, pathsep, defpath, extsep, 
altsep,
ImportError: No module named path
>>>

It appears that for some reason execution of the code in 
bsddb/__init__.pyc (loaded from the database using my importer) is 
causing the os module to execute again although it has already run and 
been cached in sys.modules.

Any explanations would be welcome. The importer module is shown below (a 
posting with an attachment to avoid code folding didn't appear to make 
it out)

Also if someone can suggest how associate the source file with 
module/package code from the database that would make tracebacks look 
more conventional, though I'd like to retain the indication the module 
was loaded by dbimp somehow.

#
# Import modules from a database
#
import sys, db, marshal, imp, new
conn = db.conn()
curs = conn.cursor()
curs.execute("select modName from module")
impdict = {}
for n in [x[0] for x in curs.fetchall()]:
impdict[n] = 1
class dbimporter(object):
def __init__(self, item, *args, **kw):
if item != "*db*":
raise ImportError
print "Accepted", item
def find_module(self, fullname, path=None):
#print "find_module:", fullname, "from", path
if fullname not in impdict:
#print "Bailed on", fullname
return None
else:
print "found", fullname, "in db"
return self
def load_module(self, modname):
print "load_module:", modname
if modname in sys.modules:
return sys.modules[modname]
curs.execute("select modCode, modPackage from module where 
modName=%s", (modname, ))
row = curs.fetchone() # should only BE one ...S
if not row:
#print modname, "not found in db"
raise ImportError, "DB module %s not found in modules"
code, package = row
code = marshal.loads(code)
module = new.module(modname)
sys.modules[modname] = module
module.__name__ = modname
exec code in module.__dict__
module.__file__ = "db:%s" % modname
module.__loader__ = dbimporter
if package:
module.__path__ = sys.path
exec code in module.__dict__
print modname, "loaded:", repr(module), "pkg:", package
return module

def install():
sys.path_hooks.append(dbimporter)
sys.path_importer_cache.clear() # probably not necessary
sys.path.insert(0, "*db*") # probably not needed with a metea-path 
hook?

regards
 Steve
--
Steve Holden   http://www.holdenweb.com/
Python Web Programming  http://pydish.holdenweb.com/
Holden Web LLC  +1 703 861 4237  +1 800 494 3119
--
http://mail.python.org/mailman/listinfo/python-list


Re: [perl-python] 20050124 classes & objects

2005-01-24 Thread Gian Mario Tagliaretti
Chris Mattern wrote:

> 
> It doesn't have OO, but it emulates in software!
> Better go with python, which has hardware OO. :-)

Chris don't feed the troll
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: What is print? A function?

2005-01-24 Thread Philippe C. Martin
Why don't you redirect stdout or stderr


#***
class Debug_Stderr:
  __m_text = ''
  __m_log_text = None
  __m_dbg = None
  __m_refresh_count = 0
#***
  def __init__(self):
#***
  def write(self,p_string):
 #your code here




.
.
.
my_debug = Debug_Stderr()
sys.stderr = my_debug

print >> sys.stderr, 'this will go into the above write method'





-- 
***
Philippe C. Martin
SnakeCard LLC
www.snakecard.com
***

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


Tuple slices

2005-01-24 Thread George Sakkis
Why does slicing a tuple returns a new tuple instead of a view of the existing 
one, given that
tuples are immutable ? I ended up writing a custom ImmutableSequence class that 
does this, but I
wonder why it is not implemented for tuples.

George


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


RE: Tuple slices

2005-01-24 Thread Batista, Facundo
Title: RE: Tuple slices





[George Sakkis]


#- Why does slicing a tuple returns a new tuple instead of a 
#- view of the existing one, given that
#- tuples are immutable ? I ended up writing a custom 
#- ImmutableSequence class that does this, but I
#- wonder why it is not implemented for tuples.


What exactly is "a view of the existing one"?


And how do you return it without creating a new object? 


Could you send an example?


Thanks.


.    Facundo


Bitácora De Vuelo: http://www.taniquetil.com.ar/plog
PyAr - Python Argentina: http://pyar.decode.com.ar/



  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

ADVERTENCIA.


La información contenida en este mensaje y cualquier archivo anexo al mismo, son para uso exclusivo del destinatario y pueden contener información confidencial o propietaria, cuya divulgación es sancionada por la ley.

Si Ud. No es uno de los destinatarios consignados o la persona responsable de hacer llegar este mensaje a los destinatarios consignados, no está autorizado a divulgar, copiar, distribuir o retener información (o parte de ella) contenida en este mensaje. Por favor notifíquenos respondiendo al remitente, borre el mensaje original y borre las copias (impresas o grabadas en cualquier medio magnético) que pueda haber realizado del mismo.

Todas las opiniones contenidas en este mail son propias del autor del mensaje y no necesariamente coinciden con las de Telefónica Comunicaciones Personales S.A. o alguna empresa asociada.

Los mensajes electrónicos pueden ser alterados, motivo por el cual Telefónica Comunicaciones Personales S.A. no aceptará ninguna obligación cualquiera sea el resultante de este mensaje.

Muchas Gracias.



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

Re: Memory Usage

2005-01-24 Thread Stephen Kellett
In message <[EMAIL PROTECTED]>, rbt <[EMAIL PROTECTED]>
writes
>That's right. I look at that column. Should I measue mem usage in some
>other way?

Try VM Validator, a free memory visualization tool from Software
Verification.

http://www.softwareverify.com
http://www.softwareverify.com/vmValidator/index.html

It shows paged memory usage and also Virtual Memory manager usage on
separate tabs. Colour coded visual representation of each 4K page of
memory.

Probably more use on more memory intensive applications than yours, but
may still shed some light all the same. Either launch Python from VM
Validator, or inject VM Validator into your running Python.exe process.

Stephen
-- 
Stephen Kellett
Object Media Limitedhttp://www.objmedia.demon.co.uk
RSI Information:http://www.objmedia.demon.co.uk/rsi.html
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Import from database

2005-01-24 Thread Kartic
Steve,

I believe you have to put ntpath, macpath and posixpath in the module
database for os.path to work.

I tried it with zipimporter builtin and I got the same traceback till I
added ntpath.py to my zip file. (Of course, I renamed the original
ntpath to _ntpath so that the original did not get imported)
Thanks,
--Kartic

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


  1   2   3   >