[ANN] Release 0.31 of Task Coach

2005-04-18 Thread Frank Niessink
Hi all,
I am pleased to announce release 0.31 of Task Coach. Here is a list of 
the changes.

Note:
- Task Coach was migrated to Python 2.4.1 and wxPython 2.5.5.1. Added
  check to give friendly message if wxPython version is below the
  required version number.
Bugs fixed:
- A unittest.py bug that was fixed in Python 2.4 revealed a
  bug in test.py (1181714).
- When searching for a task that is completed, while the
  'show completed' switch is off, the search shows the path to
  the task (i.e. parent tasks), but not the matched task itself
  (1182528).
- When searching for tasks in the tree view, composite tasks
  are expanded automatically to show the children that match
  the search string (1182528).
- Columns were hidden by setting their width to 0, but that did not
  make them entirely invisible on some Linux platforms (1152566).
- When editing a subtask, sometimes its branch would be
  collapsed (1179266).
Features added:
- In the task list and effort list the task column is automatically
  resized to take up the available space.
- Added columns to the task list view for: budget, total budget,
  budget left, and total budget left.
- Reorganized view menu, added extra task filters, added menu item to
  reset filters (1181762, 1178882, 1178780).
- The subject is selected in the task editor so that replacing it
  is a bit easier (1180887).
What is Task Coach?
Task Coach is a simple task manager that allows for hierarchical
tasks, i.e. tasks in tasks. Task Coach is open source (GPL) and is
developed using Python and wxPython. You can download Task Coach from:
http://taskcoach.niessink.com
https://sourceforge.net/projects/taskcoach/
A binary installer is available for Windows XP, in addition to the
source distribution.
Thanks, Frank
--
http://mail.python.org/mailman/listinfo/python-announce-list
   Support the Python Software Foundation:
   http://www.python.org/psf/donations.html


CFP: DLS05: ACM Dynamic Languages Symposium

2005-04-18 Thread Roel Wuyts
   CALL FOR PAPERS FOR THE
   ACM Dynamic Languages Symposium 2005
October 18, 2005
San Diego, California
  (co-located with OOPSLA'05)
   URL: http://decomp.ulb.ac.be:8082/events/dls05/
---
Abstract
---
In industry, static languages (such as Java, C++ and C#) are much more 
widely used than their dynamic counterparts (like CLOS, Python, Self, 
Perl, php or Smalltalk). So it appears as though dynamic language 
concepts were forgotten and lost the race.

But this is not the case.
Java and C#, the latest mainstream static languages, popularized to a 
certain extent dynamic language features such as garbage collection, 
portability and (limited forms of) reflection. In the near future, we 
expect this dynamicity to increase even further. E.g., it is getting 
clearer year after year that pervasive computing is becoming the rule 
and that concepts such as meta programming, reflection, mobility, 
dynamic reconfigurability and distribution are becoming increasingly 
popular. All of these features are the domain of dynamic languages, and 
hence it is only logical that more dynamic language concepts have to be 
taken up by static languages, or that dynamic languages can make a 
breakthrough.

Currently, the dynamic language community is fragmented, split over a 
multitude of paradigms (from functional over logic to object-oriented), 
languages and syntaxes. This fragmentation severely hinders research as 
well as acceptance, and results in either language wars or, even worse, 
language ignorance. The goal of this symposium is to provide a highly 
visible, international forum for researchers working on dynamic 
features and languages. We explicitly invite submissions from all kinds 
of paradigms (object-oriented, functional, logic, ...), as can be seen 
from the structure of the program committee.

Areas of interests include, but are not limited to:
- closures
- delegation
- actors, active objects
- constraint systems
- mixins and traits
- reflection and meta-programming
- language symbiosis and multi-paradigm languages
- experience reports on successful application of dynamic languages
Accepted Papers will be published in the ACM Digital Library.
---
Submission Guidelines
---
Papers will need to be submitted using an online tracking system, of 
which the URL will be given later.

All papers must be submitted electronically in PDF format (or 
PostScript, if you do not have access to PDF-producing programs, but 
this is not recommended). Submissions, as well as final versions, must 
be formatted to conform to ACM Proceedings requirements: Nine point 
font on ten point baseline, two columns per page, each column 3.33 
inches wide by 9 inches tall, with a column gutter of 0.33 inches, etc. 
See the ACM Proceedings Guidelines. You can save preparation time by 
using one of the templates from that page. Note that MS Word documents 
must be converted to PDF before being submitted.

--
 Important Dates
--
- Deadline for receipt of submissions: June 24th 2005
- Notification of acceptance or rejection: August 5th 2005
- Final version for the proceedings: To be announced later
---
Program Committee
---
- Gilad Bracha
- Wolfgang De Meuter
- Stephane Ducasse
- Gopal Gupta
- Robert Hirschfeld
- Dan Ingalls
- Yukihiro Matsumoto
- Mark Miller
- Eliot Miranda
- Philippe Mougin
- Oscar Nierstrasz
- Dave Thomas
- David Ungar
- Guido Van Rossum
- Peter Van Roy
- Jon L White (G)
- Roel Wuyts (Chair)
--
Roel Wuyts  
  DeComp
[EMAIL PROTECTED]   Université Libre de 
Bruxelles
http://homepages.ulb.ac.be/~rowuyts/
Belgique
Vice-President of the European Smalltalk Users Group: www.esug.org

--
http://mail.python.org/mailman/listinfo/python-announce-list
   Support the Python Software Foundation:
   http://www.python.org/psf/donations.html


[ANN] QaTeX 0.1.1

2005-04-18 Thread Jonathan Fine
I'm pleased to announce the release of version 0.1.1 of QaTeX.
Here is a brief description of the package.
(La)TeX macro programming is hard. Python is a powerful and
easy to use scripting language. QaTeX allows Python modules
to be used instead of (La)TeX style files. With QaTeX
(pronounced `kwa-tech') TeX asks Questions and Python
provides Answers.
This release provides proof-of-concept.  It is known to run under
Linux and Mac OS/X.
QaTeX is not yet secure, so please don't use it with
untrusted documents.
Another problem is that QaTeX does not yet run under Windows.
QaTeX is released under the GPL.
This release, and further information, is available via the
project home page:
   http://qatex.sourceforge.net
--
Jonathan
--
http://mail.python.org/mailman/listinfo/python-announce-list
   Support the Python Software Foundation:
   http://www.python.org/psf/donations.html


Re: Canceling/interrupting raw_input

2005-04-18 Thread Daniel Cer
For what it's worth, this looks like a Windows specific problem.
The code below seems to work as expected on a Linux box. That is, 
everything terminates, including the inputLoop, after sys.exit() is 
called, without the user needing to press 'enter' one last time.

However, if I try to run the code on Windows XP, it exhibits the exact 
same behavior you described.

#!/usr/bin/python
import thread
import time
import sys
def inputLoop():
 while 1:
 input_string = raw_input(Type something: )
 print You entered: , input_string
thread.start_new_thread(inputLoop, () )
time.sleep(15)
sys.exit()
-Dan
J. W. McCall wrote:
I'm working on a MUD server and I have a thread that gets keyboard input 
so that you can enter commands from the command line while it's in its 
main server loop.  Everything works fine except that if a player enters 
the 'shutdown' command, everything shuts down, but the input thread is 
still sitting waiting for enter to be pressed for raw_input.  After 
enter is pressed, it exits back to the command prompt as it should.

I'm wondering if there's a way that I can make the thread stop waiting 
for input.  Even sys.exit() still leaves it waiting.  It's not a big 
deal, but it bugs me.

Any ideas?  Should I be using something other than raw_input?  I'm on 
Windows2000 and running this from the DOS prompt.  I'm using Python 2.4.
--
http://mail.python.org/mailman/listinfo/python-list


Re: variables exist

2005-04-18 Thread Peter Otten
Michael J. Fromberger wrote:

 Would the following be a satisfactory implementation?
 
   def isset(varname, lloc = locals()):
 return varname in lloc or varname in globals()
 
 I believe this works as desired:
 
x = 5
def f(y):
   ...   z = 10
   ...   print isset('z')   ## == True
   ...   print isset('y')   ## == True
   ...   print isset('x')   ## == True
   ...
 
 Tests:
f(1)  ## As shown above

No, try it again in a fresh interpreter:

 def isset(name, loc=locals()):
... return name in loc or name in globals()
...
 x = 5
 def f(y):
... z = 10
... print isset(x), isset(y), isset(z)
...
 f(42)
True False False


It may seem from the above that at least the global variable x is found
correctly, but beware, the global namespace where isset() is defined is
searched, not the one where it is called. Untested:

def isset(name):
frame = sys._getframe(1)
return name in frame.f_locals or name in frame.f_globals

might work, but is too magic for my taste.

Peter

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


Re: Canceling/interrupting raw_input

2005-04-18 Thread Daniel Cer
Just a little bit of a follow up on this...
If you use win32api.TerminateProcess() instead of sys.exit(), everything 
works as it should on Windows. That is, there is no longer a need to hit 
'enter' one last time in order to get inputLoop to terminate.

So, modifying the sample code I posted earlier, the new Win32 specific 
code would be the following:

import thread
import time
import sys
import win32api
def inputLoop():
 while 1:
 input_string = raw_input(Type something: )
 print You entered: , input_string
thread.start_new_thread(inputLoop, () )
time.sleep(3)
print \nTime's up exiting
win32api.TerminateProcess(-1, 0)
-Dan
Daniel Cer wrote:
For what it's worth, this looks like a Windows specific problem.
The code below seems to work as expected on a Linux box. That is, 
everything terminates, including the inputLoop, after sys.exit() is 
called, without the user needing to press 'enter' one last time.

However, if I try to run the code on Windows XP, it exhibits the exact 
same behavior you described.

#!/usr/bin/python
import thread
import time
import sys
def inputLoop():
 while 1:
 input_string = raw_input(Type something: )
 print You entered: , input_string
thread.start_new_thread(inputLoop, () )
time.sleep(15)
sys.exit()
-Dan
J. W. McCall wrote:
I'm working on a MUD server and I have a thread that gets keyboard 
input so that you can enter commands from the command line while it's 
in its main server loop.  Everything works fine except that if a 
player enters the 'shutdown' command, everything shuts down, but the 
input thread is still sitting waiting for enter to be pressed for 
raw_input.  After enter is pressed, it exits back to the command 
prompt as it should.

I'm wondering if there's a way that I can make the thread stop waiting 
for input.  Even sys.exit() still leaves it waiting.  It's not a big 
deal, but it bugs me.

Any ideas?  Should I be using something other than raw_input?  I'm on 
Windows2000 and running this from the DOS prompt.  I'm using Python 2.4.
--
http://mail.python.org/mailman/listinfo/python-list


Re: Do You Want To Know For Sure That You Are Going To Heaven? The reason some people don't know for sure if they are going to Heaven when they die is because they just don't know. The good news is that you can know for sure that you are going to Heaven wh

2005-04-18 Thread thesonoftruth
I wonder if anyone yells VISHNU !!  VISHNU !  when making
out,

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


Re: ANN: Veusz 0.5 - a scientific plotting package

2005-04-18 Thread hemanth
Why not matplotlib? Of late, it has seemed to have picked up
a lot of attention. I would prefer that the different plotting
packages developers join hands and implement missing features
into a single plotting package and make this a part of Python
standard library. In contrast to the various web frameworks we
now have in Python, it is preferable to have atleast one plotting
package as a standard Python package.

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


Re: MS SQL Server/ODBC package for Python

2005-04-18 Thread Francois Lepoutre
Hi Peter
Running your benchmark, I ran into a couple of interesting points.
Using mx.ODBC, my times were 0.54 seconds and 6.56 seconds
respectively, while using adodbapi my results are 3.55 seconds and 25.9
seconds respectively.  mx.ODBC is faster with the simple query you
provide.
We agree on figures at this stage :)
Next I modified the benchmark to reflect my particular circumstances
more accurately [...] reduce the number of iterations from 100
to 10.  Since there are 128000 records in the main table, the wait for
100 iterations was too long for my patience.  Under these
circumstances, mx.ODBC's numbers are 188.49 seconds and 377.56 seconds
respectively, and adodbapi's times are 111.15 seconds and 223.55
seconds respectively.
This is an interesting feedback. It looks like both middleware have
their distinct value and distinct set of advantages.
I'll definitely review my judgment on ADO!
My first wall-clock impressions are obvious exaggerations of reality,
for which I duly apologize to all.  However, adodbapi did prove to be
faster in my admittedly very wacky common use case.  Slower to connect,
but faster to run a substantial query.

Comments?  Questions?  Suggestions for improvement?
Based on your results, my feeling is that mx.ODBC remains a solution
of choice for db-support behing web services à la mod_python
where connection time is essential whilst adodbapi would be the
definite winner when it comes to typical db-intensive win32-based
applications (such as wxpython-based ones).
Regards to you
Francois
--
http://mail.python.org/mailman/listinfo/python-list


Parse command line options

2005-04-18 Thread hue
I am trying to parse command line options using getopt module.

I have written the following Code

import string

import getopt

def usage():
print '''haarp_make.py -- uses getopt to recognize options

Options: -n  -- No
 -t  -- Time
 -h  -- help
 -i  -- image_file
 -o  -- Output:filename'''

sys.exit(1)

def main():


try:

opts,args = getopt.getopt(sys.argv[1:], 'n:t:h:i:o:',
[Number=,time=,help=,image_file=,Output Filename=])

except getopt.GetoptError:
print 'Unrecognized argument or option'
usage()
sys.exit(0)



I have gone through getopt module from the help in python Library, but
i couldnot proceed from here.

My Task is

python  MyScriptName.py  n  t  h  i  o

How to parse those arguments, i is an Image File.
Please try to give some comments.
Hoping for a reply.

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


Re: need help in PySparse

2005-04-18 Thread David Fraser
monocalibro wrote:
Hello all!
I need ready-for-use installable version of PySparse (for FiPy), because I
can't compile it with MingW. Or, may be, somebody knows step-by-step
instruction to complie this package under Win32 using Mingw?
Best regards

At least describe the web site you got it from, the versions of Python 
and MinGW you are using, and the errors you got when you tried to build it.

See here for more info on how to ask questions:
http://www.catb.org/~esr/faqs/smart-questions.html
David
--
http://mail.python.org/mailman/listinfo/python-list


Re: Apache mod_python

2005-04-18 Thread David Fraser
Dan wrote:
I've been writing a server application in Python.  The app listens on
a socket and interfaces to a database.
Now I'd like to write a web application to also access the database.
It seems natural to use Python.  I've installed mod_python (Debian
libapache2-mod-python2.3, mod_python 3.1.3-4).
My question is, how mature/stable is mod_python?  Is it suitable for a
production environment?  The documentation is a bit lacking, and I've
found some errors in the demo example where it looks like the link
should work, but it doesn't. (Could well be something I'm doing.).
I've also noted that there's still work being done on it.
Hi Dan
mod_python is quite mature and stable and usable in a production 
environment. However it is fairly low level and a lot of people like to 
add another framework on top of it.
If you point out the documentation problems you're having then people 
can say whether you're making a mistake or there is really an error

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


Re: Parse command line options

2005-04-18 Thread Klaus Alexander Seistrup
Hue wrote:

 try:

 opts,args = getopt.getopt(sys.argv[1:], 'n:t:h:i:o:',
 [Number=,time=,help=,image_file=,Output Filename=])

 except getopt.GetoptError:
 print 'Unrecognized argument or option'
 usage()
 sys.exit(0)

Proceed with e.g.:

#v+

for (opt, arg) in opts:
if opt in ('-n', '--No'):
do_no()
elif opt in ('-t', '--Time'):
do_time()
# [...]
else:
barf(opt, arg)
# end if
# end for

#v-

But be consistent when using long options: use all lowercase, use either
dashes or underscores (not both), don't use whitespace.

I usually do something like:

#v+

Options = {
'i:': 'input=',
'o:': 'output=',
'c' : 'copyright',
'h' : 'help',
'v' : 'version',
}
shortOpts = ''.join(Options.keys())
longOpts  = Options.values()

# [...]

try:
(opts, args) = getopt.getopt(argv[1:], shortOpts, longOpts)
except getopt.error, msg:
die(msg)
# end try

# [...]

for (opt, arg) in opts:
# Handle all options
:
# end for

#v-

Additional, non-option, arguments will be in the args variable.

Cheers,

-- 
Klaus Alexander Seistrup
Magnetic Ink, Copenhagen, Denmark
http://magnetic-ink.dk/
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python 2.4 killing commercial Windows Python development ?

2005-04-18 Thread Stefan Behnel
Roger Binns schrieb:
As far as I can tell, they failed at two hurdles.  One is that there
is a new BitPim release every two weeks and they can't really keep up
with that.  (eg it takes around two weeks for packages with a lot of
attention on Gentoo to become stable and often is a lot longer)
This is why many open source projects include (possibly outdated) .spec 
files directly in their tree. Makes it easy to just adapt them and run 
rpmbuild. Similar for Debian package specs.

With Python sources it is even easier (most of the time) since you can run
python setup.py bdist_rpm
which spits out a readily baken RPM, ready to be nailed into the system. 
Sadly, this doesn't exist for Debian and it doesn't work for all Python 
packages (Twisted, that is).

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


Re: Glade for Windows and Python

2005-04-18 Thread flupke
Richard Lyons wrote:
Has anyone been successful in using Glade for Windows with Python?
Yeah, i'm using it right now.
See the previous email for the links
Benedict
--
http://mail.python.org/mailman/listinfo/python-list


Re: Parse command line options

2005-04-18 Thread Tim Daneliuk
hue wrote:
SNIP
try:
opts,args = getopt.getopt(sys.argv[1:], 'n:t:h:i:o:',
^^^
  This may be the problem.  As I recall, a colon following an option
  indicates that it is followed by an argument as in -f filename.
  For options that are just switches (that take no argument), I believe
  they should appear in the list above *without* the colon suffix...

--

Tim Daneliuk [EMAIL PROTECTED]
PGP Key: http://www.tundraware.com/PGP/
--
http://mail.python.org/mailman/listinfo/python-list


distutils, PyBison and Mac OS X

2005-04-18 Thread Maarten Sneep
I'm trying to build PyBison[1] on Mac OS X, and I'm running into some
problems with the distutils.

Just for starters: PyBison requires Pyrex[2]. This is not a problem,
and Pyrex seems to work without problems, at least the primes sample
module shows a nice 25 to 30 fold speed increase over the pure python
version.

I used the distutils to create the module from the primes.pyx sample,
following the setup.py from the PyBison distrubution:

[code]
from distutils.core import setup, Extension
from Pyrex.Distutils import build_ext

setup( name = primes, version = 1.0,
  description=Pyrex sample for calculating prime numbers,
  author='Greg Ewing', 
  url='http://www.cosc.canterbury.ac.nz/~greg/python/Pyrex/',
  ext_modules=[Extension(primes, [primes.pyx])],
  cmdclass = {'build_ext': build_ext}
)
[/code]

I mention this, because PyBison seems to use the distutils to compile
the bison and flex source code on the fly, but fails to pick up some
parameters, which prevents it from working correctly.

Although Mac OS X uses gcc, and is an otherwise pretty complete unix
install, it is missing some components: shared libraries are not
linked with -shared but use -bundle instead. A succesful build of
primes is linked with:

export MACOSX_DEPLOYMENT_TARGET=10.3; gcc -Wl,-F. -Wl,-F. \
-bundle -undefined dynamic_lookup \
build/temp.darwin-7.9.0-Power_Macintosh-2.3/primes.o \
-o primes.so

(Another difference that caused major headaches: the absense of a
'dl' library has been resolved with version 10.3 (Panther). A dl
library is included as a wrapper around the bundles mechanism that
were present all along. Since the linux version uses the dl library,
I tried to compile the same source, and that part seems to run just
fine).

The issues: 

- distutils.ccompiler uses the unixcompiler, which has hard coded a
  cc -shared to create shared objects. I've tried to override this,
  but no luck there (other issues seem to crop up). Is this a known
  issue with distutils?
  
  I installed pybison using the linux C-source, and tried it out
  using the 'calc' example. After setting verbose=1 in the run.py,
  and enabling the int lineno = 0 in calc.py, the compilation phase
  finishes without a hitch, but linking fails badly:
  
bisonCmd=['bison', '-d', '-v', '-t', 'tmp.y']
renaming bison output files
tmp.tab.c = tmp.bison.c
tmp.tab.h = tokens.h
cc: unrecognized option `-shared'
ld: Undefined symbols:
_main
_PyInt_FromLong
_PyObject_GetAttrString
_PyObject_HasAttrString
_PyObject_SetAttrString
_PyString_AsString
_PyString_FromString
_PyTuple_New
_PyTuple_SetItem
__Py_NoneStruct
Traceback (most recent call last):
  File run.py, line 7, in ?
parser = calc.Parser(verbose=1, keepfiles=1)
  File . . ./python2.3/site-packages/bison.py, line 308, 
in __init__ self.engine = ParserEngine(self)
  File bison_.pyx, line 187, in bison_.ParserEngine.__init__
  File bison_.pyx, line 202, in 
bison_.ParserEngine.openCurrentLib
  File bison_.pyx, line 540, in bison_.ParserEngine.buildLib
  File . . ./python2.3/distutils/ccompiler.py, line 843, 
in link_shared_object extra_preargs, extra_postargs, 
build_temp, target_lang)
  File . . ./python2.3/distutils/unixccompiler.py, line 178, 
in link raise LinkError, msg
distutils.errors.LinkError: command 'cc' failed with exit status 1
  
- Would it be possible to modify PyBison to use a call to the 
  distutils.core.setup(. . .) function and call that as if 'python 
  setup.py build_ext --inplace' had been called from the command line, 
  since that seems to pick up the correct options.
  
- Where do I start: distutils is pretty large, and it seems to have
  the right options, but they just aren't used in PyBison.

Thanks in advance for any insights that get me going,

Maarten

Links:
[1] http://www.freenet.org.nz/python/pybison/
[2] http://www.cosc.canterbury.ac.nz/~greg/python/Pyrex/
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: re module methods: flags(), pattern()

2005-04-18 Thread Andr Sreng
A flag is just an int. From the re doc, you can see
there is a ignorecase flag:

I
IGNORECASE
Perform case-insensitive matching; expressions like [A-Z] will 
match lowercase letters, too. This is not affected by the current locale.


Using the ignorecase flag:
 import re
 print re.I
2
 print re.IGNORECASE
2
 r = re.compile(hello, re.IGNORECASE)
 print r.pattern
'hello'
 match = r.search(heLLo)
 match.group()
'heLLo'
As the doc says, you can combine several flags with the '|' operator:
r = re.compile(your_regexp, re.SOMEFLAG|re.SOMEOTHERFLAG)
Xah Lee wrote:
Python re module has methods flags and pattern. How to use these
exactly?
e.g. i tried
print patternObj.flags()
and the error is some int object is not callable.
newpattern=re.compile(ur'\w+',patternObj.flags())
also bad.
similar error for patternObj.pattern(). (and i suppose the same for
groupindex() )
thanks.
 Xah
 [EMAIL PROTECTED]
 http://xahlee.org/
--
http://mail.python.org/mailman/listinfo/python-list


Re: pre-PEP: Suite-Based Keywords

2005-04-18 Thread Reinhold Birkenfeld
Bengt Richter wrote:
 On Sun, 17 Apr 2005 15:25:04 +0200, Reinhold Birkenfeld [EMAIL PROTECTED] 
 wrote:

 Note that there is no problem adding other parameters, because ::suite is 
 just
 a unary expression returning dict subtype instance, e.g.,
 
 y = f(11,22,**::
x = 1
y = 'y for f'
 )*g(*args_from_somewhere, **::
x = 'x for g'
y = 'y for g'
def foo(): return 'foo for g'
 )

You know that this is dead ugly?
 What aspect in particular?

The '**::', for example. I would surely prefer a keyword instead of '::'.

 I.e., does this (currently legal) look prettier:
 
y = f(11,22, **dict(
   x = 1,
   y = 'y for f'
))*g(*args_from_somewhere, **dict(
   x = 'x for g',
   y = 'y for g',
   foo = lambda: return 'foo for g'
))

No, it doesn't. And I surely wouldn't write such code.

y = (f(11, 22, x=1, y='y for f') *
 g(*args_from_somewhere, x='x for g', y='y for g', foo=lambda: return 'foo 
for g'))

or, if you tolerate more lines,

y = (f(11, 22, x=1, y='y for f') *
 g(*args_from_somewhere,
   x='x for g', y='y for g',
   foo=lambda: return 'foo for g'))

would be my current way to express this. But still, the less lines,
the less confusing it is.

 Can you express the same semantics in a prettier way?
 
 To boil it down, doesn't a suite bindings expression like
 
   d = ::
   x = 1
   y = 'y for f'
 
 (which in this case doesn't even need parens) seem prettier than
 
   d = dict(
   x = 1,
   y = 'y for f'
   )
 
 to you, especially given that (:: ...) gives you the power
 of full suite syntax to create bindings
 any way you want[1], not just keyword=expression ?
 (and you can leave out the commas ;-)

I understand the general idea, but still I don't like the idea of suite 
expressions.
My main concern is the following: After a suite expression, where does code
follow?

As in your example:

y = f(**::
   x = 1   # indented one level, as indents can go any number of spaces
 ) # indented one level too, but differently (currently an 
IndentantionError)

 [1] I.e., this should work to extend the power of the type expression in a way
 that shows what you can't do with dict(...) ;-)
 
  type('C', (), ::
  def __repr__(self):
  return 'alternatively-created-class-object at %08x'% 
 (hex(id(self)(2L**32-1))
  def cname(self): return type(self).__name__
  classvar = 123
  # ... anything you can do in a class definition body
  )
 
 IMO that's pretty clean.

Uses are neat, i concur.

The real ``problem'' (if you see one) is that the indentation syntax
doesn't allow for suites in expressions.
 
 I was trying to solve that problem with my suite expressions ;-)
 
::suite  # suite bindings expression (as ordered dict)
def(arglist):suite # anonymous def
(arglist):suite# thunk (anonymous callable suite sharing local 
 namespace)
 
 I think suite indentation rules for suite expressions are not that hard, once 
 you decide
 to deal with it as a separate indentation space from outside the expression. 
 That's already
 done to allow multiline expressions without indentation interpretation inside 
 bracketed expressions.
 This is just adding indentation processing within certain types of 
 expressions (suite expressions ;-)
 
 For the most part I like indentation syntax very well, and
 I suspect that if there were optional brackets, you would still be indenting
 for clarity, so the chances are the bracket version of the above would
 mainly add bracket noise to something close to the above.

I don't say brackets are better, but the problem of where to put the following 
code
is tricky.

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


Re: ANN: Veusz 0.5 - a scientific plotting package

2005-04-18 Thread Jeremy Sanders
On Mon, 18 Apr 2005 00:55:17 -0700, hemanth wrote:

 Why not matplotlib? Of late, it has seemed to have picked up a lot of
 attention. I would prefer that the different plotting packages developers
 join hands and implement missing features into a single plotting package
 and make this a part of Python standard library. In contrast to the
 various web frameworks we now have in Python, it is preferable to have
 atleast one plotting package as a standard Python package.

I made a reply on this subject to the SciPy mailing list:
 http://www.scipy.org/mailinglists/mailman?fn=scipy-user/2005-April/004312.html

Basically my main issue was the baroque object structure that matplotlib
used (it may have got better then), and its speed (which has).

The difficulty of writing a plotting package is the user interface, and so
I don't think I'm wasting much effort by having my own plotting routines.
I've done 90% of what's needed there. Basically, I'll be happy when
contouring and images are added.

The advantage of Veusz is the nice object-based system of building up a
plot.

I have a version of veusz which used matplotlib as a backend, but I
abandoned that several months ago.

Jeremy

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


Re: Do You Want To Know For Sure That You Are Going To Heaven? The reason some people don't know for sure if they are going to Heaven when they die is because they just don't know. The good news is that you can know for sure that you are going to Heaven wh

2005-04-18 Thread Mike brown
In article [EMAIL PROTECTED],
thesonoftruth [EMAIL PROTECTED] wrote:

 I wonder if anyone yells VISHNU !!  VISHNU !  when making
 out,


I might have.

It's been so long that I've forgotten.

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


[PythonWin] MakePy and gencache.EnsureModule() do different things.

2005-04-18 Thread Paul Keating
I used MakePy to generate .py support for a COM dll. That created the
file

30D58DAF-B538-45F1-8EFF-F69ABA2BA798x0x1x13.py

I want to be sure that this file is present and so I used MakePy -i to
construct a call to gencache.EnsureModule().

This is what it said:

{30D58DAF-B538-45F1-8EFF-F69ABA2BA798}, lcid=0, major=1, minor=13
  # Use these commands in Python code to auto generate .py support
  from win32com.client import gencache
  gencache.EnsureModule('{30D58DAF-B538-45F1-8EFF-F69ABA2BA798}',
0, 1, 13)

But when I execute this code, it creates the support as a package,
that is, there is a _folder_ called

30D58DAF-B538-45F1-8EFF-F69ABA2BA798x0x1x19

(NB minor version is 19 not 13) with separate .py files for each
interface and class inside, and an __init__.py.

If the EnsureModule() call has not been called to generate the
package, then win32com.client.CastTo() fails when called with a
class-instance and interface defined in the COM dll. It complains that
it can't find the package ...x19.

Can anyone explain the version number difference (I realize that
19=0x13 but that doesn't help me understand it much), the
package/single file difference, and why Dispatch responds to the one,
but CastTo expects the other?
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Compute pi to base 12 using Python?

2005-04-18 Thread Nick Craig-Wood
[EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
  Nick Craig-Wood wrote:
  [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
I'm using GMPY (see code).
  [snip]
 
  If you are using gmpy you might as well do it like this.
 
  gmpy.pi() uses the Brent-Salamin Arithmetic-Geometric Mean formula
  for
  pi IIRC.  This converges quadratically, and it will calculate you a
  million places without breaking a sweat.
 
  It would be nice if that were documented. What do I have to do, go get
  the documentation for the original GMP to find out what else is in GMPY
  that they didn't include in the doc file?

pydoc gmpy works for me.  Not sure how you use pydoc on windows, but
you can do this...

 import gmpy
 help(gmpy)
Help on module gmpy:

NAME
gmpy

FILE
/usr/lib/python2.3/site-packages/gmpy.so
[snip]
Help on built-in function pi:

pi(...)
pi(n): returns pi with n bits of precision in an mpf object
[snip]

The original gmp documentation is sensible also, since gmpy is really
just a thin wrapper to it.  There is also the gmp source code too.

-- 
Nick Craig-Wood [EMAIL PROTECTED] -- http://www.craig-wood.com/nick
-- 
http://mail.python.org/mailman/listinfo/python-list


Strings and Lists

2005-04-18 Thread Tom Longridge
My current Python project involves lots repeatating code blocks,
mainly centred around a binary string of data. It's a genetic
algorithm in which there are lots of strings (the chromosomes) which
get mixed, mutated and compared a lot.

Given Python's great list processing abilities and the relative
inefficiencies some string operations, I was considering using a list
of True and False values rather than a binary string.

I somehow doubt there would be a clear-cut answer to this, but from
this description, does anyone have any reason to think that one way
would be much more efficient than the other? (I realise the best way
would be to do both and `timeit` to see which is faster, but it's a
sizeable program and if anybody considers it a no-brainer I'd much
rather know now!)

Any advice would be gladly recieved.
-- 
http://mail.python.org/mailman/listinfo/python-list


Removing dictionary-keys not in a set?

2005-04-18 Thread Tim N. van der Leeuw
Hi,

I'd like to remove keys from a dictionary, which are not found in a
specific set. So it's kind of an intersection-operation.

I can create a new dictionary, or a loop over all keys and test them
for set-membership, but I was wondering if there was a smart way to
express this in 1 or 2 concise statements that I'm not aware of.

So are there smarter ways to get the intersection of dictionary and set
into a dictionary than the following pseudo-code:

# Variation 1
d2 = {}
for key in s: d2[key] = d1[key]

# Variation 2
for key in d.iterkeys(): if key not in s: del d[key]


And if there's no smarter way, then which of these two options would
give best performance?

Cheers,

--Tim

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


Problem using py2exe

2005-04-18 Thread Glauco Silva




Hi,
I´m with problem to create a executable program in 
python. 
I´m using py2exe but i don´t know if it´s 
right.
My setup.py:

from distutils.core import setupimport 
py2exefrom glob import glob

setup( # The first three 
parameters are not required, if at least a # 'version' is 
given, then a versioninfo resource is built from # them 
and added to the executables. version = 
"2.0", description = "programa 
InVesalius", name = "InVesalius",

 # targets to 
build console = 
["C:\\promed2.0\\python\\MyMainModule.py"], 
data_files=[("icons", 
glob("C:\\promed2.0\\icons\\*.*")), 
("docs",glob("C:\\promed2.0\\docs\\*.*")), 
("config", 
["C:\\promed2.0\\setup.cfg"]) 
],packages = ['vtk-windows', 
'vtk-windows.vtk', 
'vtk-windows.vtk.gtk', 
'vtk-windows.vtk.qt', 
'vtk-windows.vtk.tk', 
'vtk-windows.vtk.util', 
'vtk-windows.vtk.wx', 'vtk-windows.vtk.test'],  
)
When i run in prompt"python setup.py py2exe", 
appear in the end this:

###
The following modules appear to be missing[ 
'_imaging_gif','libVTKCommonPython', 'libVTKContribPython', 
'libVTKGraphicsPython', 'libVTKImagingPython', 'libVTKPatentedPython', 
libvtkCommonPython', 'libvtkFilteringPython', 'libvtkGraphicsPython', 
'libvtkHybridPython', 'libvtkIOPython', 
'libvtkImagingPython','libvtkParallelPython', 'libvtkPatentedPython', 
'libvtkRenderingPython', 'numarray.array', 'numarray.dot', 'numarray.fromfile', 
'numarray.size', 'numarray.zeros', 'vtk.vtkActor2D', 'vtk.vtkDCMParser', 
'vtk.vtkImageClip', 'vtk.vtkImageFlip', 'vtk.vtkImageImport', 
'vtk.vtkImageMagnify', 'vtk.vtkImageMapper', 'vtk.vtkImagePermute', 
'vtk.vtkImageReader', 'vtk.vtkImageResample', 
'vtk.vtkImageReslice','vtk.vtkImageShiftScale', 'vtk.vtkImageThreshold', 
'vtk.vtkImageViewer', 'vtk.vtkImageWriter', 'vtk.vtkRenderWindow', 
'vtk.vtkRenderer', 'vtk.vtkTextMapper', 'vtk.vtkTextProperty', 
'vtk.vtkTransform']
###

My PYTHONPATH = 
C:\Python23;C:\promed2.0\vtk-windows;C:\promed2.0\python

My dir:
##
promed2.0/ 
  setup.cfg 
   
setup.pyicons/ 
   
docs/   
 python/   

MyMainModule.py 

vtk-window/   

vtkpython.py   

vtkpythontk.py

  

 vtk.pth  

 vtkCommon.dll  

 vtkCommonPython.dll  

 vtkCommonTCL.dll 


 ...

vtk/ 

###

OS: win 2K
Python ver: 2.3.5py2exe ver: 
0.5.4


How can i solve this problem?

Thanks
Glauco
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.308 / Virus Database: 266.9.16 - Release Date: 18/4/2005
-- 
http://mail.python.org/mailman/listinfo/python-list

(Python newbie) Using XP-SP2/MSVC6: No Python24_d.lib, winzip barfs on Python-2.4.1.tar, cannot download bzip2

2005-04-18 Thread Bill Davy
I downlaoded and installed 
http://www.python.org/ftp/python/2.4.1/python-2.4.1.msi

I'm trying to build an extension using SWIG 1.3.24 and the linker needs
python24_d.lib (I do not have the DLL either).  I've not found it in any of 
the
downloads.

So I tried to download the source to build it myself.  Of
http://www.python.org/ftp/python/2.4.1/Python-2.4.1.tar.bz2 and
http://www.python.org/ftp/python/2.4.1/Python-2.4.1.tgz, WinZip (9.0 SR1)
just says Error reading header after processing 0 entries.

Additionally, I've had no joy downloading the unzipper
(ftp://sources.redhat.com/pub/bzip2/v102/bzip2-102-x86-win32.exe) from the
site cited for the unzipper (http://sources.redhat.com/bzip2/).  It flashed 
up a
black console window momentarily.

Oh, this is so frustrating! :-(

Can anyone point me in the right direction?

And then I can get to grips with my work.

tia
Bill


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


compiling python 2.4.1 on Linux_X86_64 using PGI compiler fails

2005-04-18 Thread Berthold Hllmann

I am trying to compile Python on an Opteron machine using the PGI C
compiler under Linux. I use:

CC=pgcc ./configure  --prefix=/usr/local/gltools/python/Python-2.2.1 \
   --exec-prefix=/usr/local/gltools/python/Python-2.2.1/$GL_ARCH \
   --with-cxx=pgCC

but make fails with:

pgCC  -Xlinker -export-dynamic -o python \
Modules/ccpython.o \
libpython2.4.a -lpthread -ldl  -lpthread -lutil   -lm  
libpython2.4.a(posixmodule.o)(.text+0x38d6): In function `posix_tmpnam':
: warning: the use of `tmpnam_r' is dangerous, better use `mkstemp'
libpython2.4.a(posixmodule.o)(.text+0x3841): In function `posix_tempnam':
: warning: the use of `tempnam' is dangerous, better use `mkstemp'
case $MAKEFLAGS in \
*-s*)  CC='pgcc' LDSHARED='pgcc -shared' OPT='-DNDEBUG -O' ./python -E 
./setup.py -q build;; \
*)  CC='pgcc' LDSHARED='pgcc -shared' OPT='-DNDEBUG -O' ./python -E ./setup.py 
build;; \
esac
make: *** [sharedmods] Error 139

and issuing the last command from the command line gives:

  CC='pgcc' LDSHARED='pgcc -shared' OPT='-DNDEBUG -O' ./python -E ./setup.py 
 build
Segmentation fault (core dumped)

This is with PGI 5.2 and 6.0.

Has anyone compiled python successfully using PGI compilers under 64
bit Linux. If yes, what are the neccesarry switches?

Thanks
Berthold
-- 
[EMAIL PROTECTED]  __   Address:
G /  \ L Germanischer Lloyd
phone: +49-40-36149-7374-++- Vorsetzen 35   P.O.Box 111606
fax  : +49-40-36149-7320  \__/   D-20459 HamburgD-20416 Hamburg
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Can a function be called within a function ?

2005-04-18 Thread Tim N. van der Leeuw
Hiya,

That's certainly possible, it's standard practice.

(It might be cleaner to pass filenames using parameters though)

cheers,

--Tim

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


Re: pydoc preference for triple double over triple single quotes--anyreason?

2005-04-18 Thread Kent Johnson
Brian van den Broek wrote:
Kent Johnson said unto the world upon 2005-04-17 16:17:
Brian van den Broek wrote:
Kent Johnson said unto the world upon 2005-04-16 16:41:
Brian van den Broek wrote:
I've just spent a frustrating bit of time figuring out why pydoc 
didn't extract a description from my module docstrings. Even though 
I had a well formed docstring (one line, followed by a blank line, 
followed by the rest of the docstring), when I ran Module docs, my 
modules showed up as having no description. (Module docs 
referring to the shortcut installed on Windows that launches the 
pydoc server.)
I'm not sure what you mean by the results list in the TKinter 
interface to the pydoc server. I ran the server, clicked open 
browser and browsed to a module in site-packages; that worked fine 
for me under Win2K and Python 2.4.1.

By the TKinter interface to the pydoc server I mean the window that 
pops up when you select the Module Docs shortcut. It is pictured here 
 http://www.onlamp.com/python/2001/04/18/graphics/pydoc1.gif, which is 
Fig.1 in an article on pydoc by Cameron Laird 
http://www.onlamp.com/pub/a/python/2001/04/18/pydoc.html. By results 
list I mean the gray-backround'ed box immediately below the Search 
for input box in the illustration.

The puzzle for me was that if I enter my module name in the Search for 
box, it shows up in the list of results, as expected. But whether the 
results list entry for my module incorporates the description form my 
module's docstring or instead shows my module as having (no 
description) is a function of which style of triple quotes I used. (If 
my module docstring is enclosed by triple double quotes, the description 
is extracted from my module's docstring. If it uses triple single quotes 
instead, for purposes of the results list my module's docstring is 
ignored, and the module is listed as having (no description).)
OK, now I get it. I don't use pydoc much and I missed that display.
This is indeed a bug in pydoc. If you look at lines 194, 195 and 201 in pydoc.py (Python 2.4.1 
version) you can see that it is parsing out the module docstring itself and it only looks for  
strings.

Here is a patch that accepts ''' strings as well. Though a better patch would allow any kind of 
string. I filed a bug report at
http://sourceforge.net/tracker/index.php?func=detailaid=1185124group_id=5470atid=105470

Kent
194,195c194,195
 if line[:4] == 'r': line = line[1:]
 if line[:3] == '':
---
 if line[:4] == 'r' or line[:4] == r''': line = line[1:]
 if line[:3] == '' or line[:3] == ''':
201c201
 result = strip(split(line, '')[0])
---
 result = strip(re.split('\'\'\'|', line)[0])
--
http://mail.python.org/mailman/listinfo/python-list


Re: Can a function be called within a function ?

2005-04-18 Thread Kent Johnson
Peter Moscatt wrote:
Is it possible to write code and allow a function to be called within
another like I have shown below ?
Yes, of course. In fact you do it six times in the code below, to call open(), readline(), append(), 
close(), main() and populatelist().

Kent
Pete

def populatelist():
f=open(_globals.appath + dxcluster.svr,r)
while true:
text = f.readline()
if text ==:
break
_list.append(string.strip(text))
f.close()


def serversettings():
servers.main(root)
if _globals.refresh==yes:
populatelist()   --- calling function above.


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


Re: Removing dictionary-keys not in a set?

2005-04-18 Thread Satchidanand Haridas
Hi,
I am not sure if this way is a good one, but it certainly is consise. 
Also sometimes, it's better to go for a simple approach than the consise 
one (for readability). With the abive disclaimer, I present my solution:

d1 = {1 : 2, 3 : 4, 5 : 6, 7 : 8, 9 : 10 }
s1 = [ 1, 5, 7 ]
# assuming you are using python 2.3.5
import sets
d2 = dict( [ ( x, d1[ x ] ) for x in sets.Set( d1.keys() ). 
intersection( sets.Set( s1 ) ) ] )

thanks,
Satchit
Tim N. van der Leeuw wrote:
Hi,
I'd like to remove keys from a dictionary, which are not found in a
specific set. So it's kind of an intersection-operation.
I can create a new dictionary, or a loop over all keys and test them
for set-membership, but I was wondering if there was a smart way to
express this in 1 or 2 concise statements that I'm not aware of.
So are there smarter ways to get the intersection of dictionary and set
into a dictionary than the following pseudo-code:
# Variation 1
d2 = {}
for key in s: d2[key] = d1[key]
# Variation 2
for key in d.iterkeys(): if key not in s: del d[key]
And if there's no smarter way, then which of these two options would
give best performance?
Cheers,
--Tim
 

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


Re: Strings and Lists

2005-04-18 Thread [EMAIL PROTECTED]
Hello Tom,

I think it is more efficient if we can use list (with True,False)
member to do genetics algorithms. Of course a lot of works to do to
change from string binary into boolean list.

I do programming genetics algorithms in C# I guess I have to modify my
program also because my old program use binary string manipulation.

Sincerely Yours,
Pujo

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


Re: Strings and Lists

2005-04-18 Thread Sidharth Kuruvila
Hi,
   I not sure what sorts of operations you plan to do. But if you
intend to use fixed length arrays or even carrying out repetetive
operations. You should probably look at numeric
http://numeric.scipy.org/


On 18 Apr 2005 04:42:17 -0700, Tom Longridge [EMAIL PROTECTED] wrote:
 My current Python project involves lots repeatating code blocks,
 mainly centred around a binary string of data. It's a genetic
 algorithm in which there are lots of strings (the chromosomes) which
 get mixed, mutated and compared a lot.
 
 Given Python's great list processing abilities and the relative
 inefficiencies some string operations, I was considering using a list
 of True and False values rather than a binary string.
 
 I somehow doubt there would be a clear-cut answer to this, but from
 this description, does anyone have any reason to think that one way
 would be much more efficient than the other? (I realise the best way
 would be to do both and `timeit` to see which is faster, but it's a
 sizeable program and if anybody considers it a no-brainer I'd much
 rather know now!)
 
 Any advice would be gladly recieved.
 --
 http://mail.python.org/mailman/listinfo/python-list
 


-- 
http://blogs.applibase.net/sidharth
--
http://mail.python.org/mailman/listinfo/python-list


fpectl

2005-04-18 Thread Sébastien Boisgérault
Hi all,

Can anybody tell me why I can't load the fpectl module in my Python
interpreter:

 import fpectl
Traceback: ...
...
ImportError: No module named fpectl

My platform is Linux (Mandrake 10.x) + Python2.4, built from the
(python.org) sources and configured with the --with-fpectl option.

Any idea ? Is the Python Library Reference obsolete on this point or
did I miss something ?

I have understood from the previous posts on the subject that the whole
floating-point issue (or specifically IEEE 754 support) is quite
complex
and highly platform-dependent. Therefore I guess that I cannot take for
granted the expected behavior of fpectl functions. But at least I
should
be able to import it, shouldn't I ? 

Cheers,

S.B.

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


Re: ANN: Python 2.3.2 for PalmOS available

2005-04-18 Thread Lucio Torre
Make sure you write the expression in the lower text-area, and then
press the send button. This should do it.

I did the port something like a year ago (when i didnt knew metroweks
for Palm was discontinued) and when i tried it last week i couldnt
figure out how to use it. Then i realized that i must use the lower
text-area. Its was not designed for ease of use :)

Lucio.

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


Re: Strings and Lists

2005-04-18 Thread Bill Mill
On 18 Apr 2005 04:42:17 -0700, Tom Longridge [EMAIL PROTECTED] wrote:
 My current Python project involves lots repeatating code blocks,
 mainly centred around a binary string of data. It's a genetic
 algorithm in which there are lots of strings (the chromosomes) which
 get mixed, mutated and compared a lot.
 
 Given Python's great list processing abilities and the relative
 inefficiencies some string operations, I was considering using a list
 of True and False values rather than a binary string.
 
 I somehow doubt there would be a clear-cut answer to this, but from
 this description, does anyone have any reason to think that one way
 would be much more efficient than the other? (I realise the best way
 would be to do both and `timeit` to see which is faster, but it's a
 sizeable program and if anybody considers it a no-brainer I'd much
 rather know now!)
 
 Any advice would be gladly recieved.
 --
 http://mail.python.org/mailman/listinfo/python-list
 

Tom,

it seems to me that, if efficiency is your main goal, you should store
your data as a list of integers, and use the bit-twiddling operators
to get at your data. These should be *very* fast, as well as memory
efficient.

Peace
Bill Mill
bill.mill at gmail.com
--
http://mail.python.org/mailman/listinfo/python-list


Re: ANN: Python 2.3.2 for PalmOS available

2005-04-18 Thread beliavsky
What are the potential applications of Python on PalmOS? Just curious.

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


trying to parse a file...

2005-04-18 Thread bruce
hi,

i'm trying to modify an app (gforge) that uses python to do some file
parsing/processing...

i have the following shell file that uses python. if i understand it
correctly, it's supposed to modify the 'viewcvs.conf' file, and
replace/update the section with 'svn_roots'.

it isn't working correctly... can anybody tell me what i need to do?
basically, i'd like to continually add to the svn_root: block with an
additional line as required. also, can someone tell me what i'd need to do,
if i wanted to remove a line of text from the 'svn_root' block if i had a
given 'test_x:'

thanks

bruce
[EMAIL PROTECTED]

---
viewcvs.conf:
  .
  .
  .
  #
  # This setting specifies each of the Subversion roots (repositories)
  # on your system and assigns names to them. Each root should be given
  # by a name: path value. Multiple roots should be separated by
  # commas and can be placed on separate lines.
  #
  #svn_roots = test2: /svn-gforge/uploadsvn
  svn_roots = test5: /gforge-svn/test7/svn,
  test2: /gforge-svn/test7/svn,
  test3: /gforge-svn/test7/svn,

  # The 'root_parents' setting specifies a list of directories in which
  # any number of repositories may reside.  Rather than force you to add
  .
  .
  .
---




[EMAIL PROTECTED] bin]# cat test.sh
---
#! /bin/sh

python EOF
import sys
import os
import string
import ConfigParser
r = ConfigParser.RawConfigParser ()
r.read (/etc/viewcvs/viewcvs.conf)
r.set (general,svn_roots,)
l = os.listdir (/var/lib/gforge/chroot/svnroot)
l2 = []
for d in l:
  l2.append (d + : svn://localhost/ + d)
r.set (general,svn_roots,string.join (l2, ', '))
r.set (general,cvs_roots,)
r.set (general,default_root, l [0])
r.write (open (/var/lib/gforge/etc/viewcvs.conf, w))
EOF

sed 's,pathname = CONF_PATHNAME .*,pathname =
/var/lib/gforge/etc/viewcvs.conf,' \
/usr/lib/python2.3/site-packages/viewcvs/viewcvs.py 
/var/lib/gforge/etc/viewcvs.py
---



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


Re: Strings and Lists

2005-04-18 Thread Peter Hansen
Tom Longridge wrote:
My current Python project involves lots repeatating code blocks,
mainly centred around a binary string of data. It's a genetic
algorithm in which there are lots of strings (the chromosomes) which
get mixed, mutated and compared a lot.
Given Python's great list processing abilities and the relative
inefficiencies some string operations, I was considering using a list
of True and False values rather than a binary string.
I somehow doubt there would be a clear-cut answer to this, but from
this description, does anyone have any reason to think that one way
would be much more efficient than the other? (I realise the best way
would be to do both and `timeit` to see which is faster, but it's a
sizeable program and if anybody considers it a no-brainer I'd much
rather know now!)
Any advice would be gladly recieved.
It depends more on the operations you are performing, and
more importantly *which of those you have measured and
found to be slow*, than on anything else.
If, for example, you've got a particular complex set of
slicing, dicing, and mutating operations going on, then
that might say use one type of data structure.
If, on the other hand, the evaluation of the fitness
function is what is taking most of the time, then you
should focus on what that algorithm does and needs
and, after profiling (to get real data rather than
shots-in-the-dark), you can pick an appropriate data
structure for optimizing those operations.
Strings seem to be what people pick, by default, without
much thought, but I doubt they're the right thing
for the majority of GA work...
-Peter
--
http://mail.python.org/mailman/listinfo/python-list


Can't compile with --enable-shared on MacOSX

2005-04-18 Thread Lothar Scholz
Help,

i tried to generate a dynamic library from the official
Python-2.4.0.tgz on MacOSX 10.3 but when i do the

./configure --enable-shared ; make ; sudo make install

or 

./configure --enable-shared=yes ; make ; sudo make install


It links statically. It's also strange that i can't find a
libpython2.4.a in my
/usr/local/lib. It's not installed by the install command.

Also  /usr/local/bin/python24 works fine.

I get an error that TK/TCL was not found. Is this the reason, i
thought i can simply ignore this error message.
-- 
http://mail.python.org/mailman/listinfo/python-list


accesing pages (or ranges of pages) via Reportlab

2005-04-18 Thread Rajarshi Guha
Hi, I've been using pdflatex to dump ranges of pages from a PDF file via
Python. However, I was looking at the Reportlab toolkit and was wondering
if this operation would be possible using this toolkit as well.

Admittedly, I have'nt read the documentation in detail, but I was
wondering if anybody could provide any pointers to extracting pages from a
PDF via Python without using pdflatex

Thanks,
Rajarshi

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


Re: ANN: Python 2.3.2 for PalmOS available

2005-04-18 Thread Peter Hansen
[EMAIL PROTECTED] wrote:
What are the potential applications of Python on PalmOS? Just curious.
Python is a general purpose programming language,
as you know.  Doesn't that suggest that the
set of potential applications is pretty much all
those which don't require the raw performance of
C or perhaps some highly specialized feature
available only in another language (if such a
thing even exists)?
Calendar tools, time tracking tools, games,
various kinds of network clients (for the latest
Palms), etc.  I've just written a very specialized
time tracking tool in Plua, which could easily have
been done using Python if it had access to the
UI elements and the file system as Plua does.
Given that you already know what Python is all about,
your question sounds to me like that of someone who
doesn't even know what a Palm is good for... which
I doubt you are, so I find the question rather puzzling.
-Peter
--
http://mail.python.org/mailman/listinfo/python-list


Re: accesing pages (or ranges of pages) via Reportlab

2005-04-18 Thread Peter Hansen
Rajarshi Guha wrote:
Hi, I've been using pdflatex to dump ranges of pages from a PDF file via
Python. However, I was looking at the Reportlab toolkit and was wondering
if this operation would be possible using this toolkit as well.
Admittedly, I have'nt read the documentation in detail, but I was
wondering if anybody could provide any pointers to extracting pages from a
PDF via Python without using pdflatex
I'm pretty sure there is a non-free library available
from the ReportLab folks that can do this.  (Googling
a bit...)  PageCatcher.  Check www.reportlab.com for more.
--
http://mail.python.org/mailman/listinfo/python-list


Re: (Python newbie) Using XP-SP2/MSVC6: No Python24_d.lib, winzip barfs on Python-2.4.1.tar, cannot download bzip2

2005-04-18 Thread A.B., Khalid
Bill Davy wrote:
 I downlaoded and installed
 http://www.python.org/ftp/python/2.4.1/python-2.4.1.msi

 I'm trying to build an extension using SWIG 1.3.24 and the linker
needs
 python24_d.lib (I do not have the DLL either).  I've not found it in
any of
 the
 downloads.

 So I tried to download the source to build it myself.  Of
 http://www.python.org/ftp/python/2.4.1/Python-2.4.1.tar.bz2 and
 http://www.python.org/ftp/python/2.4.1/Python-2.4.1.tgz, WinZip (9.0
SR1)
 just says Error reading header after processing 0 entries.

 Additionally, I've had no joy downloading the unzipper
 (ftp://sources.redhat.com/pub/bzip2/v102/bzip2-102-x86-win32.exe)
from the
 site cited for the unzipper (http://sources.redhat.com/bzip2/).  It
flashed
 up a
 black console window momentarily.

 Oh, this is so frustrating! :-(

 Can anyone point me in the right direction?

 And then I can get to grips with my work.

 tia
 Bill



I am no expert in MSVC6, but it sounds like maybe you need to supply
the no-debug switch in your extention setup.py file: /d NDEBUG.

In case that does not work and help on this is not forthcoming, you can
always try pyMinGW[1].


Regards,
Khalid



[1] pyMinGW:
http://jove.prohosting.com/iwave/ipython/pyMinGW.html

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


Re: ANN: Python 2.3.2 for PalmOS available

2005-04-18 Thread Lucio Torre
Most likely you run out of stack. The amount of memory this beast
required for initialization was too much for most old Palms.

Ive tried it on PalmOS simulator mainly, and on some version of OS5
hardware.

Lucio.

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


ANN: Python Training In South Africa

2005-04-18 Thread Gerrit van Dyk
AgileWorks (Pty) Ltd will be presenting an Introduction to Python 
training course at The Innovation Hub from the 4-6th of May 2005.

For more detail visit our website: 
(http://www.agileworks.net/AgileWorks/Training/Python/)
--
http://mail.python.org/mailman/listinfo/python-list


(PHP or Python) Developing something like www.tribe.net

2005-04-18 Thread Mir Nazim
Hi there.

I am about to undertake a project. My employer wants it to be developed
in PHP. While I was thinking that Python will be better for this job.

The project will implement the functionality similar to Yahoo360
(http://www.360.yahoo.com), http://www.Tribe.net, Orkut etc.

1) There will be a groups like functionality like google groups.
2) Groups/personal blogs/albums/events/buddy lists etc. need to be
implemented.
3) Most importantly it needs to be implemented like platform. that is
it has to expose API or web services so that application implemented on
it can talk to each other and other applications can talk to it.

My employer wants to go with PHP because almost all the functionality
is available with a Drupal CMS for PHP. But it is important to note
that for an application, rather a platform, which is intended to be
used for a long time, time to implement should not be the major
criteria above good design and maintainability(in which python scores
highest).

IMHO Zope3/Quixote seem to be the obvious choice here. Though
functionality is not available on them but i think time spent now will
be gained by gains in better design and maintainable code base.

Now I want this wonderful c.l.py community to pour in their suggestions
on what would be better alternatives. Also may we try various
combinations of frameworks like Zope3 for components, Twisted2.0 for
network functionality etc.

PS: I am leaving out Zope2.x and Twisted1.x as a lot has changed in
newer versions and I don't want to be hanged when Zope3 becomes
official.

Thanks 

---
Mir Nazim

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


Working with method-wrapper objects

2005-04-18 Thread Peer Dr. Griebel
Hi,

I'm currently working on a Python Management Console.
During inspection of my objects I stumbled over method-wrapper objects.
Such an object may be obtained e.g. as 

method_wrapper = [].__str__

My problem is: This object is not a method, not a function, not a
method descriptor. And it is not a routine according to inspect.py.

So how do I work with it?  I would like to be able to detect it.  And
I would like to be able to issue a inspect.getargspec() on it.


As we are at it: I have a similar problem with
builtin_function_or_method's.  These objects can't be inspected by
getargspec().  So is there some way to determine the argspec in some way?

Thanks
  Peer

__
Mit WEB.DE FreePhone mit hoechster Qualitaet ab 0 Ct./Min.
weltweit telefonieren! http://freephone.web.de/?mc=021201

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


Zope3 and Plone

2005-04-18 Thread Mir Nazim
Hi,

I wanted to know what will happen to plone once Zope3 will be official
version. Is plone being ported to Zope3. I googled it but did not come
accross anything stating the plone's migration to zope3.

I am thinking to take up a project. plone is a candidate for it. should
i want to take  benifit of zope3 features too.

what should be done. 

Please comment
thanks

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


Re: Slight discrepancy with filecmp.cmp

2005-04-18 Thread Ivan Van Laningham
Hi All--

John Machin wrote:
 
 On Sun, 17 Apr 2005 22:06:04 -0600, Ivan Van Laningham
 [EMAIL PROTECTED] wrote:
 [snip]
  So I wrote a set of
 programs to both index the disk versions with the cd versions, and to
 compare, using filecmp.cmp(), the cd and disk version.  Works fine.
 Turned up several dozen files that had been inadvertantly rotated or
 saved with the wrong quality, various fat-fingered mistakes like that.
 
 However, it didn't flag the files that I know have bitrot.  I seem to
 remember that diff uses a checksum algorithm on binary files, not a
 byte-by-byte comparison.  Am I wrong?
 
 According to the docs:
 
 
 cmp( f1, f2[, shallow[, use_statcache]])
 
 Compare the files named f1 and f2, returning True if they seem equal,
 False otherwise.
 Unless shallow is given and is false, files with identical os.stat()
 signatures are taken to be equal
 
 
 and what is an os.stat() signature, you ask? So did I.
 
 According to the code itself:
 
 def _sig(st):
 return (stat.S_IFMT(st.st_mode),
 st.st_size,
 st.st_mtime)
 
 Looks like it assumes two files are the same if they are of the same
 type, same size, and same time-last-modified. Normally I guess that's
 good enough, but maybe the phantom bit-toggler is bypassing the file
 system somehow. What OS are you running?
 

WinXP, SP2

 You might like to do two things: (1) run your comparison again with
 shallow=False (2) submit a patch to the docs.
 

You know, I read that doc, tried it, and it made absolutely no
difference.  Then I read your message, read the docs again, and finally
realized I had flipped the sense of shallow in my head.  Sheesh.  So
then I tried it with shallow=False, not True, and it runs about ten
times slower, but it works.  Beautifully.

Now I have to go back and redo the first five thousand, but it's worth
it.  Thanks.  Shows how much you need another set of eyeballs to debug
your brain;-)

 (-:
 You have of course attempted to eliminate other variables by checking
 that the bit-rot effect is apparent using different display software,
 a different computer, an observer who's not on the same medication as
 you, ... haven't you?
 :-)
 

;-)  Absolutely.  Several different viewers and several different OSs. 
And my wife never sees anything the way I do;-)

Metta,
Ivan
--
Ivan Van Laningham
God N Locomotive Works
http://www.andi-holmes.com/
http://www.foretec.com/python/workshops/1998-11/proceedings.html
Army Signal Corps:  Cu Chi, Class of '70
Author:  Teach Yourself Python in 24 Hours
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: accesing pages (or ranges of pages) via Reportlab

2005-04-18 Thread Larry Bates
ReportLab doesn't support this in the free version but they sell
an add-on called PageCatcher that has this feature.  I've used
it on a couple of projects and it works EXTREMELY well.

-Larry


Rajarshi Guha wrote:
 Hi, I've been using pdflatex to dump ranges of pages from a PDF file via
 Python. However, I was looking at the Reportlab toolkit and was wondering
 if this operation would be possible using this toolkit as well.
 
 Admittedly, I have'nt read the documentation in detail, but I was
 wondering if anybody could provide any pointers to extracting pages from a
 PDF via Python without using pdflatex
 
 Thanks,
 Rajarshi
 
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: (PHP or Python) Developing something like www.tribe.net

2005-04-18 Thread Larry Bates
Don't write off Zope2/Plone too quickly.  Zope is making many of
the extensions/features in Zope3 available in Zope2 (V2.8+).  As
with any LARGE application, Zope2 is much more mature than the
newer Zope3.  It will also be extremely difficult to find
programmers/consultants with any Zope3 experience.  Plone's CMF
is going to be very hard to beat.

-Larry Bates


Mir Nazim wrote:
 Hi there.
 
 I am about to undertake a project. My employer wants it to be developed
 in PHP. While I was thinking that Python will be better for this job.
 
 The project will implement the functionality similar to Yahoo360
 (http://www.360.yahoo.com), http://www.Tribe.net, Orkut etc.
 
 1) There will be a groups like functionality like google groups.
 2) Groups/personal blogs/albums/events/buddy lists etc. need to be
 implemented.
 3) Most importantly it needs to be implemented like platform. that is
 it has to expose API or web services so that application implemented on
 it can talk to each other and other applications can talk to it.
 
 My employer wants to go with PHP because almost all the functionality
 is available with a Drupal CMS for PHP. But it is important to note
 that for an application, rather a platform, which is intended to be
 used for a long time, time to implement should not be the major
 criteria above good design and maintainability(in which python scores
 highest).
 
 IMHO Zope3/Quixote seem to be the obvious choice here. Though
 functionality is not available on them but i think time spent now will
 be gained by gains in better design and maintainable code base.
 
 Now I want this wonderful c.l.py community to pour in their suggestions
 on what would be better alternatives. Also may we try various
 combinations of frameworks like Zope3 for components, Twisted2.0 for
 network functionality etc.
 
 PS: I am leaving out Zope2.x and Twisted1.x as a lot has changed in
 newer versions and I don't want to be hanged when Zope3 becomes
 official.
 
 Thanks 
 
 ---
 Mir Nazim
 
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Nokia to speak at Python-UK next week

2005-04-18 Thread Nick Craig-Wood
[EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
  I am please to announce that Tapio Tallgren of Nokia Research
  Labs is coming to Python-UK to talk about Python on the Nokia Series
  60 phones.  If you want to get hands-on, upgrade that handset now!

Cool!

Not entirely on topic, but does anyone know if there is a series 80
python?  Or if the series 60 python runs on a series 80 phone (eg
communicator 9300/9500)?

-- 
Nick Craig-Wood [EMAIL PROTECTED] -- http://www.craig-wood.com/nick
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: pre-PEP: Simple Thunks

2005-04-18 Thread Serhiy Storchaka
Brian Sabbey wrote:
do f in with_file('file.txt'):
print f.read()
def with_file(filename):
f = open(filename)
yield f
f.close()
for f in with_file('file.txt'):
print f.read()
t = no file read yet
do f in with_file('file.txt'):
t = f.read()
t = no file read yet
for f in with_file('file.txt'):
t = f.read()
--
Serhiy Storchaka
--
http://mail.python.org/mailman/listinfo/python-list


Re: Zope3 and Plone

2005-04-18 Thread Josef Meile
Hi Mir,
you are asking in the wrong place. This is a python specific list. You
can find a suitable list here:
http://mail.zope.org/mailman/listinfo
Regards,
Josef
Mir Nazim wrote:
Hi,
I wanted to know what will happen to plone once Zope3 will be official
version. Is plone being ported to Zope3. I googled it but did not come
accross anything stating the plone's migration to zope3.
I am thinking to take up a project. plone is a candidate for it. should
i want to take  benifit of zope3 features too.
what should be done. 

Please comment
thanks

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


Re: Zope3 and Plone

2005-04-18 Thread bruno modulix
Mir Nazim wrote:
Hi,
I wanted to know what will happen to plone once Zope3 will be official
version. 
(snip)
what should be done. 

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


How standard is the standard library?

2005-04-18 Thread steve.leach
Newbie question: Looking through my stack of books and various on-line 
references, I have seen several libraries and library functions listed 
as depreciated.

Is there a road map or concrete list of what parts of the standard 
library are to be considered reliable and permanent?  Coming from C, I 
am used to library functions being set in stone.

Can I reasonably expect that code using, for instance xml.dom.minidom 
will still work in 10 years?

Do all depreciated libraries print warnings when they are imported?  I 
see that if I print xmllib, I get the message The xmllib module is 
obsolete.  Use xml.sax instead.  Is this behavior followed 
consistently, to give a this code might not work come this time next 
year warning?
--
http://mail.python.org/mailman/listinfo/python-list


Re: pre-PEP: Simple Thunks

2005-04-18 Thread Ron_Adam
On Sun, 17 Apr 2005 19:56:10 -0700, Brian Sabbey
[EMAIL PROTECTED] wrote:

I also wouldn't do it that way.  I don't see a class as being much better, 
though.  If I understand you correctly, with classes you would have 
something like:

p = Pickled('pickled.txt')
p.load()
p.data.append('more data')
p.data.append('even more data')
p.dump()

The load and dump would be private to the data class object. Here's a
more complete example.  

import pickle
class PickledData(object):
def __init__(self, filename):
self.filename = filename
self.L = None
try:
self._load()
except IOError:
self.L = []
def _load(self):
f = open(self.filename, 'r')
self.L = pickle.load(f) 
f.close()
def _update(self):
f = open(self.filename, 'w')
pickle.dump(self.L, f)
f.close()   
def append(self, record):
self.L.append(record)
self._update()
# add other methods as needed ie.. get, sort, clear, etc...

pdata = PickledData('filename')

pdata.append('more data')
pdata.append('even more data')

print pdata.L
['more data', 'even more data']


This has the same issues as with opening and closing files:  losing the 
'dump', having to always use try/finally if needed, accidentally 
re-binding 'p', significantly more lines.  Moreover, class 'Pickled' won't 
be as readable as the 'pickled_file' function above since 'load' and 
'dump' are separate methods that share data through 'self'.

A few more lines to create the class, but it encapsulates the data
object better. It is also reusable and extendable.

Cheers,
Ron

The motivation for thunks is similar to the motivation for generators-- 
yes, a class could be used instead, but in many cases it's more work than 
should be necessary.

-Brian


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


Re: Behaviour of str.split

2005-04-18 Thread runes
The behaviour of .split(*) is not that strange as the splitpoint
always disappear. The re.split() have a nice option to keep the
splitpoint which the str.split should have, I think.

One expectation I keep fighting within myself is that I expect

mystring.split('') to return  ['m', 'y', 's', 't', 'r', 'i', 'n',
'g']. But I guess it's in line with There should be one-- and
preferably only one --obvious way to do it. that it's not so.

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


Re: Strings and Lists

2005-04-18 Thread Donn Cave
In article [EMAIL PROTECTED],
 [EMAIL PROTECTED] (Tom Longridge) wrote:

 My current Python project involves lots repeatating code blocks,
 mainly centred around a binary string of data. It's a genetic
 algorithm in which there are lots of strings (the chromosomes) which
 get mixed, mutated and compared a lot.
 
 Given Python's great list processing abilities and the relative
 inefficiencies some string operations, I was considering using a list
 of True and False values rather than a binary string.
 
 I somehow doubt there would be a clear-cut answer to this, but from
 this description, does anyone have any reason to think that one way
 would be much more efficient than the other? (I realise the best way
 would be to do both and `timeit` to see which is faster, but it's a
 sizeable program and if anybody considers it a no-brainer I'd much
 rather know now!)

I make no representations about how much mileage you would
get out of it, but if character data suits your purposes and
you just need a mutable array - in principle, I think it would
be more efficient to use an array.  Like,
   import array
   a = array.array('c', strdata)

As I understand it, this object simply contains character data,
not a list of 1 character string objects, so it's much more
economical to store and examine.

   Donn Cave, [EMAIL PROTECTED]
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Removing dictionary-keys not in a set?

2005-04-18 Thread Steven Bethard
Tim N. van der Leeuw wrote:
Hi,
I'd like to remove keys from a dictionary, which are not found in a
specific set. So it's kind of an intersection-operation.
I can create a new dictionary, or a loop over all keys and test them
for set-membership, but I was wondering if there was a smart way to
express this in 1 or 2 concise statements that I'm not aware of.
So are there smarter ways to get the intersection of dictionary and set
into a dictionary than the following pseudo-code:
# Variation 1
d2 = {}
for key in s: d2[key] = d1[key]
# Variation 2
for key in d.iterkeys(): if key not in s: del d[key]
You could try a generator expression:
py d = {1: 2, 3: 4, 5: 6, 7: 8, 9: 10}
py s = set([1, 5, 7])
py dict((k, v) for k, v in d.iteritems() if k in s)
{1: 2, 5: 6, 7: 8}
Note that your variation 2 won't work:
py for key in d.iterkeys():
... if key not in s:
... del d[key]
...
Traceback (most recent call last):
  File interactive input, line 1, in ?
RuntimeError: dictionary changed size during iteration
You can make it work using keys() instead of iterkeys():
py for key in d.keys():
... if key not in s:
... del d[key]
...
py d
{1: 2, 5: 6, 7: 8}
But I think I'd probably lean towards the generator expression...
STeVe
--
http://mail.python.org/mailman/listinfo/python-list


SQLite Database Manager

2005-04-18 Thread dcrespo
Hi all...
Does anybody know about the best SQLite Database Manager open source
web-based or standalone app under windows?

I tried:
- SQLiteManager (web-based - http://sqlitemanager.sourceforge.net/) but
I can't get it working. (When I try to just create a new database, it
does nothing... If anyone knows how to get it working, I am all ears
(or eyes) :) )

- the demo version of SQLite Analyzer 3
(http://www.kraslabs.com/sqlite_analyzer.html). It seems to be good
enough, but it isn't free ($40).

- SQLiteManager (stand-alone program - http://sqlabs.net) that isn't
free ($39)

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


Re: MS SQL Server/ODBC package for Python

2005-04-18 Thread M.-A. Lemburg
Peter Herndon wrote:
:) Knock away, as my info isn't scientific anyway.  In my case, ASA is
*not* local.  The db is running on a 500MHz x 2 server with 768MB RAM,
over 100BaseT connection.  That same server is also running the MSSQL
instance, and IIS.
Running your benchmark, I ran into a couple of interesting points.
Using mx.ODBC, my times were 0.54 seconds and 6.56 seconds
respectively, while using adodbapi my results are 3.55 seconds and 25.9
seconds respectively.  mx.ODBC is faster with the simple query you
provide.
Next I modified the benchmark to reflect my particular circumstances
more accurately (?Maybe?  Comments invited).  I changed the query to
one of the queries in regular use in my application.  This query
selects 26 columns from 3 joined tables, with a where clause where
f476 = ?, and I provide the missing value as a tuple in the execute
statement.  Note that, as I mentioned in my reply to M-A, the f476
field is not indexed, and is a long varchar.  Again, the system is
bought, so I have no control over the schema. ;)
The other change I made was to reduce the number of iterations from 100
to 10.  Since there are 128000 records in the main table, the wait for
100 iterations was too long for my patience.  Under these
circumstances, mx.ODBC's numbers are 188.49 seconds and 377.56 seconds
respectively, and adodbapi's times are 111.15 seconds and 223.55
seconds respectively.
Just curious: are you timing just the time it takes to
complete the .execute() or do you also fetch the complete
result or only part of it ?
Note that we have had reports about MS SQL Server being very
slow in determining the number of rows in a result set. It's
possible that ASA has the same problem.
The mxODBC 2.0 release fetches this number after every .execute().
If adodbapi avoids this (which we'll also integrate into mxODBC 2.1),
then this would explain the differences you see.
Another reason could indeed be related to the longvarchar
field: these fields are fetched in multiple chunks if the
ODBC driver doesn't provide proper size information - each
of these chunks will require a network access which slows
down the data fetching.
Since mxODBC supports Unicode, but defaults to returning
8-bit strings, it is also possible that your longvarchar
column is sent as Unicode and has to be converted to
an 8-bit string first. Thus, allowing mxODBC to return Unicode
could make a difference as well (see the docs on how this is
done).
My first wall-clock impressions are obvious exaggerations of reality,
for which I duly apologize to all.  However, adodbapi did prove to be
faster in my admittedly very wacky common use case.  Slower to connect,
but faster to run a substantial query.
Comments?  Questions?  Suggestions for improvement?
See some of the hints I mentioned above.
Note that it often also pay off checking the ODBC driver
settings, esp. if you have a networked setup - ODBC drivers
often pre-fetch result sets and changing the defaults they
use for this can make a huge difference in response times.
Unfortunately, mxODBC doesn't have control over these
settings and there's no standard for them, so you'll
have to check the ODBC driver documentation for details
on the best settings can be found and set.
Regards,
--
Marc-Andre Lemburg
eGenix.com
Professional Python Services directly from the Source  (#1, Apr 18 2005)
 Python/Zope Consulting and Support ...http://www.egenix.com/
 mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/
 mxODBC, mxDateTime, mxTextTools ...http://python.egenix.com/

::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! 
--
http://mail.python.org/mailman/listinfo/python-list


Any movement on FreeBSD segfaults when using threads?

2005-04-18 Thread Mike C. Fletcher
There was a post a few months ago from snacktime in which they
described a failure when running under Twisted:

http://mail.python.org/pipermail/python-list/2005-February/265137.html

which they eventually narrowed down to an apparent problem with pycrypto:

http://mail.python.org/pipermail/python-list/2005-February/265146.html

and which generated this sourceforge bug report for Python:

http://twistedmatrix.com/pipermail/twisted-python/2005-February/009475.html

http://sourceforge.net/tracker/index.php?func=detailaid=1080660group_id=5470atid=105470

I am seeing a similar effect, (though only after the program has been
running a few days), in one of our products running on FreeBSD 5.3-RC2
with Python 2.3.4, PyOpenSSL 0.6, Twisted 2.0, and PyPgSQL 2.4 (which is
somewhat different than snacktime's library collection (different
OpenSSL and PostgreSQL bindings)).  Note particularly, that the PyCrypto
library to which the problem was apparently localised is *not* installed
on the failing machine.

As with snacktime, I see the failure coming from pthread_testcancel()

(gdb) bt
#0  0x28222f17 in pthread_testcancel () from /usr/lib/libpthread.so.1
#1  0x2821b39f in pthread_mutexattr_init () from
/usr/lib/libpthread.so.1
#2  0x in ?? ()

I haven't been able to isolate the failures to a particular piece of
code (this is showing up on a live server, so I'm hesitant to run under
gdb for a couple of days to try to catch the failure).  I'm *not* using
RSA encryption (which was the area to which snacktime localised their
problem).  I *do* use SSL sockets from Twisted, however.  I am running a
background thread for database access, with a Queue mediating the set of
items to process and reactor.callFromThread returning control to Twisted
when the items are finished.

Anyway, my question is really has this been solved already?  If so,
what was the solution?  If not, I'll have to work at building a minimal
failing test case so I can begin to debug it.

Thanks for any information,
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: fpectl

2005-04-18 Thread Matt

Sébastien Boisgérault wrote:
 Hi all,

 Can anybody tell me why I can't load the fpectl module in my Python
 interpreter:

  import fpectl
 Traceback: ...
 ...
 ImportError: No module named fpectl

 My platform is Linux (Mandrake 10.x) + Python2.4, built from the
 (python.org) sources and configured with the --with-fpectl option.

 Any idea ? Is the Python Library Reference obsolete on this point or
 did I miss something ?

 I have understood from the previous posts on the subject that the
whole
 floating-point issue (or specifically IEEE 754 support) is quite
 complex
 and highly platform-dependent. Therefore I guess that I cannot take
for
 granted the expected behavior of fpectl functions. But at least I
 should
 be able to import it, shouldn't I ?

 Cheers,

 S.B.

I'd assume it's because you're on a non-Unix system.  The docs
(http://www.python.org/doc/2.3.5/lib/module-fpectl.html) say:
Availability: Unix

I'm assuming that means you can't use it on a Windows platform (or any
non-Unix environment)...

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


Re: pre-PEP: Suite-Based Keywords

2005-04-18 Thread Ron_Adam
On Mon, 18 Apr 2005 12:50:24 +0200, Reinhold Birkenfeld
[EMAIL PROTECTED] wrote:

y = (f(11, 22, x=1, y='y for f') *
 g(*args_from_somewhere,
   x='x for g', y='y for g',
   foo=lambda: return 'foo for g'))

would be my current way to express this. But still, the less lines,
the less confusing it is.

I would probably do it this way.

y = f(11, 22, x=1, y='y for f') \
 * g( *args_from_somewhere,
  x='x for g', 
  y='y for g',
  foo=lambda: return 'foo for g' )

I tend to put the opperators on the left for continued lines. It's
nice visual que to whats happening.

if (a==1 
or b==2 
or c==3):
x = ( 1.
+ the_last_value_i_needed
+ the_first_value_i_started_with
+ another_long_name_for_something )

This subject really hasn't been a problem for me. So I really don't
see the point of adding a new syntax. 

And this works on the def side.

def f( first, 
   second,
   x=0,
   y='' ):
#   
# rest of body
#

So is this new syntax just a way to keep the '()'s closer together?

Cheers,
Ron

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


How to get a Function object from a Frame object

2005-04-18 Thread Gigi
Hi,
I need access to a function object that corresponds to a frame object in 
a certain case from inside the function.

I can get the frame object using:
f = sys._getframe(0)
But the resulting frame object doesn't contain the information I need. 
There is a lot of information in the code object (f.f_code), but not the 
actual function or method object.

The inspect module doesn't help either it just provides nicer interface 
to the Frame object.

Any ideas out there?
Thanks, Gigi
--
http://mail.python.org/mailman/listinfo/python-list


Re: MS SQL Server/ODBC package for Python

2005-04-18 Thread Peter Herndon
  Next I modified the benchmark to reflect my particular circumstances
  more accurately (?Maybe?  Comments invited).  I changed the query to
  one of the queries in regular use in my application.  This query
  selects 26 columns from 3 joined tables, with a where clause where
  f476 = ?, and I provide the missing value as a tuple in the execute
  statement.  Note that, as I mentioned in my reply to M-A, the f476
  field is not indexed, and is a long varchar.  Again, the system is
  bought, so I have no control over the schema. ;)
 
  The other change I made was to reduce the number of iterations from 100
  to 10.  Since there are 128000 records in the main table, the wait for
  100 iterations was too long for my patience.  Under these
  circumstances, mx.ODBC's numbers are 188.49 seconds and 377.56 seconds
  respectively, and adodbapi's times are 111.15 seconds and 223.55
  seconds respectively.
 
 Just curious: are you timing just the time it takes to
 complete the .execute() or do you also fetch the complete
 result or only part of it ?
 

I have included the .fetchall() in the loop, yes.  The only other
change I made to the benchmark is to use ODBC.Windows.DriverConnect
rather than .Connect, as that's what I'd used before in my
application.  Is there a difference between the two, other than the
argument syntax?

 The mxODBC 2.0 release fetches this number after every .execute().
 If adodbapi avoids this (which we'll also integrate into mxODBC 2.1),
 then this would explain the differences you see.
 

I look forward to retesting with 2.1 -- I'm curious to see what
differences arise.

 Another reason could indeed be related to the longvarchar
 field: these fields are fetched in multiple chunks if the
 ODBC driver doesn't provide proper size information - each
 of these chunks will require a network access which slows
 down the data fetching.

The datum in the field is uniformly short, 8 characters or less.  It's
actually our internal identifier.  Again, I'd use a varchar and index
the field if I had control over the schema.  However, the small size
of the datum argues against multiple chunks, unless the default chunk
size is really small.

 
 Since mxODBC supports Unicode, but defaults to returning
 8-bit strings, it is also possible that your longvarchar
 column is sent as Unicode and has to be converted to
 an 8-bit string first. Thus, allowing mxODBC to return Unicode
 could make a difference as well (see the docs on how this is
 done).

I'll take a look into this, as I have a vague memory of adodbapi
returning Unicode by default.

 Note that it often also pay off checking the ODBC driver
 settings, esp. if you have a networked setup - ODBC drivers
 often pre-fetch result sets and changing the defaults they
 use for this can make a huge difference in response times.
 
 Unfortunately, mxODBC doesn't have control over these
 settings and there's no standard for them, so you'll
 have to check the ODBC driver documentation for details
 on the best settings can be found and set.

I'll have to dig into this.  There don't seem to be too many directly
available settings in ODBC Administrator, but there seem to be some
spots for inserting settings directly into a command line, so I'll
need to dig up the Sybase documentation on what's possible.

  Regards,
 --
 Marc-Andre Lemburg
 eGenix.com

Thank you very much for your patience and insight.

Cheers,

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


Re: (Python newbie) Using XP-SP2/MSVC6: No Python24_d.lib, winzip barfs on Python-2.4.1.tar, cannot download bzip2

2005-04-18 Thread James Carroll
Hi Bill,

Python 2.4 requires VC7.1 I just ran into this recently.  Once I
installed VC7.1, I could easily compile the Python source to create a
debug lib.

Winzip should be able to read the python source tarball... There is
one trick though.  Once you download it, it might get renamed to
python.tar.gz.tar  and the trick is to rename the file's extension to
.tar.gz or (my preference)  .tgz.

If it really is a bzip2 file, then you'll need some sort of bunzip.  I
use the cygnus version, but I don't remember having to do anything out
of the way for the python source.

-Jim

On 4/18/05, Bill Davy [EMAIL PROTECTED] wrote:
 
 A.B., Khalid [EMAIL PROTECTED] wrote in message
 news:[EMAIL PROTECTED]
  Bill Davy wrote:
  I downlaoded and installed
  http://www.python.org/ftp/python/2.4.1/python-2.4.1.msi
 
  I'm trying to build an extension using SWIG 1.3.24 and the linker
  needs
  python24_d.lib (I do not have the DLL either).  I've not found it in
  any of
  the
  downloads.
 
  I am no expert in MSVC6, but it sounds like maybe you need to supply
  the no-debug switch in your extention setup.py file: /d NDEBUG.
 
  In case that does not work and help on this is not forthcoming, you can
  always try pyMinGW[1].
 
 
  Regards,
  Khalid
 
 Hmm, that's one possibility but I really do need to keep the debugger
 version going.  I'm only just getting started.  Any other suggestions?
 
 
 --
 http://mail.python.org/mailman/listinfo/python-list
 

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


(no subject)

2005-04-18 Thread franceschini
--  Virus Warning Message (on cesio.consuldata.com.br)

Found virus WORM_MYDOOM.M in file document.pif (in document.zip)
The uncleanable file is deleted.

Para maiores informacoes, contate o suporte da ConsulData: +55 (13) 3219-6522 
ou [EMAIL PROTECTED]

-
The message was not delivered due to the following reason(s):

Your message could not be delivered because the destination computer was
not reachable within the allowed queue period. The amount of time
a message is queued before it is returned depends on local configura-
tion parameters.

Most likely there is a network problem that prevented delivery, but
it is also possible that the computer is turned off, or does not
have a mail system running right now.

Your message could not be delivered within 4 days:
Mail server 87.98.63.65 is not responding.

The following recipients could not receive this message:
python-list@python.org

Please reply to [EMAIL PROTECTED]
if you feel this message to be in error.


--  Virus Warning Message (on cesio.consuldata.com.br)

document.zip is removed from here because it contains a virus.

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

EasyDialogs module problem with python 2.4.1

2005-04-18 Thread scott
First my setup:
I'm using the framework build of Python 2.4.1
( http://bob.pythonmac.org/archives/2005/03/31/macpython-241-installer/ )
on an ibook G4 running Mac OS 10.3.8.
I installed wxPython 2.5.5.1 ( Unicode runtime 2.5.5.1 for the Panther 
version of Macpython-OSX 2.4 )

( http://wxpython.org )
Now my problem:
EasyDialogs module
( http://www.python.org/doc/2.4.1/mac/module-EasyDialogs.html )
works with pyshell (interactive python program included with wxPython) 
but not with python launched at the terminal:
ie:

---
PyShell 0.9.4 - The Flakiest Python Shell
Sponsored by Orbtech - Your source for Python programming expertise.
Python 2.4.1 (#2, Mar 31 2005, 00:05:10)
[GCC 3.3 20030304 (Apple Computer, Inc. build 1666)] on darwin
Type help, copyright, credits or license for more information.
import EasyDialogs
EasyDialogs.Message('hi')
--
http://mail.python.org/mailman/listinfo/python-list


Re: compiling python 2.4.1 on Linux_X86_64 using PGI compiler fails

2005-04-18 Thread Martin v. Löwis
Berthold Höllmann wrote:
 Has anyone compiled python successfully using PGI compilers under 64
 bit Linux. If yes, what are the neccesarry switches?

As a starting point, I would try to compile without optimization.

If the compiler has something similar to gcc's -fno-strict-aliasing,
you should pass that as well.

Regards,
Martin
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: EasyDialogs module problem with python 2.4.1

2005-04-18 Thread Martin v. Löwis
scott wrote:

 EasyDialogs module
 
 ( http://www.python.org/doc/2.4.1/mac/module-EasyDialogs.html )
 
 works with pyshell (interactive python program included with wxPython)
 but not with python launched at the terminal:

Could you be more precise what works not means? What do you expect
to happen, what happens instead?

Did you try pythonw?

Regards,
Martin
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: EasyDialogs module problem with python 2.4.1

2005-04-18 Thread scott
scott wrote:
First my setup:
I'm using the framework build of Python 2.4.1
( http://bob.pythonmac.org/archives/2005/03/31/macpython-241-installer/ )
on an ibook G4 running Mac OS 10.3.8.
I installed wxPython 2.5.5.1 ( Unicode runtime 2.5.5.1 for the Panther 
version of Macpython-OSX 2.4 )

( http://wxpython.org )
Now my problem:
EasyDialogs module
( http://www.python.org/doc/2.4.1/mac/module-EasyDialogs.html )
works with pyshell (interactive python program included with wxPython) 
but not with python launched at the terminal:
ie:

---
PyShell 0.9.4 - The Flakiest Python Shell
Sponsored by Orbtech - Your source for Python programming expertise.
Python 2.4.1 (#2, Mar 31 2005, 00:05:10)
[GCC 3.3 20030304 (Apple Computer, Inc. build 1666)] on darwin
Type help, copyright, credits or license for more information.
 import EasyDialogs
 EasyDialogs.Message('hi')
Sorry, the rest of the message:
At the terminal, EasyDialogs doesn't work:

Last login: Mon Apr 18 10:30:53 on console
Welcome to Darwin!
scott$ python
Python 2.4.1 (#2, Mar 31 2005, 00:05:10)
[GCC 3.3 20030304 (Apple Computer, Inc. build 1666)] on darwin
Type help, copyright, credits or license for more information.
 import EasyDialogs
 EasyDialogs.Message('hi')
Traceback (most recent call last):
  File stdin, line 1, in ?
  File 
/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/plat-mac/EasyDialogs.py, 
line 75, in Message
_interact()
  File 
/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/plat-mac/EasyDialogs.py, 
line 53, in _interact
AE.AEInteractWithUser(5000)
MacOS.Error: (-1713, 'no user interaction is allowed')


-
I want to use EasyDialogs as a user front end for some simple scripts 
and can't do that until this issue is resolved. Thanks in advance.
--
http://mail.python.org/mailman/listinfo/python-list


Re: Removing dictionary-keys not in a set?

2005-04-18 Thread Tim N. van der Leeuw
Hi Aahz,

The problem with using the builtin set operations is, that the
dictionary keys don't represent a set, so you can't directly create a
new dictionary using set methods.

So I'm looking for what's a concise way to update a dictionary, or
create a new dictionary, using basically an intersection method.

(I'm using Python 2.4.1 so I do have convenient builtin set operations
available)

In my taste, using generator expressions with conditions actually
doesn't look very readable; it hides the set-membership test under the
syntactic clutter.
(I don't mind generator expressions in principle, but I do feel that
here they clutter up the intent of the code)

cheers,

--Tim

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


Re: Removing dictionary-keys not in a set?

2005-04-18 Thread Tim N. van der Leeuw
Hi Klaus,

I think I like the looks of your version the best, so far. Readable and
clear, to me.

cheers and thanks,

--Tim

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


Re: Problem with unpack hex to decimal

2005-04-18 Thread [EMAIL PROTECTED]
Thank you all very much. It looked like I was not the only one
confused.

Jake.

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


Re: How to get a Function object from a Frame object

2005-04-18 Thread Steven Bethard
Gigi wrote:
I need access to a function object that corresponds to a frame object in 
a certain case from inside the function.

I can get the frame object using:
f = sys._getframe(0)
But the resulting frame object doesn't contain the information I need. 
There is a lot of information in the code object (f.f_code), but not the 
actual function or method object.

The inspect module doesn't help either it just provides nicer interface 
to the Frame object.

Any ideas out there?
Can you look up the code's co_name in the previous frame's locals?
py def getself():
...frame = sys._getframe(1)
...return frame.f_back.f_locals[frame.f_code.co_name]
...
py def g():
... def h():
... return getself()
... return dict(g=getself(), h=h())
...
py g()
{'h': function h at 0x01194BB0, 'g': function g at 0x01194BF0}
You probably also need to check the previous frame's globals...  And 
there are probably some cases where this code still wouldn't work...

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


Re: Removing dictionary-keys not in a set?

2005-04-18 Thread Steven Bethard
Tim N. van der Leeuw wrote:
In my taste, using generator expressions with conditions actually
doesn't look very readable; it hides the set-membership test under the
syntactic clutter.
You might try different indentation.  I find that I write a lot of my 
list comprehensions and generator expressions like:

dict((k, v)
 for k, v in d.iteritems()
 if k in s)
It looks much more like the for-loop in my mind, and I can easily spot 
each of the for- and if-expressions in the genexp.

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


Re: Behaviour of str.split

2005-04-18 Thread Tim N. van der Leeuw

runes wrote:
 The behaviour of .split(*) is not that strange as the splitpoint
 always disappear. The re.split() have a nice option to keep the
 splitpoint which the str.split should have, I think.

 One expectation I keep fighting within myself is that I expect

 mystring.split('') to return  ['m', 'y', 's', 't', 'r', 'i', 'n',
 'g']. But I guess it's in line with There should be one-- and
 preferably only one --obvious way to do it. that it's not so.

Fortunately, this is easy to write as: list(mystring).
Actually for me it's not so counter-intuitive that mystring.split('')
doesn't work; what are you trying to split on?

Anyways, I usually need to split on something more complicated so I
split with regexes, usually.

cheers,

--Tim

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


Re: ANN: Python 2.3.2 for PalmOS available

2005-04-18 Thread Fraca7
On Fri, 15 Apr 2005 16:40:05 -0700, [EMAIL PROTECTED] wrote:

 Hello,

 While talking with Facundo while in a PyAr meeting (python-argentina,
 http://www.python.org/ar ) he told me that there is some interest in
 this platform.

You bet there is. i almost bought a Pocket PC instead of my Clié TH55
because I thought Python would be available sooner on it...

 So, ive made an initial release that has no documentation on how to use
 it or compile it (it requires codewarrior). If there is any interest on
 this, please let me know so we can work on getting this as a real port.

I'm a beginner at PalmOS programming (actually, I've read a book about it,
and that's it) but I'd be glad to help...

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


Re: Behaviour of str.split

2005-04-18 Thread runes
[Tim N. van der Leeuw]
 Fortunately, this is easy to write as: list(mystring).

Sure, and map(None, mystring)

Anyways, I have settled with this bevaviour, more or less ;-)

Rune

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


packages

2005-04-18 Thread Mage
   Hello,

I read about modules and packages in the tutorial. I think I understand
how to use packages and modules, even I know how to create a module (as
far I understand it's a simple .py) file , but I don't know how can I
create a package and when should I do it.

Where should I look for more information?

   Mage

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


Re: Removing dictionary-keys not in a set?

2005-04-18 Thread Oren Tirosh
Tim N. van der Leeuw [EMAIL PROTECTED] wrote in message news:[EMAIL 
PROTECTED]...
 Hi,
 
 I'd like to remove keys from a dictionary, which are not found in a
 specific set. 

Here's my magic English-to-Python translator:

I'd like to ... keys which ...  -  for key in
keys from a dictionary  -  set(dictionary)
not found in a specific set -  -specificset
... remove keys ... -  del dictionary[key]

Putting it all together:

 for key in set(dictionary)-specificset:
...del dictionary[key]

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


Re: packages

2005-04-18 Thread Chris Cioffi
Check out http://docs.python.org/tut/node8.html#SECTION00840

Basically a package is a directory with one or more Python modules
along with the special module called __init__.py.

Chris

On 18/04/05, Mage [EMAIL PROTECTED] wrote:
   Hello,
 
 I read about modules and packages in the tutorial. I think I understand
 how to use packages and modules, even I know how to create a module (as
 far I understand it's a simple .py) file , but I don't know how can I
 create a package and when should I do it.
 
 Where should I look for more information?
 
   Mage
 
 --
 http://mail.python.org/mailman/listinfo/python-list
 



-- 
I was born not knowing and have had only a little time to change that
here and there. -- Richard Feynman
--
http://mail.python.org/mailman/listinfo/python-list


Re: packages

2005-04-18 Thread Jaime Wyant
A package is a collection of related modules.  The modules are
'collected' in a directory that contains a special __init__.py script.

Put this directory some where in your PYTHONPATH and you can do stuff like -
from mypackage.mymodule import MyObject

The tutorial uses a sound package as its example.  The idea being that
the Sound package contains sub packages.  For instance the
sound.effects package represents some specific sound effect such as:
`echo', 'surround', 'reverse'.

This means that you have a directory structure like (stripped from the
tutorial) -

Sound/  Top-level package
  __init__.py   Initialize the sound package
  Effects/  Subpackage for sound effects
  __init__.py
  echo.py
  surround.py
  reverse.py

What I *dont* like about the example is the PascalStyleCasing used for
the package names.  Is their not some *suggested* standard on naming
conventions?  This is one of my few gripes about python!  The
libraries seem to be written without regards to a consistent naming
standard.  Some modules, such as the logging module use camelCasing
while others such as the string module use lowercaseruntogether
methods.

I hope that python 3000 addresses this!  Me, I've just gotten used to
RTFM'n.  Doh!  Tangent!  Anyway...

Another example of packages that I use is for building my GUI. 
Because I don't have many `screens', I break things up into packages
like this:

myapp.panels (contains all of the `panels' i use)
myapp.dialogs (contains all of the dialogs i use)
myapp.database (contains database related modules)

Which allows me to do something like this in my app -

from myapp.panels.firsttimepanel import FirstTimePanel

Get it?
jw

On 4/18/05, Mage [EMAIL PROTECTED] wrote:
Hello,
 
 I read about modules and packages in the tutorial. I think I understand
 how to use packages and modules, even I know how to create a module (as
 far I understand it's a simple .py) file , but I don't know how can I
 create a package and when should I do it.
 
 Where should I look for more information?
 
Mage
 
 --
 http://mail.python.org/mailman/listinfo/python-list

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


Re: Replaying multimedia data.

2005-04-18 Thread Diez B. Roggisch
 When I am done gathering data, I read them offline using nearly the
 same script as the one I used to gather them. While I don't have a
 problem with reading them in a text format, I would like to display
 them to others than myself in a way that is visually appealing.
 Something along the lines of replaying the data. In other words,
 traces like acceleration, would be appearing on a graph as if the robot
 was evolving over time after I push a replay button. I'd like to do
 that not only for the nine traces (1-d plots) I have but also with the
 frames taken the camera (in effect, the screen would show a cartoon of
 frames of what the robot saw during the data gathering) in real-time.

For the sensors, you could use PyQwt. It's a great collection of widgets for
displaying scientific data.

The image data - well, you can display images of various formats using Qt
(and other toolkits too, of course). So you have to provide them with that
data. 
-- 
Regards,

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


Re: Pattern Matching Given # of Characters and no String Input; use RegularExpressions?

2005-04-18 Thread tiissa
Synonymous wrote:
tiissa [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED]...
tiissa wrote:
If you know the number of characters to match can't you just compare 
slices?
If you don't, you can still do it by hand:
In [7]: def cmp(s1,s2):
  : diff_map=[chr(s1[i]!=s2[i]) for i in range(min(len(s1), 
len(s2)))]
  : diff_index=''.join(diff_map).find(chr(True))
  : if -1==diff_index:
  : return min(len(s1), len(s2))
  : else:
  : return diff_index
  :
I will look at that, although if i have 300 images i dont want to type
all the comparisons (In [9]: cmp('ccc','cccap')) by hand, it would
just be easier to sort them then :).
I didn't meant you had to type it by hand. I thought about writing a 
small script (as opposed to using some in the standard tools). It might 
look like:

In [22]: def make_group(L):
   : root,res='',[]
   : for i in range(1,len(L)):
   : if ''==root:
   : root=L[i][:cmp(L[i-1],L[i])]
   : if ''==root:
   : res.append((L[i-1],[L[i-1]]))
   : else:
   : res.append((root,[L[i-1],L[i]]))
   : elif len(root)==cmp(root,L[i]):
   : res[-1][1].append(L[i])
   : else:
   : root=''
   : if ''==root:
   : res.append((L[-1],[L[-1]]))
   : return res
   :
In [23]: L=['cccat','cccap','cccan','dddfa','dddfg','dddfz']
In [24]: L.sort()
In [25]: make_group(L)
Out[25]: [('ccca', ['cccan', 'cccap', 'cccat']), ('dddf', ['dddfa', 
'dddfg', 'dddfz'])]

However I guarantee no optimality in the number of classes (but, hey, 
that's when you don't specify the size of the prefix).
(Actually, I guarantee nothing at all ;p)
But in particular, you can have some file singled out:

In [26]: make_group(['cccan','cccap','cccat','cccb'])
Out[26]: [('ccca', ['cccan', 'cccap', 'cccat']), ('cccb', ['cccb'])]
It is a matter of choice: either you want to specify by hand the size of 
the prefix and you'd rather look at itertools as pointed out by Kent, or 
you don't and a variation with the above code might do the job.
--
http://mail.python.org/mailman/listinfo/python-list


Re: packages

2005-04-18 Thread F. Petitjean
Le Mon, 18 Apr 2005 20:29:39 +0200, Mage a écrit :
Hello,
 
 I read about modules and packages in the tutorial. I think I understand
 how to use packages and modules, even I know how to create a module (as
 far I understand it's a simple .py) file , but I don't know how can I
 create a package and when should I do it.
The standard library contains some packages : email, xml, distutils ...
Read the __init__.py in the directory package-name.
 
 Where should I look for more information?
 
Mage
 
example of use :
import distutils
help(distutils)
help(distutils.sysconfig)
Traceback (most recent call last):
  File stdin, line 1, in ?
AttributeError: 'module' object has no attribute 'sysconfig'
import distutils.sysconfig
help(distutils.sysconfig)
distutils.sysconfig.get_python_lib(standard_lib=True)
'/home/fp2x/local/lib/python2.4'
distutils.sysconfig.get_python_lib(standard_lib=False)
'/home/fp2x/local/lib/python2.4/site-packages'


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


Re: packages

2005-04-18 Thread tiissa
Jaime Wyant wrote:
What I *dont* like about the example is the PascalStyleCasing used for
the package names.  Is their not some *suggested* standard on naming
conventions?
There is: see PEP 8.
http://www.python.org/peps/pep-0008.html
However, I understood there was no definitive convention hence various 
common styles.
--
http://mail.python.org/mailman/listinfo/python-list


Twisted for online games

2005-04-18 Thread sir.shz
Hi, I'm just starting to play with Twisted, and planning to use it for
sone online games (e.g., casino games, etc.), have people done that
before, are there any pointers? Thanks.

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


Re: Do You Want To Know For Sure That You Are Going To Heaven? The reason some people don't know for sure if they are going to Heaven when they die is because they just don't know. The good news is that you can know for sure that you are going to Heaven wh

2005-04-18 Thread sheltech
No, but I know some cowboys who are ... (how can I put this delicately?)
er...
inclined towards the bovine , who yell Bramah ! . Did I say I knew
them?...
I meant knew OF them. Yeah , OF.

HTH

DS
Mike brown [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 In article [EMAIL PROTECTED],
 thesonoftruth [EMAIL PROTECTED] wrote:

  I wonder if anyone yells VISHNU !!  VISHNU !  when making
  out,


 I might have.

 It's been so long that I've forgotten.

 MJRB




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


Re: Parse command line options

2005-04-18 Thread thomasadunham
Hue,
It looks like you may have options and arguments confused. Arguments
are the pieces of information that your program needs to run. Options
are used to tune the behaviour of your program.

For example:
grep -i foo bar
Tries to match the expression foo in the file bar, ignoring the
case of the letters. The grep program needs to know what expression to
look for and where to look, so foo and bar are arguments. Ignoring
the case of the letters is tuning the behaviour of the grep program -
in this case making it less sensitive. The program will run without it.


If your task is :
python  MyScriptName.py  n  t  h  i  o
Then n, t, h, i and o are arguments. You can get them from the args
array:

import sys
print ,.join(sys.argv)

would print n, t, h, i, o

If you are using options, you must put dashes before them, and they
must be before the arguments. So, if this was hue.py:

import sys
import string
import getopt

def usage():
print '''haarp_make.py -- uses getopt to recognize options

Options: -n  -- No
 -t  -- Time
 -h  -- help
 -i  -- image_file
 -o  -- Output:filename'''

sys.exit(1)

def main():

print SYS ARGV: , ,.join(sys.argv)
try:

opts,args = getopt.getopt(sys.argv[1:], 'n:t:h:i:o:',
[Number=,time=,help=,image_file=,Output Filename=])

except getopt.GetoptError:
print 'Unrecognized argument or option'
usage()
sys.exit(0)

print OPTS: , ,.join([repr(o) for o in opts])
print ARGS: , ,.join(args)

if __name__ == __main__:
main()


Then:
C:\temppython hue.py n  t  h  i  o
SYS ARGV:  hue.py,n,t,h,i,o
OPTS:
ARGS:  n,t,h,i,o

And:
C:\temppython hue.py  -i image.py n  t  h  o
SYS ARGV:  hue.py,-i,image.py,n,t,h,o
OPTS:  ('-i', 'image.py')
ARGS:  n,t,h,o

Hope that hepls.
Tom

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


Re: Python 2.4 killing commercial Windows Python development ?

2005-04-18 Thread Jarek Zgoda
Roger Binns napisa(a):
The distutils approach is mainly useful for packages and libraries,
not for applications.  And of course it still has the prerequisites
issues mentioned earlier.
This reminds me, that there is still no clear direction as to where 
install Python applications on Linux if one wants to be FHS-compliant. 
Teoretically, one may try to install to /opt/appname hierarchy, but many 
distributions simply refuse such packages (as it was the case with my 
JPA in PLD Linux).

--
Jarek Zgoda
http://jpa.berlios.de/ | http://www.zgodowie.org/
--
http://mail.python.org/mailman/listinfo/python-list


Re: fpectl

2005-04-18 Thread tiissa
Matt wrote:
Sébastien Boisgérault wrote:
My platform is Linux (Mandrake 10.x)
I'm assuming that means you can't use it on a Windows platform
It's harsh to say Mandrake is a Windows platform. ;o)
--
http://mail.python.org/mailman/listinfo/python-list


def a((b,c,d),e):

2005-04-18 Thread AdSR
Fellow Pythonistas,

Please check out

http://spyced.blogspot.com/2005/04/how-well-do-you-know-python-part-3.html

if you haven't done so yet. It appears that you can specify a function
explicitly to take n-tuples as arguments. It actually works, checked
this myself. If you read the reference manual at
http://docs.python.org/ref/function.html
really carefully, you will find that it is indeed part of the language
spec, but it's a likely candidate for the least advertised Python
feature. Small wonder since it looks like one of those language
features that make committing atrocities an order of magnitude easier.

Has anyone actually used it in real code?

Cheers,

AdSR

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


Tkinter Tkconstants

2005-04-18 Thread codecraig
Hi,
  I was reading through the Tkinter tutorial at
http://www.pythonware.com/library/tkinter/introduction/index.htm ...and
it mentions that by doing,

from Tkinter import *

you have access to the constants in Tkconstants, since Tkinter imports
it automatically.

However, in the shell if I do..

from Tkinter import *

print Tkinter.HORIZONTAL

I get an error..NameError: Tkinter is not defined

any ideas?  However, if I do,

import Tkconstants
print Tkconstants.HORIZTONAL

I get what i expect.  but according to the tutorial i should only need
Tkinter.

Thanks.

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


Re: def a((b,c,d),e):

2005-04-18 Thread Simon Percivall
You can always unpack a tuple that way, like in:

. import sys
. for (index, (key, value)) in enumerate(sys.modules.iteritems()):
pass

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


Re: Can a function be called within a function ?

2005-04-18 Thread Steve Horsley
Peter Moscatt wrote:
Is it possible to write code and allow a function to be called within
another like I have shown below ?
Pete

def populatelist():
f=open(_globals.appath + dxcluster.svr,r)
while true:
text = f.readline()
if text ==:
break
_list.append(string.strip(text))
f.close()


def serversettings():
servers.main(root)
if _globals.refresh==yes:
populatelist()   --- calling function above.


Yes. It is perfectly normal. As programs get more complex,  you 
find methods calling methods calling methods. And as Kent pointed 
out, you are already callin methods from withon methods by 
calling the likes of open() and close().

Beware of creating loops - methods that call themselves, eitehr 
directly or by calling other methods that end up calling the 
original method. This can be done with care to make sure that at 
some point a method is sure to return without calling onwards, 
usually by having the problem simplified every time, but you 
should avoid this kind of thing for now. It's called recursion. 
An example would be in calculating x to the power of y. x^y can 
be calculated by working out x * x^(y-1), but x^(y-1) is x * 
x^(y-2) etc. But you canbe sure this ends when we finally come to 
work out x^1 which is x, and this breaks the loop. If that makes 
sense.

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


  1   2   >