RELEASED Python 2.4.1, release candidate 2

2005-03-18 Thread Anthony Baxter

On behalf of the Python development team and the Python community, I'm
happy to announce the release of Python 2.4.1 (release candidate 2).

Python 2.4.1 is a bug-fix release. See the release notes at the website
(also available as Misc/NEWS in the source distribution) for details of
the bugs squished in this release.

Assuming no major problems crop up, a final release of Python 2.4.1 will
be out around the 29th of March - straight after PyCon.

For more information on Python 2.4.1, including download links for
various platforms, release notes, and known issues, please see:

http://www.python.org/2.4.1

Highlights of this new release include:

  - Bug fixes. According to the release notes, several dozen bugs
have been fixed, including a fix for the SimpleXMLRPCServer 
security issue (PSF-2005-001).

  - A handful other bugs discovered in the first release candidate 
have been fixed in this version.

Highlights of the previous major Python release (2.4) are available 
from the Python 2.4 page, at

http://www.python.org/2.4/highlights.html

Enjoy the new release,
Anthony

Anthony Baxter
[EMAIL PROTECTED]
Python Release Manager
(on behalf of the entire python-dev team)


pgpyk6YVXzW2y.pgp
Description: PGP signature
-- 
http://mail.python.org/mailman/listinfo/python-announce-list

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


[ANNOUNCE] Twenty-third release of PythonCAD now available

2005-03-18 Thread Art Haas
I'm pleased to announce the twenty-third development release of PythonCAD,
a CAD package for open-source software users. As the name implies,
PythonCAD is written entirely in Python. The goal of this project is
to create a fully scriptable drafting program that will match and eventually
exceed features found in commercial CAD software. PythonCAD is released
under the GNU Public License (GPL).

PythonCAD requires Python 2.2 or newer. The interface is GTK 2.0
based, and uses the PyGTK module for interfacing to GTK. The design of
PythonCAD is built around the idea of separating the interface
from the back end as much as possible. By doing this, it is hoped
that both GNOME and KDE interfaces can be added to PythonCAD through
usage of the appropriate Python module. Addition of other PythonCAD 
interfaces will depend on the availability of a Python module for that
particular interface and developer interest and action.

The twenty-third release contains a several bug fixes, the largest of
which is the correct restoration of dimension string text properties when
the deletion of a dimension is undone. Another fix included in this release
is the removal of some deprecated constants flagged by the 2.6 PyGTK
release when they are encountered. This release also features the
beginnings of the scripting enhancements planned for PythonCAD. The
evaluation of user-entered expressions is now more powerful by utilizing
Python's exec keyword and invoking the eval() command with an argument
storing variables to be utilized during expression evaluation. More
enhancements and improvements in expression evaluation and overall
scriptability will appear in future releases.

A mailing list for the development and use of PythonCAD is available.
Visit the following page for information about subscribing and viewing
the mailing list archive:

http://mail.python.org/mailman/listinfo/pythoncad

Visit the PythonCAD web site for more information about what PythonCAD
does and aims to be:

http://www.pythoncad.org/

Come and join me in developing PythonCAD into a world class drafting
program!

Art Haas
-- 
Man once surrendering his reason, has no remaining guard against absurdities
the most monstrous, and like a ship without rudder, is the sport of every wind.

-Thomas Jefferson to James Smith, 1822
-- 
http://mail.python.org/mailman/listinfo/python-announce-list

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


ctypes 0.9.6 released

2005-03-18 Thread Thomas Heller
ctypes 0.9.6 released - Mar 18, 2005


Overview

ctypes is an advanced ffi (Foreign Function Interface) package for
Python 2.3 and higher.

ctypes allows to call functions exposed from dlls/shared libraries
and has extensive facilities to create, access and manipulate
simple and complicated C data types in Python - in other words:
wrap libraries in pure Python.  It is even possible to implement C
callback functions in pure Python.

ctypes now includes a code generator toolchain which allows
automatic creation of library wrappers from C header files.
This feature is still experimental and beta quality.

ctypes runs on Windows, MacOS X, Linux, Solaris, FreeBSD, OpenBSD.
It may also run on other systems, provided that libffi supports
this platform.

For windows, ctypes contains a ctypes.com package which allows to
call and implement custom COM interfaces.

Important

If you download the source distribution, please choose the ZIP
file for Windows, and the .tar.gz file for other machines.
These archive have different contents!

There have been lots of changes - if you are the author or user of
a package that uses ctypes, please test it with this release
and report problems on the ctypes-users mailing list.

Changes in 0.9.6

Thanks to all of you who reported bugs so quickly, and those who
tried out the codegenerator toolchain.

Bug fixes:

- keyword arguments in Structure/Union initializers had no effect.

- it was impossible to override the from_parm class method
in subclasses of c_void_p, c_char_p, and c_wchar_p.

- removed the __del__ method of _CDLL. It caused uncollectable
garbage in Python's gc.

- ctypes.com.register: enclose the Python script to run a com
server in quotes, otherwise it won't run correctly when the
directory name contains spaces.

Enhancements:

- Several changes have been made to the h2xml script from the
codegenerator toolchain. See the documentation (linked below) for
details.

---

Additions in 0.9.5

New package ctypes.wrap. This contains decorators usable for
easier creation of wrapper functions.

This package also contains a toolchain for (semi)automatic
creation of wrappers for external libraries - it can parse
C header files and generate ctypes code for the declarations in
them.  It can even handle preprocessor definitions! For details,
see http://starship.python.net/crew/theller/ctypes/codegen.html


Changes in 0.9.5

On systems where sizeof(int) == sizeof(long), c_int/c_long and
c_uint/c_ulong are now aliases.  Similar for c_long/c_longlong and
c_ulong/c_ulonglong.  This prevents unneeded type errors.

If an exception occurs in a callback function, a full traceback is
now printed.  Raising SystemExit in a callback function now
correctly exists Python.

HRESULT is now a proper ctype - no longer a function.  This allows
to use it in the argtypes sequence for function prototypes.

An easier way to define structures and unions that reference
themselves, or have dependencies to other data types.  The
_fields_ attribute can now be set *after* the Structure/Union
class has been created.  This makes the SetPointerType function
obsolete.

The semantics of the _fields_ attribute in sub-subclasses of
Structure and Union has been fixed.  The baseclasses _fields_ list
is extended, not replaced, in subclasses.  Assigning _fields_ when
it is no longer possible raises an error now.

Structures and unions now work as restype and in the argtypes list
for functions.

An important bug has been fixed with pointers.


Detailed changelogs are in CVS:

http://cvs.sourceforge.net/viewcvs.py/ctypes/ctypes/ChangeLog?rev=HEAD


http://cvs.sourceforge.net/viewcvs.py/ctypes/ctypes/win32/com/ChangeLog?rev=HEAD


Download

Downloads are available in the sourceforge files section
http://sourceforge.net/project/showfiles.php?group_id=71702

Separate source distributions are available for windows and non-windows 
systems.
Please use the .zip file for Windows (it contains the ctypes.com framework),
and use the .tar.gz file for non-Windows systems (it contains the
complete cross-platform libffi sources).

Binary windows installers, which contain compiled extension
modules, are also available, be sure to download the correct one
for the Python version you are using.


Homepage

http://starship.python.net/crew/theller/ctypes/

Enjoy,

Thomas

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

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


Re: Why tuple with one item is no tuple

2005-03-18 Thread Kay Schluehr
Antoon Pardon wrote:

 for instance I have written once somekind of vector class where
 it was natural for these vectors to be added as well as te be
 concatenated. Unfortunately python uses + for both so I had
 no way to have both operators in a natural way in python.

Yes this is a quite common problem if one wants to have both an
addition- and a concatenation operator. I created once a Hex class
representing both a bytecode  and a number and i resolved the need for
a concatenation by overloading __floordiv__. Both a __div__ and a
__floordiv__ are not needed for most of the types that are not ints.

 a,b = Hex(0x78),Hex(00)
 a+b
0x78
 a//b
0x7800

I would have prefered overloading a common concatenation operaor, say
__cat__ which is mapped onto || but i think using + for
concatenation comes from the convenience to concatenate strings in this
manner in other languages and has spreaded into the domain of lists and
tuples in Python.

On the other hand i find Mathematicas list operators very appealing:

In =: [1,2,3]^2
Out=: [1,4,9]

Compared with this suggar the list comprehension [x**2 for x in
[1,2,3]]
is ugly.

Regards Kay

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


Re: Interface support?

2005-03-18 Thread Ville Vainio
 Michael == Michael Spencer [EMAIL PROTECTED] writes:

Michael Steve wrote:

 Is it possible to design interfaces that classes must implement
 in Python?

Michael PyProtocols: http://peak.telecommunity.com/PyProtocols.html,

This (PyProtocols) seems to be the one with biggest momentum at the
time being, so if you can't be bothered to perform an independent and
balanced evaluation, go for PyProtocols :-).

-- 
Ville Vainio   http://tinyurl.com/2prnb
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Is Python like VB?

2005-03-18 Thread Joe
On Thu, 17 Mar 2005 22:02:48 -0800, Tim Roberts [EMAIL PROTECTED]
wrote:
Why on earth would
you choose to reimplement your software in a different language, rather
than just do the simple version upgrade?

A lot of developers and companies are pondering this issue. The
end-of-lifing of Classic VB is a wake-up call for many, who take this
opportunity to check whether it's a good idea to keep using
proprietary tools which can be discontinued any time if the
manufacturer figures he can get away with forcing his customers to
upgrade.

From there, it's like playing the stock exchange: Is it more risky and
financially sound to follow Microsoft and switch from VB Classic to
VB.Net, or to jump ship, and use open-source solutions?

At this point, I would advise the OP, if possible, to just keep
working on the Classic VB version of his application while developing
small side-projects in VB.Net to master this new language/tool, and
once 80% of hosts have the .Net framework, it'll be time to check
which route seems more promising.

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


Re: PyGoogle featured on Google Code

2005-03-18 Thread Michael Hoffman
[EMAIL PROTECTED] wrote:
Google has started a site Google Code http://code.google.com/ to
showcase Open Source software, and the first featured project is
PyGoogle, a Python module wrapper for the Google Web APIs. Also
mentioned is goopy/functional, a library that brings functional
language attributes to Python.
I took a look at goopy and I found that much of the stuff in it
could be done more efficiently with an itertools recipe. But then
again, it also had sum() and maximum() functions so it must have
been written for an older version of Python. Not sure how useful
it is to someone with Python 2.3+. Although thanks anyway, Google!
Although there is a flatten(); Raymond is still working on that. ;)
--
Michael Hoffman
--
http://mail.python.org/mailman/listinfo/python-list


Re: fastest postgresql module

2005-03-18 Thread Josef Meile
my only issue with psycopg, is last time i looked they had no win32 port?
Not completely true. Since long time ago there is a website with
unofficial psycopg binaries:
http://www.stickpeople.com/projects/python/psycopg/
Regards,
Josef
--
http://mail.python.org/mailman/listinfo/python-list


Re: (Tkinter) Adding delay to PopUpMsg

2005-03-18 Thread Eric Brunel
On 17 Mar 2005 23:40:20 -0800, Harlin Seritt [EMAIL PROTECTED] wrote:
I am working on making something called a PopMsg widget which is
actually identical to a Balloon widget from Pmw. Here is the code:
---code---
from Tkinter import *
import time
class PopMsg:
def showmsg(self, event):
for a in range(1000): pass
Very effective way to waste a lot of CPU time and to make your delay 
totally dependent on the CPU speed! Why don't you at least use time.sleep (that 
you use some lines below for no apparent reason BTW)?
[snip code]
My problem you'll notice is that I tried to put something of a 'delay'
that will allow the popup to show a few seconds after the cursor has
entered the targeted widget's space (in this case the button). That
works ok but I've found that while waiting I can't activate (or
'click') on the button until the PopMsg has shown up. Is there anything
I can do to solve this problem?
Use Tkinter widgets' after method; the binding on Enter on the widget 
should do something like:
self.widget.after(1000, self.showmsg)
This tells the tk main loop to wait 1000 milliseconds, then run the method. Note that no event will 
be passed, so you should make the event parameter in showmsg optional. This is an 
active wait, so all other events will be treated. If for some reason, you want to cancel the 
action, you can remember the result of the after method, and then pass it to the 
after_cancel method on the same widget:
x = self.widget.after(1000, self.showmsg)
...
self.widget.after_cancel(x)
HTH
--
python -c 'print .join([chr(154 - ord(c)) for c in 
U(17zX(%,5.z^5(17l8(%,5.Z*(93-965$l7+-])'
--
http://mail.python.org/mailman/listinfo/python-list


xmlproc maintainer?

2005-03-18 Thread Alban Hertroys
Hello all,
We recently (about a week ago) sent a patch to the maintainer of 
xmlproc, but we didn't receive a reply yet. A look at the site reveals 
that the last update was somewhere in 2000.

Does anybody know who the current maintainer is (if that changed), or 
what the status of xmlproc is? We kind of depend on it...

The patch fixes a buffering problem if the XML contains utf-8 codes, 
which gets especially problematic if one such character pair starts as 
the last byte in the buffer... Patch attached, in case someone can use it.

Regards,
Alban Hertroys,
MAG Productions.
--- ../xmlproc-backup/xmlutils.py   2005-03-11 11:04:44.0 +0100
+++ xmlutils.py 2005-03-11 13:45:43.0 +0100
@@ -264,8 +264,8 @@
 decoder could have run out of data. The latter case is very
 hard to determine in Python 2.0
 
-if str(exc) in [UTF-8 decoding error: unexpected end of data,
-UTF-16 decoding error: truncated data]:
+s = str(exc)
+if s.find('unexpected end of data')!=-1 or s.find('truncated 
data')!=-1:
 while 1:
 self.encoded_data = new_data[-1]+self.encoded_data
 new_data = new_data[:-1]
@@ -296,7 +296,7 @@
 first_feed = 1
 self.parseStart()
 
-new_data = new_data + self.encoded_data
+new_data = self.encoded_data + new_data
 self.encoded_data = 
 
 if not decoded and not self.charset_converter:
@@ -720,6 +720,7 @@
 # to the recoding.
 try:
 self.data = self.charset_converter(self.data)
+   self.datasize = len(self.data)
 except UnicodeError, e:
 self._handle_decoding_error(self.data, e)
 self.input_encoding = enc1
-- 
http://mail.python.org/mailman/listinfo/python-list

please help on installation process

2005-03-18 Thread Arindam




Hi
I had downloaded 
python-2.4.msi and I have Windows Installer V2.00.2600.2 on my machine (my OS is 
Win 2K Professional). But every time I try to run python-2.4.msi I am getting 
the error message: "This installation package could not be 
opened..." I am a newsier in python, I would be grateful if you please 
advise me what to do.

Regards
Arindam Mitra
WinCliff Technologies
[EMAIL PROTECTED]
Phone : +919831190761
(www.wincliff.com)

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

Re: how to handle repetitive regexp match checks

2005-03-18 Thread Duncan Booth
Matt Wette wrote:

 I am having difficulty doing this cleanly in python.  Can anyone help?
 
  rx1 = re.compile(r'struct {')
  rx2 = re.compile(r'typedef struct {')
  rx3 = re.compile(r'something else')
 
  m = rx1.match(line)
  if m:
do something
  else:
m = rx2.match(line)
if m:
  do something
else:
  m = rx3.match(line)
  if m:
do something
  else:
error
 
 (In Scheme I was able to do this cleanly with macros.)

My preferred way to do this is something like this:

import re

RX = re.compile(r'''
   (?Prx1 struct\s{ )|
   (?Prx2 typedef\sstruct\s{  )|
   (?Prx3 something\selse )
''', re.VERBOSE)

class Matcher:
def rx1(self, m):
print rx1 matched, m.group(0)

def rx2(self, m):
print rx2 matched, m.group(0)

def rx3(self, m):
print rx3 matched, m.group(0)

def processLine(self, line):
m = RX.match(line)
if m:
getattr(self, m.lastgroup)(m)
else:
print error,repr(line),did not match

matcher = Matcher()
matcher.processLine('struct { something')
matcher.processLine('typedef struct { something')
matcher.processLine('something else')
matcher.processLine('will not match')

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


help on installation

2005-03-18 Thread Arindam





Hi
I had downloaded 
python-2.4.msi and I have Windows Installer V2.00.2600.2 on my machine (my OS is 
Win 2K Professional). But every time I try to run python-2.4.msi I am getting 
the error message: "This installation package could not be 
opened..." I am a newsier in python, I would be grateful if you please 
advise me what to do.

Regards

Arindam Mitra
WinCliff Technologies
[EMAIL PROTECTED]
Phone : +919831190761
(www.wincliff.com)

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

Re: Proposal for adding Shallow Threads and a Main Loop to Python

2005-03-18 Thread Diez B. Roggisch
Hi, 

a few questions:

 A shallow thread is just a generator modified in the most obvious way
 possible.  The yield statement is replaced with a waitfor expression.
 You give it the object you wish to wait for.  Then when it's ready
 you get back a return value or an exception.  These waitfor expressions
 are the only points where your shallow thread may get suspended, so
 it's always explicit.  If you call another function it will be treated
 exactly as a normal function call from a generator (this is why they're
 'shallow'), so there's no issues with calling C functions.
 
 On the other end of things, your shallow thread object would have
 __resume__ and __resumeexc__ methods (or perhaps a single __resume__
 method with a default raise_=False argument).  They return a tuple of
 (mode,value) where mode is a string of 'waitfor', 'exception', or
 'return' and value corresponds to that.  These methods will be used by
 a main loop to resume the shallow thread, like next() is used with a
 generator.

So basically a shallow thread could be written in today's python like this?

class ShallowThread(object):
def __init__(self, data=None):
self.data = data

def run(self, initial_data=None):
while True:

yield some_state
new_data = self.data


st = ShallowThread().run(some_initial_data)
while True:
result = st.next()
st.data = some_subsequent_data

Basically some_state is your above mentioned tuple, and waitfor is like
yield with a return value that I modeled with explicit state called data.
Is that correct so far? 

 import mainloop, urllib
 
 def get_and_save(path):
 infile = waitfor urllib.urlopen(path, async=True)
 outfile = waitfor open(path.split('/')[-1], async=True)
 waitfor outfile.write(waitfor infile.read(async=True), async=True)
 infile.close()
 outfile.close()
 
 def main():
 a = get_and_save(http://python.org/pics/PyBanner021.gif;)
 b = get_and_save(http://python.org/pics/pythonHi.gif;)
 c = get_and_save(http://python.org/pics/PythonPoweredSmall.gif;)
 
 waitfor allDone(a, b, c)
 
 if __name__ == __main__:
 mainloop.runUntil(main())
 
 Well there you have it.  I've glossed over many details but they can be
 cleared up later.  What I need to know now is how everybody else thinks
 about it.  Is this something you would use?  Does it seem like the
 right way to do it?  And of course the all important one, can I get it
 in to python core?  0.5 wink

I've difficulties grasping where the actual work is done - the event
notifier thingies are sort of generators themselves, and the mainloop gets
them and calls some execute method on them?


And now the final $1000,.00 question - why all this? No offense intended
- it's a little bit more comfortable than the generators approach sketched
by others (e.g. David Mertz if I recall corretly) - but to my view, it
_could_ be done in today python because we have generators. Or not?
-- 
Regards,

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


Re: Why tuple with one item is no tuple

2005-03-18 Thread Antoon Pardon
Op 2005-03-17, Diez B. Roggisch schreef [EMAIL PROTECTED]:
 So python choose a non-deterministic direction. To me (2,3) + (4,5)
 equals (6,8). I don't dispute that having an operator to combine
 (2,3) and (4,5) in (2,3,4,5) is usefull, but they should never have
 used the + for that.

 It certainly did not choose a nondeterministic action - that would mean that
 it followed _both_ possibilities at the same time. Which clearly is not
 happening.

 And we didn't talk about (2,3) + (4,5) not being (6,8) - that's adding two
 tuples, not having (9) beeing a tuple instead of a simple nine.

We talked about the confusion that could arrise if a number could be
interpreted as a tuple because the '+' operator has a different
kind of result depending on whether the operands are numbers or
tuples. However if adding tuples would have been defined as
above their would have been a confusion because the result
would have been equivallent. 4 + 5 would have been 9 and
(4,) + (5,) would have been (9,)

And having chosen such a design wouldn't have made python
any less dynamic. So saying that the problem is the result
of python being dynamic as you once did is nonsense.

 Of course one could have overloaded tuples that way - component wise
 addition - but then people would want other kinds of vector algebraic stuff
 working on them. But they are not vectors, they are tuples. 

That could very well have been left to the users themselves. They
only needed to have used a different character for concatenation
instead of the +.

 And in general, that is an entirely new discussion about the overloading of
 operators for tuples, not the syntax of how to create them (which is
 legitimate, of course - but misleading for this thread.)

You claimed it was pythons dynamic nature that makes it difficult
to use items and one-item tuples as equivallent. I say
it has little to do with tha dynamic nature but more with the
design to use the same characters for sequence and number operations.
If these operations would have been indicated by different characters
no such problem would arrise with doing such unification.

 No my opinion is not wrong, you just don't understand what I'm saying.

 You alter the subject of discussion (see below), which caused that
 confusion.

 No it was not reasonable to introduce the semantics that made 2 * (1,2)
 equal (1,2,1,2) IMO they should have used a differend operator for that
 and not the *.

 Maybe - but thats an alltogether different discussion, as I said before.

No it is not. It is part of a counter argument to your claim
that python's dynamic nature is in the way.

 The point that made me kick into this discussion was:

 
 You really, really want (3 + 5) to be an integer, not a one-item tuple.

 I sometimes do wonder if some impliciteness wouldn't be better here,
 so that any item could be treated as if it was a one-item tuple.
 
 So you wanted (8) to be a tuple, or even more so 3 + 5 being (3,) + (5,).
 What has that to do with the operator overloading of tuples in general?
 It's a syntactic question we're discussing, _not_ a semantic one.

I didn't say I want that. I was just wondering if unification between
numbers and one number tuples wouldn't have been a good solution with
the confusion people have about (1) not being a tuple.

 As I stated before, it could become a question of type semantics if python
 was statically typed, as then the context of a expression like (8) could
 determine which type has to be created - tuple of one item, or simple 8.
 But it's not doable in python.

It has litte to do with statically typing. But when I explain that
and show what will cause a problem with such unification in current
python you say I'm altering the subject.

 For someone who expresses his disliking to type _one_ comma in the few
 cases of single element tuples in thousands of lines of code, it strikes
 me odd that you'd go an are willing to add extra trouble entering _each_
 and _every_ tuple in your code by using some hitherto unknown character
 that won't be enterable easily
 
 Where did I express this dislike. I'm not denying it because I know I
 forget such things, but I sure don't remember now.

 I showed the quote above - you wanted to have (8) behave as (8,) - so I
 concluded you either don't like typing that extra comma, or alternatively
 want introduce a new pair of parentheses to express tuples.

I was wondering about the merrits of (8) behaving as (8,) that is
not the same as wanting it. May be you shouldn't read thing that
are not there.

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


Re: Why tuple with one item is no tuple

2005-03-18 Thread Antoon Pardon
Op 2005-03-16, Daniel Dittmar schreef [EMAIL PROTECTED]:
 Diez B. Roggisch wrote:
 I reread his example and have to admit I'm confused: He complains about
 having written his _own_ vector class - and concatenation and addition had
 to use both + ?

 I've interpreted it as:
 If Python had choosen different operators for addition and sequence 
 concatenation, I could have implemented them both in my vector class. As 
 it is, I have to implement one of them using a non-standard operator.

 The examples focus too much on numbers - if we use instead 
 
 (foo)
 
 we would get a iterable yielding [foo,] or - as string already supports
 iteration - ['f', 'o', 'o']. Which one to chose?

 What I was hinting at (NOT proposing, I'd hate this) was that integers 
 implement the [] operator. 5 [0] would then return 5, for all practical 
 purposes, it would look like a tuple. String already implements []. Yes, 
 that would lead to really surprising and inconsistent behaviour.

I find this 'creative use of overloading' rather awful. But what the
heck, I find list comprehension rather awful.
 
 
 Well, the number of operators built into the language is limited - and I
 actually prefer to have the possibility to overload these if I want to.
 Nobody forces me - I could use
 
 v1.concat(v2)
 
 for two vectors v1, v2 if I wanted to.

 My peeve is about having operators added to standard types. This 
 increases the chances that using an object the wrong way leads to a 
 bogus result, not a runtime error. A more common programming error I 
 commit is passing a string where a list ist expected. And then I wonder 
 why later operations work on one-character strings.

The standard answer to this seems to be to use unittesting.

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


[Job] London based Python / Zope web developer positions

2005-03-18 Thread Dr Jack Kreindler
Blueorange Technologies is on of the UK's leading Python and Zope
development firms. Our range of advanced web-applications are used
throughout the NHS and licensed by some of the largest names in the
Healthcare, Retail and Insurance industries.

We are expanding our small, highly experienced team of Python
developers. Based in Highgate, London you will be working on both
product development and major bespoke software projects.

Both career and contract opportunities are open for mid to senior level
developers (£30k - £50k + depending on suitability and level of
experience.

Please contact Dr Jack Kreindler on [EMAIL PROTECTED] or visit
www.blueorange.net for more information.

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


html escape sequences

2005-03-18 Thread Will McGugan
Hi,
I'd like to replace html escape sequences, like nbsp and #39 with 
single characters. Is there a dictionary defined somewhere I can use to 
replace these sequences?

Thanks,
Will McGugan
--
http://mail.python.org/mailman/listinfo/python-list


HELP:UnboundLocalError: local variable '_nntp' referenced before assignment

2005-03-18 Thread Peter Moscatt
Hi all,

I am in the process of writing an app that will handle news feeds and
therefore using the 'nntplib'

When I issue the connect command all goes will but when I issue the 'quit()'
command I get the following error message:


Exception in Tkinter callback
Traceback (most recent call last):
  File /usr/lib/python2.3/lib-tk/Tkinter.py, line 1345, in __call__
return self.func(*args)
  File ./pnews.py, line 26, in callconnect
_nntp.quit()
UnboundLocalError: local variable '_nntp' referenced before assignment


The code below illustrates how I'm using the code.  Can anyone help me out
in getting this right.

Pete


def callconnect():
if b[text]==Connect:
_nntp =
nntplib.NNTP(_global.servername,int(_global.portnumber),_global.userid,_global.userpassword)
if(_nntp):
b[text]=Disconnect

elif b[text]==Disconnect:
_nntp.quit()



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


Re: HELP:UnboundLocalError: local variable '_nntp' referenced before assignment

2005-03-18 Thread Diez B. Roggisch
Peter Moscatt wrote:
 UnboundLocalError: local variable '_nntp' referenced before assignment

This pretty much says what your problem is: you haven't a variable called
_nntp

 def callconnect():
 if b[text]==Connect:
 _nntp =

nntplib.NNTP(_global.servername,int(_global.portnumber),_global.userid,_global.userpassword)
 if(_nntp):
 b[text]=Disconnect
 
 elif b[text]==Disconnect:
 _nntp.quit()

And here we see why: In the Disconnect-case, where is that _nntp supposed to
come from? I'm not sure what you want here, as you seem to rely on global
variables very much, but to me the whole elif-block is bogus. You
unecessarily communicate over b['text']

Do it like this:

def callconnect():
if b[text]==Connect:
_nntp =
nntplib.NNTP(_global.servername,int(_global.portnumber),_global.userid,_global.userpassword)
if(_nntp):
_nntp.quit()


-- 
Regards,

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


Re: RotatingFileHandler and logging config file

2005-03-18 Thread news.sydney.pipenetworks.com
Rob Cranfill wrote:
news.sydney.pipenetworks.com wrote:
You're looking in the wrong place. Try
http://docs.python.org/lib/node333.html
which isn't quite the page in question, but leads to the closest 
pertinent page,
  http://docs.python.org/lib/logging-config-fileformat.html
which *still* has nothing on RotatingFileHandler.
Yeah...sorry about that. I misunderstood what node333.html was used for. 
Looks like your best bet may be to extend the RotatingFileHandler 
directly in the handlers module and call doRollover() in __init__.

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


Re: html escape sequences

2005-03-18 Thread Leif K-Brooks
Will McGugan wrote:
I'd like to replace html escape sequences, like nbsp and #39 with 
single characters. Is there a dictionary defined somewhere I can use to 
replace these sequences?
How about this?
import re
from htmlentitydefs import name2codepoint
_entity_re = re.compile(r'(?:(#)(\d+)|([^;]+));')
def _repl_func(match):
if match.group(1): # Numeric character reference
return unichr(int(match.group(2)))
else:
return unichr(name2codepoint[match.group(3)])
def handle_html_entities(string):
return _entity_re.sub(_repl_func, string)
--
http://mail.python.org/mailman/listinfo/python-list


Re: please help on installation process

2005-03-18 Thread Simon Brunning
On Fri, 18 Mar 2005 15:05:07 +0530, Arindam [EMAIL PROTECTED] wrote:
 I had downloaded python-2.4.msi and I have Windows Installer V2.00.2600.2 on
 my machine (my OS is Win 2K Professional). But every time I try to run
 python-2.4.msi I am getting the error message: This installation package
 could not be opened... I am a newsier in python, I would be grateful if you
 please advise me what to do. 

Chances are it's an incomplete download. My python-2.4.msi is 10.3 MB
(10,887,168 bytes) - how big is yours? If it's smaller, try
downloading it again.

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


GIL release

2005-03-18 Thread Alastair Basden
Hi,
Does anyone know whether there is a way for a python thread to release 
the global interpreter lock, and let all other threads have a chance at 
running before re-acquiring it?  Does the thread scheduling follow a 
round-robin method?

Thanks,
agb.
--
http://mail.python.org/mailman/listinfo/python-list


Re: html escape sequences

2005-03-18 Thread Will McGugan
Leif K-Brooks wrote:
Will McGugan wrote:
I'd like to replace html escape sequences, like nbsp and #39 with 
single characters. Is there a dictionary defined somewhere I can use 
to replace these sequences?

How about this?
import re
from htmlentitydefs import name2codepoint
_entity_re = re.compile(r'(?:(#)(\d+)|([^;]+));')
def _repl_func(match):
if match.group(1): # Numeric character reference
return unichr(int(match.group(2)))
else:
return unichr(name2codepoint[match.group(3)])
def handle_html_entities(string):
return _entity_re.sub(_repl_func, string)
muchas gracias!
Will McGugan
--
http://mail.python.org/mailman/listinfo/python-list


Re: Why tuple with one item is no tuple

2005-03-18 Thread Daniel Dittmar
Antoon Pardon wrote:
My peeve is about having operators added to standard types. This 
increases the chances that using an object the wrong way leads to a 
bogus result, not a runtime error. A more common programming error I 
commit is passing a string where a list ist expected. And then I wonder 
why later operations work on one-character strings.

The standard answer to this seems to be to use unittesting.
I do detect that there is a problem. It just takes longer to find the 
source of bogus data than to look at a stack trace.

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


RE: COM connection point

2005-03-18 Thread Stefan Schukat
Just use

obj = win32com.client.Dispatch(obj)

  Stefan


 -Original Message-
 From: [EMAIL PROTECTED]
 [mailto:[EMAIL PROTECTED] Behalf Of
 Oy Politics
 Sent: Wednesday, March 16, 2005 11:51 PM
 To: python-list@python.org
 Subject: COM connection point
 
 
 Hello:
 
 I am building a COM client, with the ability to be called 
 back by events.
 The events can arrive independently from the server.  The 
 client method is
 called at the right time, so that is working.  However, one 
 parameter is
 itself a COM object, and I am having trouble with accessing 
 the properties
 of the parameter object.
 
 Here is the output of what I have currently.
 
 -- Python execute --
 event! PyIDispatch at 0x7fb134 with obj at 0x403404
 event! PyIDispatch at 0x7fbbf4 with obj at 0x403404
 event! PyIDispatch at 0x7a6d24 with obj at 0x403404
 
 etc.  Obj is supposed to be my intended parameter.  However, 
 when I try to
 access its property, I get the following:
 
 -- Python execute --
 pythoncom error: Python error invoking COM method.
 
 Traceback (most recent call last):
   File 
 C:\PYTHON23\Lib\site-packages\win32com\server\policy.py, line 283,
 in _Invoke_
 return self._invoke_(dispid, lcid, wFlags, args)
   File 
 C:\PYTHON23\Lib\site-packages\win32com\server\policy.py, line 288,
 in _invoke_
 return S_OK, -1, self._invokeex_(dispid, lcid, wFlags, 
 args, None, None)
   File 
 C:\PYTHON23\Lib\site-packages\win32com\server\policy.py, line 581,
 in _invokeex_
 return func(*args)
   File E:\otsl\testprojects_folder\pythoncom\pyclihh2.py, 
 line 26, in
 OnMyEvent
 print event!, obj, obj.AProp
 exceptions.AttributeError: 'PyIDispatch' object has no 
 attribute 'AProp'
 
 QueryInterface with the target IID gives the following:
 
 exceptions.TypeError: There is no interface object registered 
 that supports
 this IID
 
 CastTo gives this error:
 
 exceptions.ValueError: This object can not be cast
 
 Thanks a lot,
 -OY
 
 
 
 
 -- 
 http://mail.python.org/mailman/listinfo/python-list
 
--
http://mail.python.org/mailman/listinfo/python-list


type.__new__

2005-03-18 Thread Dirk Brenckmann
Hi there,

I'm new to this list and currently tracing down a problem...
Could anybody give me a hint, where I can find the implementation of
type.__new__. This should be somewhere in the 'c' sources - right?

I just want to read the code to see what this call really does.

Thanx for your time and help
Dirk Brenckmann

-- 
DSL Komplett von GMX +++ Supergünstig und stressfrei einsteigen!
AKTION Kein Einrichtungspreis nutzen: http://www.gmx.net/de/go/dsl
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: raise takes a long time

2005-03-18 Thread Robin Becker
Robin Becker wrote:
I'm trying to get a handle on a real world problem related to raising an 
exception. This is in the reportlab SimpleDoctemplate class.

The following code takes a very long time (60 seconds) in Python 2.2, 
2.3, 2.4, but not in 2.1 (at least on windows).

raise LayoutError(Flowable %s too large on page %d % (f.identity(30), 
self.page))

However, the supposedly functionally identical code
ident = f.identity(30)
raise LayoutError(Flowable %s too large on page %d % (ident, self.page))
does not take a long time ( 1 second). The exception LayoutError is 
trivial
class LayoutError(Exception):
pass

.
It seems this problem is caused by the above code being used in a 
cgitb.enabled() environment (in a cgi script). That also explains why it wasn't 
happening in 2.1 as we don't use cgitb in that case.

Moving f out of the cgitb evaluated variables lines allows things to work 
quickly.
Yet another cgitb problem.
--
Robin Becker
--
http://mail.python.org/mailman/listinfo/python-list


Re: xmlproc maintainer?

2005-03-18 Thread Walter Dörwald
Alban Hertroys wrote:
We recently (about a week ago) sent a patch to the maintainer of 
xmlproc, but we didn't receive a reply yet. A look at the site reveals 
that the last update was somewhere in 2000.

Does anybody know who the current maintainer is (if that changed), or 
what the status of xmlproc is? We kind of depend on it...

The patch fixes a buffering problem if the XML contains utf-8 codes, 
which gets especially problematic if one such character pair starts as 
the last byte in the buffer... Patch attached, in case someone can use it.
This should no longer be an issue with Python 2.4, because the stateful 
UTF-8 and UTF-16 decoder have been fixed to support incomplete input.

Unfortunately xmlproc doesn't seem to use the stateful decoder but the 
stateless decoder (and even handcrafted decoders when the codecs module 
doesn exist). Adding support for this might be a little tricky, because 
the parser must determine which encoding to use before instantiating the 
decoder.

Bye,
   Walter Dörwald
--
http://mail.python.org/mailman/listinfo/python-list


Monadic Parser Combinators in Python

2005-03-18 Thread Dominic Fox
Python: Now More Like Haskell Than Ever Before!

I've implemented a small monadic parser combinator library in Python
(based on Haskell code in a paper by Graham Hutton and Eric Meijer).

http://codepoetics.com/poetix/index.php?p=94

It enables you to write things like this:

 token = isalpha |seq| many(isdigit)
 tokens = token |sepBy| whitespace
 runParser(p123 q456 hello world, tokens)
['p123', 'q456']

It is probably entirely unsuited for any serious purpose, but might
qualify as an interesting hack...

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


boa can't connect to zope

2005-03-18 Thread Gijs Korremans
Hi, 

I want to debug python applications on a remote pc with Boa Constructor. To do 
this, I have to install Zope and install the remote module from boa to the 
roodfolder from the management interface (http://localhost:8080/manage). I've 
done this, set the username and password en clicked start. the management 
interface says now The debug server is active but when I want to connect to 
the server with boa constructor I get an error (connection refused) and when I 
do a portscan on the server, the port 26200 is not open. 

I'm running win2003 server with python 2.3 and zope 2.7.4. 
Can you tell me how to open the port on win2003 or tell me what else I'm doing 
wrong? 

--
This message has been scanned for viruses and
dangerous content by Network Sentry, and is
believed to be clean.
http://www.networksentry.co.za

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


Re: code for Computer Language Shootout

2005-03-18 Thread Bryan

import sys
import string
def show(seq, table=string.maketrans('ACBDGHK\nMNSRUTWVYacbdghkmnsrutwvy',
 'TGVHCDM\nKNSYAAWBRTGVHCDMKNSYAAWBR')):
 seq = seq.translate(table)[::-1]
 for i in range(0, len(seq), 60):
 print seq[i:i+60]
couldn't you change the above for loop to:
print wraptext.fill(seq, 60)

bryan

def main():
 seq = []
 for line in sys.stdin:
 if line[0] in ';':
 show(''.join(seq))
 print line,
 del seq[:]
 else:
 seq.append(line[:-1])
 show(''.join(seq))
main()

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


Re: newbie:unique problem

2005-03-18 Thread Brian van den Broek
Heiko Wundram said unto the world upon 2005-03-18 01:27:
On Thursday 17 March 2005 23:31, Brian van den Broek wrote:
Am I not
right in thinking that with the dict approach there is no guarantee
that the order from the original list will be preserved?

Yup, absolutely right that the original ordering will not be preserved. But, I 
wonder whether this actually matters, when the op is actually using these 
strings as a sort of set (to check whether someone belongs to some group, if 
I understand him correctly).

Thanks for confirming that, Heiko. (My understanding of programming 
and Python is still shaky in quite a few places :-)


Also, Heiko, I wonder what is the reason for reversed(oldlist)? Since
the list isn't being mutated, there isn't any danger in forward
iteration over it. (Plus, unless I'm mistaken, its the only thing
making yours a 2.4-only solution.)

The reason for walking the list backwards is easily demonstrated by the 
following two runs:
SNIP two functions, one with and one without the use of reversed

uniqueItems([AAA BC,BBB KK,CCC TD,AAA KP,CCC TD])
['AAA BC', 'BBB KK', 'CCC TD']
uniqueItemsWithoutRev([AAA BC,BBB KK,CCC TD,AAA KP,CCC TD])
['AAA KP', 'BBB KK', 'CCC TD']
When you walk the list forwards, the item that gets returned for the 
corresponding key is the item that is last found (as I don't check whether 
the item is already in the dict in the loop, but always just set), when you 
walk the list backwards, the item that is last found backwards (thus farthest 
in front) is returned.

In case this doesn't matter (well, I guess it actually doesn't, as the OP only 
needs the first n chars, that's the reason for this function), you can easily 
leave out the reversed() and remove the constraint on Python 2.4. If you must 
have it in this order, and still use Python 2.4, you'd need to use something 
like oldlist[::-1], which will copy the list. reversed(list) does an 
optimization.

This seems a bit funny to me. My version took a speed hit as I was 
concerned to preserve order, whereas yours uses reversed because you 
cared about how the canonical representative were selected. But 
neither of our concerns were really in the OP's problem spec. :-)

Since I didn't share your concern about the selection of canonical 
representatives, the reversed puzzled me. Thanks for posting your 
rationale for its use.

Best,
Brian vdB
--
http://mail.python.org/mailman/listinfo/python-list


Re: how to handle repetitive regexp match checks

2005-03-18 Thread Jonathan Giddy
GiddyJP wrote:
# do this once
import Trespass
pattern = Trespass.Pattern()
pattern.addRegExp(r'struct {', 1)
pattern.addRegExp(r'typedef struct {', 2)
pattern.addRegExp(r'something else', 3)
Minor correction... in this module { always needs to be escaped if not 
indicating a bounded repeat:
 pattern.addRegExp(r'struct \{', 1)
 pattern.addRegExp(r'typedef struct \{', 2)
 pattern.addRegExp(r'something else', 3)
--
http://mail.python.org/mailman/listinfo/python-list


adding a path module to stdlib

2005-03-18 Thread Alia Khouri
This may have been discussed ad nauseaum before, but every time I use
os.path manipulations I miss something like Jason Orrendorf's path.py
being in the standard library.
[http://www.jorendorff.com/articles/python/path/]

Ruby has it:
 require 'pathname'
 path = Pathname.new(/tmp/f.log)

What are we missing to make something similarly useful happen for
python?

AK

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


Re: GIL release

2005-03-18 Thread Armin Steinhoff
Alastair Basden wrote:
Hi,
Does anyone know whether there is a way for a python thread to release 
the global interpreter lock, and let all other threads have a chance at 
running before re-acquiring it?  Does the thread scheduling follow a 
round-robin method?
The thread itself are scheduled by the OS ... the access to the GIL is 
managed by 'cooperative scheduling'.

--Armin
Thanks,
agb.
--
http://mail.python.org/mailman/listinfo/python-list


wxPython and loading multiple panels (code included)

2005-03-18 Thread flupke
Hi,
i need to develop a gui which will load several windows depending on 
what the users selects in the menu and i thought i could accomplish this 
with panels.
What i'm trying to do to test this is load an initial panel and then 
when the user hits a button load a second panel. This doesn't seem to work.

1. what's the appropriate way of switching panels?
2. the loadNewPanel function seem wrong. I always get loading panel two.
Thanks,
Benedict
 multi.py ===
import wx
from multi_panel import *
active_frame = 1
class MyFrame(wx.Frame):
def __init__(self, *args, **kwds):
kwds[style] = wx.DEFAULT_FRAME_STYLE
wx.Frame.__init__(self, *args, **kwds)
self.panel = PanelOne(self)
self.__set_properties()
self.__do_layout()
def __set_properties(self):
self.SetTitle(frame_1)
def __do_layout(self):
self.sizer_1 = wx.BoxSizer(wx.VERTICAL)
self.sizer_1.Add(self.panel, 1, wx.EXPAND, 0)
self.SetAutoLayout(True)
self.SetSizer(self.sizer_1)
self.sizer_1.Fit(self)
self.sizer_1.SetSizeHints(self)
self.Layout()
def loadNewPanel(self,invoker):
if isinstance(invoker,PanelOne):
print loading panel two
self.panel = PanelTwo(self)
else:
print loading panel one
self.panel = PanelOne(self)
self.sizer_1.Fit(self)
self.sizer_1.SetSizeHints(self)
class MyApp(wx.App):
def OnInit(self):
wx.InitAllImageHandlers()
frame = MyFrame(None, -1, This is a 
wx.Frame,pos=(0,0),size=(640,480),style = wx.DEFAULT_FRAME_STYLE)
self.SetTopWindow(frame)
frame.Show()
return 1

if __name__ == __main__:
app = MyApp(0)
app.MainLoop()
 multi.py ===
and
 panels.py ===
import wx
class PanelOne(wx.Panel):
def __init__(self,parent):
wx.Panel.__init__(self, parent, -1)
self.parent = parent
self.label = wx.StaticText(self, -1, panel one)
self.switch_panel = wx.Button(self, -1, Switch to panel two, 
(50,50))
self.Bind(wx.EVT_BUTTON, self.__OnButton, self.switch_panel)
self.__do_layout()

def __do_layout(self):
self.grid_sizer = wx.GridSizer(5, 5, 4, 4)
self.grid_sizer.Add(self.label, 0, wx.FIXED_MINSIZE, 0)
self.grid_sizer.Add(self.switch_panel, 0, wx.FIXED_MINSIZE, 0)
self.SetAutoLayout(True)
self.SetSizer(self.grid_sizer)
self.grid_sizer.Fit(self)
self.grid_sizer.SetSizeHints(self)
def __OnButton(self,event):
print OnButton
self.parent.loadNewPanel(self)
class PanelTwo(wx.Panel):
def __init__(self,parent):
wx.Panel.__init__(self, parent, -1)
self.label = wx.StaticText(self, -1, panel two)
self.switch_panel = wx.Button(self, -1, Switch to panel one, 
(50,50))
self.Bind(wx.EVT_BUTTON, self.__OnButton, self.switch_panel)
self.__do_layout()

def __do_layout(self):
self.grid_sizer = wx.GridSizer(5, 5, 4, 4)
self.grid_sizer.Add(self.label, 0, wx.FIXED_MINSIZE, 0)
self.grid_sizer.Add(self.switch_panel, 0, wx.FIXED_MINSIZE, 0)
self.SetAutoLayout(True)
self.SetSizer(self.grid_sizer)
self.grid_sizer.Fit(self)
self.grid_sizer.SetSizeHints(self)
def __OnButton(self,event):
print OnButton
self.parent.loadNewPanel(self)
 panels.py ===
--
http://mail.python.org/mailman/listinfo/python-list


Re: Why tuple with one item is no tuple

2005-03-18 Thread Antoon Pardon
Op 2005-03-18, Daniel Dittmar schreef [EMAIL PROTECTED]:
 Antoon Pardon wrote:
My peeve is about having operators added to standard types. This 
increases the chances that using an object the wrong way leads to a 
bogus result, not a runtime error. A more common programming error I 
commit is passing a string where a list ist expected. And then I wonder 
why later operations work on one-character strings.
 
 
 The standard answer to this seems to be to use unittesting.
 

 I do detect that there is a problem. It just takes longer to find the 
 source of bogus data than to look at a stack trace.

Sure. But some language features would make finding the source of
some problems even faster. But when those arguments are made
the response is: use unittesting.

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


Re: Python becoming less Lisp-like

2005-03-18 Thread Antoon Pardon
Op 2005-03-16, Jeff Shannon schreef [EMAIL PROTECTED]:
 Bruno Desthuilliers wrote:

 A few examples:
 [...]
 - to get the length of a sequence, you use len(seq) instead of seq.len()
 - to call objects attributes by name, you use [get|set]attr(obj, name 
 [,value]) instead of obj.[get|set]attr(name [,value])

 These are both very consistent applications of a more functional style 
 of programming, rather than the pure object-oriented style you seem to 
 desire.  It's not that Python is inconsistent; it's that Python is 
 consistently blending multiple paradigms in a way that uses the best 
 features of each and (mostly) avoids the worst pitfalls of each.

 - if x is a class attribute of class A and a is an instance of A, 
 a.x=anyvalue create a new instance attribute x instead of modifying A.x

 This is very consistent with the way that binding a name in any scope 
 will shadow any bindings of that name in higher scopes.  It is the 
 same principle by which one is able to use the same name for a 
 function-local variable that is used for a global variable, without 
 destroying that global variable.  Doing as you suggest would be far 
 *less* consistent, and would create a special case for class/instance 
 lookups where there is none now.


Not entirely. The equivallent is imposible in function scope.
If function scope would work exactly equivallent as the
above the following should work 

a = 42
def f():
  a = a + 1
  print a
print a

And the result should be:

43
42

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


syntax incorrect with regex

2005-03-18 Thread sam
Hi,
What is the correct syntax of declaring a regex syntax in Python 2.3?
I got the following error:
# python2.3 test.py
  File test.py, line 10
macros_parser = re.compile (r (\s+)=\(\s+)\$ ,re.VERBOS)
^
SyntaxError: invalid syntax
Thanks
sam
--
http://mail.python.org/mailman/listinfo/python-list


Re: Why tuple with one item is no tuple

2005-03-18 Thread Steven Bethard
Kay Schluehr wrote:
On the other hand i find Mathematicas list operators very appealing:
In =: [1,2,3]^2
Out=: [1,4,9]
Compared with this suggar the list comprehension [x**2 for x in
[1,2,3]]
is ugly.
py import numarray
py a = numarray.array([1, 2, 3])
py a**2
array([1, 4, 9])
STeVe
--
http://mail.python.org/mailman/listinfo/python-list


Re: Simple account program

2005-03-18 Thread Peter Maas
wes weston schrieb:
Why have transactions not associated with accounts?
 All transactions are related to an account; have
 a self.TransActList in Account.
You have amount in both Withdrawl and Deposit
 both derived from Transaction. If Transactions always
 have an amount, why not put amount in the transactions
 class?
That's a good idea. I don't know if Igorati is just doing an
exercise or has the ambition to create a usable application.
In the latter case it would be a good idea to learn the basics
of double accounting (DA). In DA each transaction is associated
with 2 accounts.
DA tries to avoid signed numbers, but uses the terms debit and
credit instead. debit and credit aren't simply synonyms for minus
and plus because there are two types of accounts: assets and
liabilities. Liabilities have a minus sign built in.
For me this is crazy and I used to confuse things until I found
three rules to memorize this:
1. Positive flow of money is always recorded on the debit side.
2. Assets account balances are computed without sign change.
3. Liability account balances are computed with sign change.
In matrix form:
   debit  credit
assets accont+  -
liabil account   -  +
Example: You empty your piggybank to pay your debts:
Amount is recorded on the debit side of debts and on the credit
side of piggybank (rule 1). Both balances are lower, because credit
is negative for assets (rule 2) and debit is negative for liabilities
(rule 3).
So the easiest way to handle this programmatically is to have two
lists, accounts and transactions. Each transaction generates a new
entry in the list of transactions:
translist.append(trans(credit_account, debit_account, amount))
where amount is always positive. The account class has a balance
method:
class account:
def balance(self, translist):
bal = 0
for e in translist:
if self == e.debit_account:
bal += e.amount
if self == e.credit_account:
bal -= e.amount
if self.acctype == liability:
bal = -bal
return bal
--
---
Peter Maas,  M+R Infosysteme,  D-52070 Aachen,  Tel +49-241-93878-0
E-mail 'cGV0ZXIubWFhc0BtcGx1c3IuZGU=\n'.decode('base64')
---
--
http://mail.python.org/mailman/listinfo/python-list


Re: How to create datetime object from DbiDate (win32.odbc)?

2005-03-18 Thread Frank Millman

Robert Brewer wrote:
 Frank Millman wrote:
 
  First prize would be to have a datetime constructor that takes a
  DbiDate object as input, in the same way that mx does, but this
does
  not seem to exist.

 Try:

 datetime.datetime.utcfromtimestamp(int(value))
 
Thanks, Robert, this is exactly what I am looking for.

Frank

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


Re: how to handle repetitive regexp match checks

2005-03-18 Thread GiddyJP
Matt Wette wrote:
Over the last few years I have converted from Perl and Scheme to
Python.  There one task that I do often that is really slick in Perl
but escapes me in Python.  I read in a text line from a file and check
it against several regular expressions and do something once I find a 
match.
For example, in perl ...

if ($line =~ /struct {/) {
  do something
} elsif ($line =~ /typedef struct {/) {
  do something else
} elsif ($line =~ /something else/) {
} ...
I am having difficulty doing this cleanly in python.  Can anyone help?
I had a similar situation along with the requirement that the text to be 
scanned was being read in chunks.  After looking at the Python re module 
and various other regex packages, I eventually wrote my own multiple 
pattern scanning matcher.

However, since then I've discovered that the sre Python module has a 
Scanner class that does something similar.

Anyway, you can see my code at:
http://users.cs.cf.ac.uk/J.P.Giddy/python/Trespass/2.0.0/
Using it, your code could look like:
# do this once
import Trespass
pattern = Trespass.Pattern()
pattern.addRegExp(r'struct {', 1)
pattern.addRegExp(r'typedef struct {', 2)
pattern.addRegExp(r'something else', 3)
# do this for each line
match = pattern.match(line)
if match:
value = match.value()
if value == 1:
# struct
do something
elif value == 2:
# typedef
do something
elif value == 3:
# something else
do something
else:
error
--
http://mail.python.org/mailman/listinfo/python-list


Re: syntax incorrect with regex

2005-03-18 Thread Diez B. Roggisch
sam wrote:

 Hi,
 
 What is the correct syntax of declaring a regex syntax in Python 2.3?
 I got the following error:
 
 # python2.3 test.py
File test.py, line 10
  macros_parser = re.compile (r (\s+)=\(\s+)\$ ,re.VERBOS)
  ^
 SyntaxError: invalid syntax

No problem here. Is your indentation correct?


-- 
Regards,

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


Re: list of unique non-subset sets

2005-03-18 Thread bearophileHUGS
Looking at all the hyperedges in the connected component is a big
waste... You can look at just the hyperedges that share one or more
nodes.
(Nodes are the original letters contained in the sets, and they must be
hashable).

If nodes aren't integers in [0, len(l)) then you can use this simpler
code:

. l = [set(['a','b','c']), set(['a','c']), set(['a','d','e','1']),
.  set(['r','k','l']), set(['b','e','1']), set(['a','c']) ]
. from graph import Graph
. # http://www.fantascienza.net/animalia/graph.zip
. # you can something similar with Boost
.
. debug = True
. g = Graph()
. for n1,s in enumerate(l):
. g.addNode(n1, nodeData=1)
. for n2 in s:
. g.addBiArc(n1, n2)
. if debug: print g # 
.
. result = []
. for i,s in enumerate(l):
. ss = set()
. for n1 in s:
. ss.update(g.xoutNodes(n1))
. ss.remove(i)
. if debug: print i, ss # 
.
. for sj in ss:
. if s = l[sj]:
. break
. else:
. result.append(s)
. print result



If nodes are hashable, but they can cointain integers in [0, len(l)),
then you can use this other code with nodeID translations (in a
different graph implementation, like Gato one, such translations can be
automatic):


. l = [set(['a','b','c']), set(['a','c']), set(['a','d','e','1']),
.  set(['r','k','l']), set(['b','e','1']), set(['a','c']) ]
. from graph import Graph
.
. debug = True
. nodes = set()
. for s in l:
. nodes.update(s)
. lenl = len(l)
. nodes = dict( (i+lenl, n) for i,n in enumerate(nodes) )
. if debug: print nodes:, nodes # 
. nodesid = dict( (n,i) for i,n in nodes.iteritems() )
. l2 = [ set( nodesid[n] for n in s ) for s in l ]
. if debug: print l2:, l2 # 
.
. g = Graph()
. for n1,s in enumerate(l2):
. g.addNode(n1)
. for n2 in s:
. g.addBiArc(n1, n2)
. if debug: print g # 
.
. result = []
. for i,s in enumerate(l2):
. ss = set()
. for n1 in s:
. ss.update(g.xoutNodes(n1))
. ss.remove(i)
. if debug: print i, ss:, i, ss # 
.
. for sj in ss:
. if s = l2[sj]:
. break
. else:
. result.append(s)
. if debug: print result:, result # 
. result2 = [ set( nodes[n] for n in s ) for s in result ]
. print result2

If the hyperedges define a sparse hypergraph, then this code can be
quite faster than the original quadratic one (if len(l) is big enough).

Bye,
Bearophile

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


Re: Is Python like VB?

2005-03-18 Thread Jim Smith
Mike Cox wrote:
Would Python meet our requirements? I need to make lots of
GUI applications (message boxes, forms, etc.) and do the underlying business
logic too.
Python is my favorite language and I recommend that you experiment with 
it.  However, if you want the quickest replacement for VB I would look 
at REALbasic.  It has a nice IDE with an integrated GUI designer and it 
is generally easy for a VBer to learn.  You can even convert existing VB 
apps as well.  It won a Jolt Productivity award this year (along with 
Python 2.4).

http://www.realsoftware.com/index.php
--
http://mail.python.org/mailman/listinfo/python-list


Re: create/access dynamic growth list

2005-03-18 Thread Larry Bates
sam wrote:
 Hi,
 
 I have a configuration file need to be processed (read/write) by python.
 Currently I the following method can only read and store data that
 python read a line from a configuraiton file:
  def _parse (self):
 # parse message
 m = self.FWShow_Command.match (conf_data)
 if (m == None):
 raise FW_Command.Error (corrupt macro definition)
 
 # store generic data
 macro = {}
 macro[key] = m.group (1)
 macro[value] = m.group (2)
 
 return (conf_data, macro)
 
 Since there are unknown number of lines in a configuration file, I want
 to store the array of macro in a list.
 How can I do that in Python?
 
 Thanks
 Sam.
Pretty sketchy description, but I'll take a shot.

fp=open(conf_data, 'r')
macro_lines=fp.readlines()
fp.close()

After this macro_lines will be a list with one line per element
such that macro_list[0] is the first line, macro_list[1] the
second, etc.

Larry Bates

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


Re: how to handle repetitive regexp match checks

2005-03-18 Thread Paul McGuire
Matt -

Pyparsing may be of interest to you.  One of its core features is the
ability to associate an action method with a parsing pattern.  During
parsing, the action is called with the original source string, the
location within the string of the match, and the matched tokens.

Your code would look something like :

lbrace = Literal('{')
typedef = Literal('typedef')
struct = Literal('struct')
rx1 = struct + lbrace
rx2 = typedef + struct + lbrace
rx3 = Literal('something') + Literal('else')

def rx1Action(strg, loc, tokens):
... put stuff to do here...

rx1.setParseAction( rx1Action )
rx2.setParseAction( rx2Action )
rx3.setParseAction( rx3Action )

# read code into Python string variable 'code'
patterns = (rx1 | rx2 | rx3)
patterns.scanString( code )

(I've broken up some of your literals, which allows for intervening
variable whitespace - that is Literal('struct') +Literal('{') will
accommodate one, two, or more blanks (even line breaks) between the
'struct' and the '{'.)

Get pyparsing at http://pyparsing.sourceforge.net.

-- Paul

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


Re: Is Python like VB?

2005-03-18 Thread scattered

Tim Roberts wrote:
 Mike Cox [EMAIL PROTECTED] wrote:
 
 As you may or may not know, Microsoft is discontinuing Visual Basic
in favor
 of VB.NET and that means I need to find a new easy programming
language.  I
 heard that Python is an interpreted language similar to VB.

 This statement is a little bit silly.  VB.NET is an interpreted
language
 which is practically indistinguishable from the old VB.  Why on earth
would
 you choose to reimplement your software in a different language,
rather
 than just do the simple version upgrade?


It is a bit OT for a python group, but calling VB.NET virtually
indistinguishable from VB isn't fair to either language. The
differences between them are so significant that many VB developers
have taken to calling VB.Net visual fred instead (
http://vb.mvps.org/vfred/breaks.asp ). VB.Net is both more powerful and
less convienent than VB.

You are right that VBA isn't being discontinued yet. My own interest in
learning python is to find a replacement for Excel VBA. I'm a
mathematician who likes to throw quick programs together for things
like statistical simulations. I liked the ability to get functioning
code quickly in VBA, together with the ability to easily generate
graphs of the results, etc., but I finally got tired of the slow speed
and verbose syntax. I'm hoping that Python (as packaged by Enthought
together with various numerical and graphing modules) will be an
appropriate replacement.

-scattered

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


Re: GIL release

2005-03-18 Thread Pierre Barbier de Reuille
Do you mean in Python or in C ?
In C this is described in details in the documentation. In Python, I 
don't think there is a way ! If you want to do so you'll want to use a 
micro sleep ...

Pierre
Alastair Basden a écrit :
Hi,
Does anyone know whether there is a way for a python thread to release 
the global interpreter lock, and let all other threads have a chance at 
running before re-acquiring it?  Does the thread scheduling follow a 
round-robin method?

Thanks,
agb.
--
http://mail.python.org/mailman/listinfo/python-list


Re: fastest postgresql module

2005-03-18 Thread Frank Miles
In article [EMAIL PROTECTED],
Timothy Smith  [EMAIL PROTECTED] wrote:
Leif B. Kristensen wrote:

Timothy Smith skrev:

  

has anyone got some hard numbers on which pg access module is the
fastest, i currently use pypgsql, but i can't help but feel it's a
little slow.
3 seconds to connect, send one query, get th return data.
i'm on a adsl 1.5mbit/256kbit link, the server is on a 10/10mbit, and
i have a ping of 245ms average.
maybe pypgsql does too much backand forth, i don't know.



You might want to try psycopg, it's claimed to be optimized for speed.
  

my only issue with psycopg, is last time i looked they had no win32 port?

psycopg is available for win32 (though the development version might not be)
Try:
http://www.stickpeople.com/projects/python/psycopg/

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


Re: Database connection caching

2005-03-18 Thread Swaroop C H
On 18 Mar 2005 04:52:03 -0800, [EMAIL PROTECTED]
[EMAIL PROTECTED] wrote:
 Hi all,
 
 is there an alternative way of:
 
 - create a connection object
 - open the connection
 - close the connection
 
 every time one has to run a query.

Why not use cursor objects with a single connection object?

You can have any number of cursor objects and can run with a single
connection object

A good introduction is at http://www.amk.ca/python/writing/DB-API.html

Regards,
-- 
Swaroop C H
Blog: http://www.swaroopch.info
Book: http://www.byteofpython.info
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: MySQL problem

2005-03-18 Thread wes weston
Dennis Lee Bieber wrote:
On Thu, 17 Mar 2005 16:45:57 GMT, wes weston [EMAIL PROTECTED] declaimed
the following in comp.lang.python:

str = INSERT INTO produkt1 (MyNumber) VALUES(%d) % (MyNumber)
cursor.execute(str)
Think you meant MyValue for the second item... However...
Try neither, the recommended method is to let the execute() do
the formatting... That way /it/ can apply the needed quoting of
arguments based upon the type of the data.
cursor.execute(insert into produkt1 (MyNumber) values (%d), (MyValue))
Dennis,
   Do you know if this has some efficiency advantage
or is it just an agreed upon custom.
wes
--
http://mail.python.org/mailman/listinfo/python-list


Re: Is Python like VB?

2005-03-18 Thread Swaroop C H
On Fri, 18 Mar 2005 07:40:54 -0700, at lycos.com@bag.python.org Jim
Smith jbzsmith wrote:
 Mike Cox wrote:
  Would Python meet our requirements? I need to make lots of
  GUI applications (message boxes, forms, etc.) and do the underlying business
  logic too.
 
 Python is my favorite language and I recommend that you experiment with
 it.  However, if you want the quickest replacement for VB I would look
 at REALbasic.  It has a nice IDE with an integrated GUI designer and it
 is generally easy for a VBer to learn.  You can even convert existing VB
 apps as well.  It won a Jolt Productivity award this year (along with
 Python 2.4).

I have heard Gambas to be a very good option too:
http://gambas.sourceforge.net/

-- 
Swaroop C H
Blog: http://www.swaroopch.info
Book: http://www.byteofpython.info
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: PyGoogle featured on Google Code

2005-03-18 Thread Skip Montanaro

Michael I took a look at goopy and I found that much of the stuff in it
Michael could be done more efficiently with an itertools recipe. But
Michael then again, it also had sum() and maximum() functions so it
Michael must have been written for an older version of Python. 

I thought I saw that it was supposed to work with Python 2.1.

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


Re: syntax incorrect with regex

2005-03-18 Thread Fredrik Lundh
sam wrote:

 What is the correct syntax of declaring a regex syntax in Python 2.3?
 I got the following error:

 # python2.3 test.py
   File test.py, line 10
 macros_parser = re.compile (r (\s+)=\(\s+)\$ ,re.VERBOS)
 ^
 SyntaxError: invalid syntax

compare and contrast:

 macros_parser = re.compile (r (\s+)=\(\s+)\$ ,re.VERBOSE)
(no error)

 macros_parser = re.compile (r (\s+)=\(\s+)\$ ,re.VERBOSE)
  File stdin, line 1
macros_parser = re.compile (r (\s+)=\(\s+)\$ ,re.VERBOSE)
^
SyntaxError: invalid syntax

/F 



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


Re: Database connection caching

2005-03-18 Thread Skip Montanaro
Lorenzo is there an alternative way of:

Lorenzo - create a connection object
Lorenzo - open the connection
Lorenzo - close the connection

Lorenzo every time one has to run a query.

Sure, create a Queue.Queue object and stuff a number of connections into
it.  When you want a connection call the queue's .get() method.  When you're
done with it .put() it back.  This has the other nice feature that a program
with a large number of threads can't overwhelm your database.

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


Re: Database connection caching

2005-03-18 Thread Simon Brunning
On 18 Mar 2005 04:52:03 -0800, [EMAIL PROTECTED]
[EMAIL PROTECTED] wrote:
 is there an alternative way of:
 
 - create a connection object
 - open the connection
 - close the connection
 
 every time one has to run a query.

It's actually morte like:

create connection
create cursor
execute SQL
process cursor
close cursor
close connection

The bit that you can avoid it the creation of the connection - that's
an intensive process. If your system is single threaded, or if it's a
very small app, you can just create a single open connection and keep
using that. I usually find that I need a pool of open connections,
though.

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


Re: syntax incorrect with regex

2005-03-18 Thread Swaroop C H
On Fri, 18 Mar 2005 21:57:15 +0800, sam [EMAIL PROTECTED] wrote:
 Hi,
 
 What is the correct syntax of declaring a regex syntax in Python 2.3?
 I got the following error:
 
 # python2.3 test.py
File test.py, line 10
  macros_parser = re.compile (r (\s+)=\(\s+)\$ ,re.VERBOS)
  ^
 SyntaxError: invalid syntax

Please check the indentation you have used.
Also, it should be re.VERBOSE (note the ending 'e')

Regards,
-- 
Swaroop C H
Blog: http://www.swaroopch.info
Book: http://www.byteofpython.info
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: MySQL problem

2005-03-18 Thread Kent Johnson
wes weston wrote:
Dennis Lee Bieber wrote:
Try neither, the recommended method is to let the execute() do
the formatting... That way /it/ can apply the needed quoting of
arguments based upon the type of the data.
cursor.execute(insert into produkt1 (MyNumber) values (%d), (MyValue))
Dennis,
   Do you know if this has some efficiency advantage
or is it just an agreed upon custom.
It may have efficiency advantages if the DB caches requests. But the main 
advantages are that
- it correctly escapes special chars such as 
- consequently it also protects against SQL injection attacks where MyValue 
might contain malicious SQL.
Kent
--
http://mail.python.org/mailman/listinfo/python-list


Re: Is Python like VB?

2005-03-18 Thread Tom Willis
On 18 Mar 2005 07:22:05 -0800, scattered [EMAIL PROTECTED] wrote:
 
 Tim Roberts wrote:
  Mike Cox [EMAIL PROTECTED] wrote:
  
  As you may or may not know, Microsoft is discontinuing Visual Basic
 in favor
  of VB.NET and that means I need to find a new easy programming
 language.  I
  heard that Python is an interpreted language similar to VB.
 
  This statement is a little bit silly.  VB.NET is an interpreted
 language
  which is practically indistinguishable from the old VB.  Why on earth
 would
  you choose to reimplement your software in a different language,
 rather
  than just do the simple version upgrade?
 
 
 It is a bit OT for a python group, but calling VB.NET virtually
 indistinguishable from VB isn't fair to either language. The
 differences between them are so significant that many VB developers
 have taken to calling VB.Net visual fred instead (
 http://vb.mvps.org/vfred/breaks.asp ). VB.Net is both more powerful and
 less convienent than VB.
 
 You are right that VBA isn't being discontinued yet. My own interest in
 learning python is to find a replacement for Excel VBA. I'm a
 mathematician who likes to throw quick programs together for things
 like statistical simulations. I liked the ability to get functioning
 code quickly in VBA, together with the ability to easily generate
 graphs of the results, etc., but I finally got tired of the slow speed
 and verbose syntax. I'm hoping that Python (as packaged by Enthought
 together with various numerical and graphing modules) will be an
 appropriate replacement.
 
 -scattered
 
 --
 http://mail.python.org/mailman/listinfo/python-list
 


I agree, VB.net is enough of a difference that I've found a lot of
developers who only develop in VB6 get really tripped up in it for a
while. Not to mention the framework you have access to is huge,
leanring your way around that is a chore in itself. It takes a
significant amount of effort to feel as productive in it as vb6. 
Especially if you've never been exposed to huge frameworks like VCL or
Java or the .net framework.

To imply that the transition from vb6 to vb.net is anything less than
a significant effort is misleading to say the least.

My .02 as a recovering vb6 com/dcom/asp programmer stuck on more than
a few vb.net projects.

-- 
Thomas G. Willis
http://paperbackmusic.net
-- 
http://mail.python.org/mailman/listinfo/python-list


Import mechanism to support multiple Python versions

2005-03-18 Thread Nicolas Fleury
Hi,
	I'm trying to support two Python versions at the same time and I'm 
trying to find effective mechanisms to support modules compiled in C++ 
transparently.

All my code in under a single package.  Is it possible to override the 
import mechanism only for modules under that package and sub-packages so 
that?:

import cppmymodule
would be equivalent to:
if sys.version == 2.4:
import cppmymodule24 as cppmymodule
elif sys.version == 2.3:
import cppmymodule23 as cppmymodule
for all modules under the package and all modules with names beginning 
with cpp (or another way to identify them).

I have also third party packages.  Is it possible to make a package 
point to another folder?  For example:

psyco23/...
psyco24/...
psyco/__init__.py  = points to psyco23 or psyco24 depending on Python 
version used.

Note that I cannot use .pth files or symbolic links, since I would want 
the exact same code hierarchy to work with both Python 2.3 and 2.4.

Any help appreciated.
Thx and regards,
Nicolas
--
http://mail.python.org/mailman/listinfo/python-list


Re: Python becoming less Lisp-like

2005-03-18 Thread Jeff Shannon
Antoon Pardon wrote:
Op 2005-03-16, Jeff Shannon schreef [EMAIL PROTECTED]:
Bruno Desthuilliers wrote:
- if x is a class attribute of class A and a is an instance of A, 
a.x=anyvalue create a new instance attribute x instead of modifying A.x
This is very consistent with the way that binding a name in any scope 
will shadow any bindings of that name in higher scopes.  It is the 
same principle by which one is able to use the same name for a 
function-local variable that is used for a global variable, without 
destroying that global variable.  [...]
Not entirely. The equivallent is imposible in function scope.
If function scope would work exactly equivallent as the
above the following should work 

a = 42
def f():
  a = a + 1
  print a
print a
And the result should be:
43
42
I'd still say that the name binding rules are very consistent.  The 
name lookup rules are a little different (as they *should* be for 
class/instance attributes), and that's why there's a different net 
effect (UnboundLocalError) as shown in your example.  I'd say, 
however, that if there's a special case here it's with the 
function-local variables, not the class/instance attributes.  It's the 
optimizations to the function-local namespace which prevent 
transparent re-binding of global names.  And given that the 
function-local namespace is by far the most heavily used, and the 
relative utility (and wisdom) of using globals in this way, this is a 
case where the benefit of the special case is well worth the cost of 
its slight inconsistency.

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


Re: Simple account program

2005-03-18 Thread Igorati
Thank you all for your help. I am sorry that I am struggling with
programming. I still am attempting to get it. Yes, I do need to stop
posting homework assignments, perhaps I will learn to write code through
more studying. I have gone through some toutorials if that makes you feel
any better. I do have a desire to learn. Thank you again. I will go back
and attempt to impliment this.

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


[ANNOUNCE] Twenty-third release of PythonCAD now available

2005-03-18 Thread Art Haas
I'm pleased to announce the twenty-third development release of PythonCAD,
a CAD package for open-source software users. As the name implies,
PythonCAD is written entirely in Python. The goal of this project is
to create a fully scriptable drafting program that will match and eventually
exceed features found in commercial CAD software. PythonCAD is released
under the GNU Public License (GPL).

PythonCAD requires Python 2.2 or newer. The interface is GTK 2.0
based, and uses the PyGTK module for interfacing to GTK. The design of
PythonCAD is built around the idea of separating the interface
from the back end as much as possible. By doing this, it is hoped
that both GNOME and KDE interfaces can be added to PythonCAD through
usage of the appropriate Python module. Addition of other PythonCAD 
interfaces will depend on the availability of a Python module for that
particular interface and developer interest and action.

The twenty-third release contains a several bug fixes, the largest of
which is the correct restoration of dimension string text properties when
the deletion of a dimension is undone. Another fix included in this release
is the removal of some deprecated constants flagged by the 2.6 PyGTK
release when they are encountered. This release also features the
beginnings of the scripting enhancements planned for PythonCAD. The
evaluation of user-entered expressions is now more powerful by utilizing
Python's exec keyword and invoking the eval() command with an argument
storing variables to be utilized during expression evaluation. More
enhancements and improvements in expression evaluation and overall
scriptability will appear in future releases.

A mailing list for the development and use of PythonCAD is available.
Visit the following page for information about subscribing and viewing
the mailing list archive:

http://mail.python.org/mailman/listinfo/pythoncad

Visit the PythonCAD web site for more information about what PythonCAD
does and aims to be:

http://www.pythoncad.org/

Come and join me in developing PythonCAD into a world class drafting
program!

Art Haas
-- 
Man once surrendering his reason, has no remaining guard against absurdities
the most monstrous, and like a ship without rudder, is the sport of every wind.

-Thomas Jefferson to James Smith, 1822
-- 
http://mail.python.org/mailman/listinfo/python-list


OSX / Python 2.3 errortruncated or malformed object ...

2005-03-18 Thread Ian A. York
MacOS 10.3.8, Python 2.3. I installed both Tkinter and appscript 
yesterday.  Now when I open python (or pythonw) in the Terminal I get the 
following:

Python 2.3 (#1, Sep 13 2003, 00:49:11) 
[GCC 3.3 20030304 (Apple Computer, Inc. build 1495)] on darwin
Type help, copyright, credits or license for more information.
/System/Library/Frameworks/Python.framework/Versions/2.3/Resources/Python.app/Contents/MacOS/Python:
 
object: 
/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/site-packages/readline.so
 
truncated or malformed object (LC_SEGMENT command 2 fileoff field plus 
filesize field extends past the end of the file)


Everything I've actually tried with Python still works, including both 
Tkinter and appscript scripts; however, I obviously don't like seeing 
errors reported, especially ones I have no clue about.

Does anyone know what this is, and/or how to fix it?

Ian 
-- 
Ian York   ([EMAIL PROTECTED])  http://www.panix.com/~iayork/
-but as he was a York, I am rather inclined to suppose him a
 very respectable Man. -Jane Austen, The History of England
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: adding a path module to stdlib

2005-03-18 Thread Michael Hoffman
Alia Khouri wrote:
This may have been discussed ad nauseaum before, but every time I use
os.path manipulations I miss something like Jason Orrendorf's path.py
being in the standard library.
[http://www.jorendorff.com/articles/python/path/]
That is a great library. I wrote a distutils setup.py for it to make it
easier to deploy on multiple systems I use. Installing path.py is so
much easier than using os.path.
--
Michael Hoffman
--
http://mail.python.org/mailman/listinfo/python-list


Re: how to handle repetitive regexp match checks

2005-03-18 Thread Jeff Shannon
Matt Wette wrote:
Over the last few years I have converted from Perl and Scheme to
Python.  There one task that I do often that is really slick in Perl
but escapes me in Python.  I read in a text line from a file and check
it against several regular expressions and do something once I find a 
match.
For example, in perl ...

if ($line =~ /struct {/) {
  do something
} elsif ($line =~ /typedef struct {/) {
  do something else
} elsif ($line =~ /something else/) {
} ...
I am having difficulty doing this cleanly in python.  Can anyone help?
rx1 = re.compile(r'struct {')
rx2 = re.compile(r'typedef struct {')
rx3 = re.compile(r'something else')
m = rx1.match(line)
if m:
  do something
else:
  m = rx2.match(line)
  if m:
do something
  else:
m = rx3.match(line)
if m:
  do something
else:
  error
If you don't need the match object as part of do something, you 
could do a fairly literal translation of the Perl:

if rx1.match(line):
do something
elif rx2.match(line):
do something else
elif rx3.match(line):
do other thing
else:
raise ValueError(...)
Alternatively, if each of the do something phrases can be easily 
reduced to a function call, then you could do something like:

def do_something(line, match): ...
def do_something_else(line, match): ...
def do_other_thing(line, match): ...
table = [ (re.compile(r'struct {'), do_something),
  (re.compile(r'typedef struct {'), do_something_else),
  (re.compile(r'something else'), do_other_thing) ]
for pattern, func in table:
m = pattern.match(line)
if m:
func(line, m)
break
else:
raise ValueError(...)
The for/else pattern may look a bit odd, but the key feature here is 
that the else clause only runs if the for loop terminates normally -- 
if you break out of the loop, the else does *not* run.

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


Re: Splitting with Regular Expressions

2005-03-18 Thread qwweeeit
I thank you for your help.
The more flexible solution (Paul McGuire) is interesting but i don't
need such a flexibility. In fact I am implementing a cross-reference
tool  and working on python sources, I don't need the '.' as separator
in order to capture variables and commands.
I thank nevertheless Paul for the advice on using pyparsing.

The other two solutions (Thomas Guettler and Fredrik Lundh) are quite
similar except for the use of raw. I can use both.
-- 
http://mail.python.org/mailman/listinfo/python-list


How to I restart an interactive session?

2005-03-18 Thread markscottwright
I'm trying to cobble together an IDLE equivalent using pyshell and VIM
(My idea is just to pipe exec file commands from VIM to pyshell via a
socket or something).  The one feature that IDLE has that I would
really like but can't seem to duplicate is the Restart Shell command.
 Delving through the IDLE code, it looks like IDLE kills and restarts
its InteractiveInterpreter-derived class to do this.  Is this really
necessary?  If I just take __main__.__dict__ and strip out everything
since a start point, haven't I restored the interpreter to a virgin
state?

(Of course, assuming that there are no threads running, no
c-code-invoked junk lying around, etc).

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


Re: Simple XML-to-Python conversion

2005-03-18 Thread [EMAIL PROTECTED]
Since I've exhausted every option except for Amara, I've decided to
give it a try.  However, this will only work if I can compile Amara and
4suite along with my application.  I doubt 4suite will be able to be
compiled, but I'll try it anyway.

If I weren't set on using XML (I know, not every application requires
it and it's abused), I would probably go with a simpler format like an
INI file or YAML.  The requirement that leads me to use XML for a
simple config file is that the rest of this project already utilizes
XML and another developer must integrate his NetBeans GUI with my app
and config file.  Not to mention that this must be across Linux and
Windows platforms.  To make this easier on everyone else, I'm using a
simple XML schema that I know everyone can write to.  As far as I know,
YAML isn't easily written to from a Java class and an INI file isn't
very popular on the Linux side.

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


Re: xmlproc maintainer?

2005-03-18 Thread Martin v. Löwis
Alban Hertroys wrote:
We recently (about a week ago) sent a patch to the maintainer of 
xmlproc, but we didn't receive a reply yet. A look at the site reveals 
that the last update was somewhere in 2000.

Does anybody know who the current maintainer is (if that changed), or 
what the status of xmlproc is? We kind of depend on it...
xmlproc is maintained as part of PyXML now; please sent the patch to
the patches tracker at sf.net/projects/pyxml.
That said, PyXML did not have a release on its own for quite some time,
either; mainly due to lack of user interest.
Regards,
Martin
--
http://mail.python.org/mailman/listinfo/python-list


Re: Import mechanism to support multiple Python versions

2005-03-18 Thread Nicolas Fleury
Nicolas Fleury wrote:
import cppmymodule
would be equivalent to:
if sys.version == 2.4:
import cppmymodule24 as cppmymodule
elif sys.version == 2.3:
import cppmymodule23 as cppmymodule
for all modules under the package and all modules with names beginning 
with cpp (or another way to identify them).
Since all my imports are absolute, my code looks more like:
import root.subpackage.cppmymodule
So I guess, I can add this in root/__init__.py and everything would be fine:
def myimport(name, globals=None, locals=None, fromlist=None,
 __import__=__import__):
names = name.split('.')
if names[0] == 'root' and names[-1][0:3] == 'cpp':
name += '%s%s' % sys.version_info[0:2]
return __import__(name, globals, locals, fromlist)
__builtins__['__import__'] = myimport
It seems to work, is that right?
Thx and regards,
Nicolas
--
http://mail.python.org/mailman/listinfo/python-list


Re: Database connection caching

2005-03-18 Thread Istvan Albert
[EMAIL PROTECTED] wrote:
Hi all,
is there an alternative way of:
- create a connection object
- open the connection
- close the connection
psycopg, a Postgresql database adapter does connection pooling
automatically
http://initd.org/projects/psycopg1
Most Zope database adapters also have implicit
connection pooling.
Istvan.
--
http://mail.python.org/mailman/listinfo/python-list


Re: Windows question from Mac guy

2005-03-18 Thread Charles Hartman
On Mar 18, 2005, at 1:36 PM, [EMAIL PROTECTED] wrote:
Here is code that I use, it works both for the script and the exe:
Though that does *not* work on Mac, it *does* work on Windows. Bless 
you sir! I just put a sys.platform condition in and do it your elegant 
way for 'win32' and the simple way for 'darwin'. Many thanks!

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


Re: Python becoming less Lisp-like

2005-03-18 Thread Bengt Richter
On Fri, 18 Mar 2005 09:16:42 -0800, Jeff Shannon [EMAIL PROTECTED] wrote:

Antoon Pardon wrote:
 Op 2005-03-16, Jeff Shannon schreef [EMAIL PROTECTED]:
 
Bruno Desthuilliers wrote:

- if x is a class attribute of class A and a is an instance of A, 
a.x=anyvalue create a new instance attribute x instead of modifying A.x

This is very consistent with the way that binding a name in any scope 
will shadow any bindings of that name in higher scopes.  It is the 
same principle by which one is able to use the same name for a 
function-local variable that is used for a global variable, without 
destroying that global variable.  [...]
 
 Not entirely. The equivallent is imposible in function scope.
 If function scope would work exactly equivallent as the
 above the following should work 
 
 a = 42
 def f():
   a = a + 1
   print a
   f()   # ;-)
 print a
 
 And the result should be:
 
 43
 42

IIRC, in some past version that used to be the way it worked (if you don't 
forget to call f() ;-)
I think it is logical. I.e., the right hand side of a = a + 1
is logically evaluated first, so the status at that time should IMO
determine the meaning of a -- i.e., look for it in an outer scope.
Next comes the local assignment of a which should create a local name
binding, but the code for determining the assigned value should IMO
be the code for the a + 1 with no local binding of a yet existing.

I don't know how much code would break to go back to that, but maybe
not so much, since it's not legal now:

  a = 42
  def f():
 ... a = a +1
 ... print a
 ...
  f()
 Traceback (most recent call last):
   File stdin, line 1, in ?
   File stdin, line 2, in f
 UnboundLocalError: local variable 'a' referenced before assignment
  print a
 42

BTW, I would like a re-assign or find-and-rebind operation spelled := which 
would
make x := 123 mean look for x as if to read its value in a right hand side 
expression,
(except do not look into __builtins__) and wherever found, rebind to 123 -- and 
if not found,
raise an exception.

I think var := 'something' would be a useful substitute for the idiom of
var[0] = 'something' and be unambiguous.

:= as an operator could combine like op= if desired, so we could write
var +:= some.long.expression[that].you('do')**not.want.to.type.twice
instead of
_ = some.long.expression[that].you('do')**not.want.to.type.twice
var +:= _  # meaning var := var + _
or such.


I'd still say that the name binding rules are very consistent.  The 
They are consistent, but I have to say the function-body full lookahead to 
determine
local vs outer (not to mention normal function vs generator) jars my 
sensibilities.

name lookup rules are a little different (as they *should* be for 
class/instance attributes), and that's why there's a different net 
effect (UnboundLocalError) as shown in your example.  I'd say, 
however, that if there's a special case here it's with the 
function-local variables, not the class/instance attributes.  It's the 
optimizations to the function-local namespace which prevent 
transparent re-binding of global names.  And given that the 
function-local namespace is by far the most heavily used, and the 
relative utility (and wisdom) of using globals in this way, this is a 
case where the benefit of the special case is well worth the cost of 
its slight inconsistency.
The optimization argument goes away with x := something I think, since
the x search can be limited to looking in the lexical environment
exactly like looking for read-only outer scope names now, just with
different consequences for finding or not finding.

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


Re: How to I restart an interactive session?

2005-03-18 Thread Diez B. Roggisch
markscottwright wrote:

 I'm trying to cobble together an IDLE equivalent using pyshell and VIM
 (My idea is just to pipe exec file commands from VIM to pyshell via a
 socket or something).  The one feature that IDLE has that I would
 really like but can't seem to duplicate is the Restart Shell command.
  Delving through the IDLE code, it looks like IDLE kills and restarts
 its InteractiveInterpreter-derived class to do this.  Is this really
 necessary?  If I just take __main__.__dict__ and strip out everything
 since a start point, haven't I restored the interpreter to a virgin
 state?

You can't unload modules, or at least reload is not always working properly.
So - you'd gotta go the road IDLE has gone before I assume.
-- 
Regards,

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


Re: Import mechanism to support multiple Python versions

2005-03-18 Thread Serge Orlov
Nicolas Fleury wrote:
 Hi,
   I'm trying to support two Python versions at the same time and I'm
 trying to find effective mechanisms to support modules compiled in
 C++ transparently.

 All my code in under a single package.  Is it possible to override
 the import mechanism only for modules under that package and
 sub-packages so that?:

 import cppmymodule

 would be equivalent to:

 if sys.version == 2.4:
  import cppmymodule24 as cppmymodule
 elif sys.version == 2.3:
  import cppmymodule23 as cppmymodule

 for all modules under the package and all modules with names
 beginning with cpp (or another way to identify them).

I used the following approach application-wide:
= The very start of main file ===
resolve_package_dependencies()
import package

def main():
...

# boilerplate at the end of main file
def resolve_package_dependencies():
if sys.version_info[0:2] == (2,5):
import package1
sys.modules[package] = sys.modules[package1]
else:
import package2
sys.modules[package] = sys.modules[package2]

=

I've never needed that for packages like you, but as far as I
remember package specific modules are stored like
package.module so aliasing package45 with package in your
case will look like
sys.modules[__name__+.package] = sys.modules[__name__+.package45]

  Serge.

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


Re: Simple XML-to-Python conversion

2005-03-18 Thread Fredrik Lundh
[EMAIL PROTECTED] wrote:

 Since I've exhausted every option except for Amara, I've decided to
 give it a try.

why didn't xmltramp or elementtree work for your application?  they're used
all over the place, in all sorts of applications, so it would be interesting to 
know
what's so special about your app...

/F 



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


Re: Splitting with Regular Expressions

2005-03-18 Thread Fredrik Lundh
qwweeeit [EMAIL PROTECTED] wrote:

 In fact I am implementing a cross-reference tool  and working on
 python sources, I don't need the '.' as separator in order to capture
 variables and commands.

if you're parsing Python source code, consider using the tokenize module:

http://docs.python.org/lib/module-tokenize.html

if you don't have to support broken source code, the parse module may
be even more useful:

http://docs.python.org/lib/module-parser.html

for simpler cases, the class browser parser may be an even better choice:

http://docs.python.org/lib/module-pyclbr.html

/F 



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


Re: Is Python like VB?

2005-03-18 Thread Steve Horsley
scattered wrote:
You are right that VBA isn't being discontinued yet. My own interest in
learning python is to find a replacement for Excel VBA. I'm a
mathematician who likes to throw quick programs together for things
like statistical simulations. I liked the ability to get functioning
code quickly in VBA, together with the ability to easily generate
graphs of the results, etc., but I finally got tired of the slow speed
and verbose syntax. I'm hoping that Python (as packaged by Enthought
together with various numerical and graphing modules) will be an
appropriate replacement.
Were you aware that OpenOffice.org version 2.0, which is due out soon
(beta is available for download), can have python macros, as well as 
javascript and StarOffice Basic macros?

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


Re: COM connection point

2005-03-18 Thread Aaron Brady
That appears to do just the job!  Much obliged,

-OY

- Original Message - 
From: Stefan Schukat [EMAIL PROTECTED]
To: Oy Politics [EMAIL PROTECTED];
python-list@python.org
Sent: Friday, March 18, 2005 6:05 AM
Subject: RE: COM connection point


 Just use
 
 obj = win32com.client.Dispatch(obj)
 
   Stefan
 
 
  -Original Message-
  From:
[EMAIL PROTECTED]
 
[mailto:[EMAIL PROTECTED]
Behalf Of
  Oy Politics
  Sent: Wednesday, March 16, 2005 11:51 PM
  To: python-list@python.org
  Subject: COM connection point
  
  
  Hello:
  
  I am building a COM client, with the ability to be
called 
  back by events.
  The events can arrive independently from the
server.  The 
  client method is
  called at the right time, so that is working. 
However, one 
  parameter is
  itself a COM object, and I am having trouble with
accessing 
  the properties
  of the parameter object.
  
  Here is the output of what I have currently.
  
  -- Python execute --
  event! PyIDispatch at 0x7fb134 with obj at
0x403404
  event! PyIDispatch at 0x7fbbf4 with obj at
0x403404
  event! PyIDispatch at 0x7a6d24 with obj at
0x403404
  
  etc.  Obj is supposed to be my intended parameter.
 However, 
  when I try to
  access its property, I get the following:
  
  -- Python execute --
  pythoncom error: Python error invoking COM method.
  
  Traceback (most recent call last):
File 
 
C:\PYTHON23\Lib\site-packages\win32com\server\policy.py,
line 283,
  in _Invoke_
  return self._invoke_(dispid, lcid, wFlags,
args)
File 
 
C:\PYTHON23\Lib\site-packages\win32com\server\policy.py,
line 288,
  in _invoke_
  return S_OK, -1, self._invokeex_(dispid, lcid,
wFlags, 
  args, None, None)
File 
 
C:\PYTHON23\Lib\site-packages\win32com\server\policy.py,
line 581,
  in _invokeex_
  return func(*args)
File
E:\otsl\testprojects_folder\pythoncom\pyclihh2.py, 
  line 26, in
  OnMyEvent
  print event!, obj, obj.AProp
  exceptions.AttributeError: 'PyIDispatch' object
has no 
  attribute 'AProp'
  
  QueryInterface with the target IID gives the
following:
  
  exceptions.TypeError: There is no interface object
registered 
  that supports
  this IID
  
  CastTo gives this error:
  
  exceptions.ValueError: This object can not be cast
  
  Thanks a lot,
  -OY
  
  
  
  
  -- 
 
http://mail.python.org/mailman/listinfo/python-list
  
 



__ 
Do you Yahoo!? 
Yahoo! Mail - Easier than ever with enhanced search. Learn more. 
http://info.mail.yahoo.com/mail_250
-- 
http://mail.python.org/mailman/listinfo/python-list


setDocumentLocator in validating parser (xmlproc)

2005-03-18 Thread Cees Wesseling
Hi,

it seems that xmlproc, the default Validating parser, in my setup does
not call back to setDocumentLocator. Is there anyway to get a locator
in my handler?
Below you find an example and its output.

Regards, Cees

# base imports
from xml.sax.handler import ContentHandler
from xml.sax.handler import EntityResolver
import xml.sax
import xml.sax.sax2exts

class BaseHandler(ContentHandler):
def setDocumentLocator(self,locator):
  print setDocumentLocator called
  self.d_locator=locator

def startElement(self, name, attr):
  print startElement, name


open('e.dtd','w').write('!ELEMENT E EMPTY')
open('e.xml','w').write(
?xml version=1.0 encoding=ISO-8859-1?
   !DOCTYPE E SYSTEM e.dtdE/)

vp  = xml.sax.sax2exts.XMLValParserFactory.make_parser()
print vp type,  vp.__class__
vph = BaseHandler()
vp.setContentHandler(vph)
vp.parse(e.xml)

np  = xml.sax.make_parser()
print np type,  np.__class__
nph = BaseHandler()
np.setContentHandler(nph)
np.parse(e.xml)

OUTPUT:
vp type xml.sax.drivers2.drv_xmlproc.XmlprocDriver
startElement E
np type xml.sax.expatreader.ExpatParser
setDocumentLocator called
startElement E
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Is Python like VB?

2005-03-18 Thread Tom Willis
On Fri, 18 Mar 2005 15:45:10 -0500, Tom Willis [EMAIL PROTECTED] wrote:
 On Fri, 18 Mar 2005 20:20:19 +, Steve Horsley [EMAIL PROTECTED] wrote:
  scattered wrote:
 
   You are right that VBA isn't being discontinued yet. My own interest in
   learning python is to find a replacement for Excel VBA. I'm a
   mathematician who likes to throw quick programs together for things
   like statistical simulations. I liked the ability to get functioning
   code quickly in VBA, together with the ability to easily generate
   graphs of the results, etc., but I finally got tired of the slow speed
   and verbose syntax. I'm hoping that Python (as packaged by Enthought
   together with various numerical and graphing modules) will be an
   appropriate replacement.
 
  Were you aware that OpenOffice.org version 2.0, which is due out soon
  (beta is available for download), can have python macros, as well as
  javascript and StarOffice Basic macros?
 
  Steve
  --
  http://mail.python.org/mailman/listinfo/python-list
 
 
 http://udk.openoffice.org/python/scriptingframework/index.html
 
 Damn that's hot! I am tingly :)
 
 --
 Thomas G. Willis
 http://paperbackmusic.net
 
Reply to self...

The API however, smells more like java to me than python. Alas, I will
happily use it for many of my needs.

http://udk.openoffice.org/python/scriptingframework/dynamicDialog.py

Perhaps OppenOffice.org 2.0 could be the postscript - pdf - text
with the correct layout solution I've been hoping could replace a
chain of very troublesome pieces of shareware.


-- 
Thomas G. Willis
http://paperbackmusic.net
-- 
http://mail.python.org/mailman/listinfo/python-list


Dr. Dobb's Python-URL! - weekly Python news and links (Mar 18)

2005-03-18 Thread Cameron Laird
QOTW:  Python's best feature is comp.lang.python. -- Joerg Schuster

I learn something valuable from comp.lang.python every week, and most of
it has nothing to do with Python. -- Richie Hindle


Google writes successful (if suboptimal) applications.  Google
relies on Python:
http://code.google.com

http://groups-beta.google.com/group/comp.lang.python/browse_thread/thread/a95a58db1410aa46/

The Enterprise talks about fancy proprietary stuff, but uses Python:
http://www.infoworld.com/article/04/09/24/39FErrdev_1.html?s=feature
 
PSF is active even to the point that money comes and goes:
http://www.python.org/psf/grants/

http://pythonology.blogspot.com/2005/03/case-for-python-software-foundation.html

'Like Tkinter, except for its appearance?  Try Tile:
http://mfranklin.is-a-geek.org/docs/Tile/index.html   

While GUI toolkit selection involves significant subjective
factors, the PyQt fans at least coherently describe their
preference:
 
http://groups-beta.google.com/group/comp.lang.python/browse_thread/thread/97d9220e7a667ecb/

Wing 2.0.2 ... adds easier-to-use Zope/Plone integration,
extension of the IDE ..., CVS integration, ..., speed 
optimiations, ...
http://wingware.com/pub/wingide/press/2.0.2-release.html

Steven Bethard provides an example of optparse use:

http://groups-beta.google.com/group/comp.lang.python/browse_thread/thread/c79cf10e61656d85/



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

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

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

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

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

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

Brett Cannon continues the marvelous tradition established by 
Andrew Kuchling and Michael Hudson of intelligently summarizing
action on the python-dev mailing list once every other week.
http://www.python.org/dev/summary/

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

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

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

The Python Business Forum further[s] the interests of companies
that base their business on ... Python.
http://www.python-in-business.org

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

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

Kurt B. Kaiser publishes a weekly report on faults and patches.
http://www.google.com/groups?as_usubject=weekly%20python%20patch
   
Cetus collects Python hyperlinks.
http://www.cetus-links.org/oo_python.html

Python FAQTS
http://python.faqts.com/

The Cookbook is a collaborative effort to capture useful and
interesting recipes.
http://aspn.activestate.com/ASPN/Cookbook/Python

Among several Python-oriented RSS/RDF feeds available are
http://www.python.org/channews.rdf
http://bootleg-rss.g-blog.net/pythonware_com_daily.pcgi
http://python.de/backend.php
For more, see
http://www.syndic8.com/feedlist.php?ShowMatch=pythonShowStatus=all
The old Python To-Do List now lives principally in a
SourceForge reincarnation.

Dr. Dobb's Python-URL! - weekly Python news and links (Mar 18)

2005-03-18 Thread Cameron Laird
QOTW:  Python's best feature is comp.lang.python. -- Joerg Schuster

I learn something valuable from comp.lang.python every week, and most of
it has nothing to do with Python. -- Richie Hindle


Google writes successful (if suboptimal) applications.  Google
relies on Python:
http://code.google.com

http://groups-beta.google.com/group/comp.lang.python/browse_thread/thread/a95a58db1410aa46/

The Enterprise talks about fancy proprietary stuff, but uses Python:
http://www.infoworld.com/article/04/09/24/39FErrdev_1.html?s=feature
 
PSF is active even to the point that money comes and goes:
http://www.python.org/psf/grants/

http://pythonology.blogspot.com/2005/03/case-for-python-software-foundation.html

'Like Tkinter, except for its appearance?  Try Tile:
http://mfranklin.is-a-geek.org/docs/Tile/index.html   

While GUI toolkit selection involves significant subjective
factors, the PyQt fans at least coherently describe their
preference:
 
http://groups-beta.google.com/group/comp.lang.python/browse_thread/thread/97d9220e7a667ecb/

Wing 2.0.2 ... adds easier-to-use Zope/Plone integration,
extension of the IDE ..., CVS integration, ..., speed 
optimiations, ...
http://wingware.com/pub/wingide/press/2.0.2-release.html

Steven Bethard provides an example of optparse use:

http://groups-beta.google.com/group/comp.lang.python/browse_thread/thread/c79cf10e61656d85/



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

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

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

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

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

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

Brett Cannon continues the marvelous tradition established by 
Andrew Kuchling and Michael Hudson of intelligently summarizing
action on the python-dev mailing list once every other week.
http://www.python.org/dev/summary/

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

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

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

The Python Business Forum further[s] the interests of companies
that base their business on ... Python.
http://www.python-in-business.org

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

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

Kurt B. Kaiser publishes a weekly report on faults and patches.
http://www.google.com/groups?as_usubject=weekly%20python%20patch
   
Cetus collects Python hyperlinks.
http://www.cetus-links.org/oo_python.html

Python FAQTS
http://python.faqts.com/

The Cookbook is a collaborative effort to capture useful and
interesting recipes.
http://aspn.activestate.com/ASPN/Cookbook/Python

Among several Python-oriented RSS/RDF feeds available are
http://www.python.org/channews.rdf
http://bootleg-rss.g-blog.net/pythonware_com_daily.pcgi
http://python.de/backend.php
For more, see
http://www.syndic8.com/feedlist.php?ShowMatch=pythonShowStatus=all
The old Python To-Do List now lives principally in a
SourceForge reincarnation.

Re: Is Python like VB?

2005-03-18 Thread scattered

Steve Horsley wrote:
 Were you aware that OpenOffice.org version 2.0, which is due out soon
 (beta is available for download), can have python macros, as well as
 javascript and StarOffice Basic macros?

 Steve

That looks promising, though not as tightly integrated as VBA is with
Excel. For now I think I will stick to my goal of learning things like
Chaco and wxPython. If I ever take the Linux plunge it's nice to know
that OpenOffice is closing the gap with Excel as far as programmability
is concerned. 

-scattered

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


Re: Is Python like VB?

2005-03-18 Thread Jeff Shannon
Tom Willis wrote:
On Fri, 18 Mar 2005 15:45:10 -0500, Tom Willis [EMAIL PROTECTED] wrote:
On Fri, 18 Mar 2005 20:20:19 +, Steve Horsley [EMAIL PROTECTED] wrote:
Were you aware that OpenOffice.org version 2.0, which is due out soon
(beta is available for download), can have python macros, as well as
javascript and StarOffice Basic macros?
http://udk.openoffice.org/python/scriptingframework/index.html
Damn that's hot! I am tingly :)
Reply to self...
The API however, smells more like java to me than python. Alas, I will
happily use it for many of my needs.
IIRC, Sun significantly rewrote the scripting interface to StarOffice 
before they released the codebase to OpenOffice.org.  It's hardly 
surprising to know that they did so in a very Java-centric way.  And 
given limited resources (and presumably continued guidance from Sun in 
the form of Sun developers working on OO.o), it's not too surprising 
that OpenOffice hasn't changed that much.

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


Re: list of unique non-subset sets

2005-03-18 Thread Bengt Richter
On Thu, 17 Mar 2005 23:56:46 GMT, Raymond Hettinger [EMAIL PROTECTED] wrote:


Kent Johnson [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Raymond Hettinger wrote:
  [EMAIL PROTECTED]
 
 I have many set objects some of which can contain same group of object
 while others can be subset of the other. Given a list of sets,
 I need to get a list of unique sets such that non of the set is an
 subset of another or contain exactly the same members.
 
 Tried to do the following:
 s1=set(['a','b','c'])
 s2=set(['a','c'])
 s3=set(['a','d','e','f'])
 s4=set(['r','k','l'])
 s5=set(['r','k','l'])
 L=[s1,s2,s3,s4,s5]
 ---  cleaned-up list should contain s1, s3, s5
 
 
  This should do the trick:
 
 
  result = []
  for s1 in L:
  for s2 in result:
  if s1 = s2:
  break
  else:
  result.append(s1)
 
  print result

 If I understand the original post correctly, you also need to check for an
existing set being a
 subset of the set you are adding. A better test case is
 s1=set(['a','b','c'])
 s2=set(['a','c'])
 s3=set(['a','d','e','f'])
 s4=set(['r','k','l'])
 s5=set(['r','k','l'])
 s6=set(['g', 'h'])
 s7=set(['h', 'i'])
 s8=set(['g', 'h', 'i'])

 L=[s1,s2,s3,s4,s5,s6,s7,s8]
 # ---  cleaned-up list should contain s1, s3, s5, s8

Try this:

result = []
seen = set()
for s1 in L:
for s2 in L:
if s1  s2:
break
else:
if s1 not in seen:
result.append(s1)
seen.add(frozenset(s1))
print result

Actually, ISTM there are more than one set of sets that can be drawn from the
original set that internally satisfy the criteria of no internal duplicates or 
subsets. E.g.,
here are some lists of sets selected from L above. I believe (unless I goofed) 
the requirement
 
  I need to get a list of unique sets such that non of the set is an
  subset of another or contain exactly the same members.
 
is satisfied internally within each list below.

[set(['h', 'g']), set(['i', 'h'])]
[set(['a', 'c', 'b']), set(['a', 'e', 'd', 'f'])]
[set(['k', 'r', 'l']), set(['a', 'c', 'b']), set(['a', 'e', 'd', 'f']), 
set(['h', 'g'])]
[set(['a', 'e', 'd', 'f']), set(['a', 'c']), set(['h', 'g']), set(['i', 'h'])]
[set(['i', 'h'])]
[set(['k', 'r', 'l']), set(['a', 'c', 'b']), set(['a', 'e', 'd', 'f'])]
[]
[set(['a', 'c', 'b']), set(['h', 'g']), set(['i', 'h'])]
[set(['a', 'c', 'b']), set(['a', 'e', 'd', 'f']), set(['i', 'h'])]
[set(['k', 'r', 'l']), set(['a', 'e', 'd', 'f']), set(['a', 'c']), set(['i', 
'h'])]
[set(['k', 'r', 'l']), set(['a', 'c', 'b']), set(['h', 'g'])]
[set(['a', 'c', 'b'])]
[set(['k', 'r', 'l']), set(['a', 'c', 'b']), set(['a', 'e', 'd', 'f']), 
set(['i', 'h', 'g'])]
[set(['a', 'e', 'd', 'f']), set(['a', 'c']), set(['i', 'h', 'g'])]
[set(['k', 'r', 'l']), set(['a', 'e', 'd', 'f']), set(['i', 'h', 'g'])]
[set(['a', 'e', 'd', 'f']), set(['i', 'h'])]
[set(['a', 'c', 'b']), set(['a', 'e', 'd', 'f']), set(['i', 'h', 'g'])]
[set(['k', 'r', 'l']), set(['a', 'e', 'd', 'f']), set(['a', 'c']), set(['i', 
'h', 'g'])]
[set(['a', 'c'])]
[set(['k', 'r', 'l']), set(['a', 'c']), set(['h', 'g'])]
[set(['k', 'r', 'l']), set(['h', 'g']), set(['i', 'h'])]
[set(['k', 'r', 'l']), set(['a', 'c', 'b']), set(['a', 'e', 'd', 'f']), 
set(['i', 'h'])]
[set(['a', 'e', 'd', 'f']), set(['a', 'c']), set(['i', 'h'])]
[set(['a', 'c']), set(['h', 'g']), set(['i', 'h'])]
[set(['k', 'r', 'l']), set(['a', 'e', 'd', 'f']), set(['i', 'h'])]
[set(['k', 'r', 'l']), set(['a', 'e', 'd', 'f']), set(['a', 'c'])]
[set(['a', 'e', 'd', 'f']), set(['i', 'h', 'g'])]
[set(['a', 'c', 'b']), set(['a', 'e', 'd', 'f']), set(['h', 'g']), set(['i', 
'h'])]
[set(['k', 'r', 'l']), set(['a', 'e', 'd', 'f']), set(['a', 'c']), set(['h', 
'g'])]
[set(['k', 'r', 'l']), set(['a', 'e', 'd', 'f']), set(['h', 'g']), set(['i', 
'h'])]
[set(['a', 'e', 'd', 'f']), set(['a', 'c'])]
[set(['k', 'r', 'l']), set(['h', 'g'])]
[set(['k', 'r', 'l']), set(['a', 'e', 'd', 'f']), set(['h', 'g'])]
[set(['k', 'r', 'l']), set(['a', 'c']), set(['h', 'g']), set(['i', 'h'])]
[set(['h', 'g'])]
[set(['k', 'r', 'l']), set(['a', 'c', 'b'])]
[set(['k', 'r', 'l']), set(['a', 'c', 'b']), set(['i', 'h'])]
[set(['a', 'c', 'b']), set(['i', 'h', 'g'])]
[set(['a', 'c', 'b']), set(['a', 'e', 'd', 'f']), set(['h', 'g'])]
[set(['a', 'c', 'b']), set(['h', 'g'])]
[set(['k', 'r', 'l']), set(['a', 'c', 'b']), set(['a', 'e', 'd', 'f']), 
set(['h', 'g']), set(['i', 'h'])]
[set(['k', 'r', 'l']), set(['i', 'h'])]
[set(['k', 'r', 'l']), set(['a', 'c', 'b']), set(['i', 'h', 'g'])]
[set(['a', 'c', 'b']), set(['i', 'h'])]
[set(['a', 'c']), set(['i', 'h'])]
[set(['k', 'r', 'l']), set(['a', 'c']), set(['i', 'h', 'g'])]
[set(['k', 'r', 'l']), set(['a', 'e', 'd', 'f']), set(['a', 'c']), set(['h', 
'g']), set(['i', 'h'])]
[set(['k', 'r', 'l']), set(['a', 'e', 'd', 'f'])]
[set(['a', 'c']), set(['h', 'g'])]
[set(['k', 'r', 'l']), set(['i', 'h', 'g'])]
[set(['a', 'e', 'd', 'f']), set(['a', 'c']), set(['h', 'g'])]

Re: How to I restart an interactive session?

2005-03-18 Thread markscottwright
But, by deleting their namespace entries haven't I effectively unloaded
them?  In other words, from the point of the interpreter, isn't the
state at point A and point B the same?

--- point A:
  import os
  del __main__.__dict__['os']
--- point B

I guess my question boils down to, is the state of the python
interpreter kept anywhere other than the __main__ namespace?  Obviously
the answer is yes - there's the current working directory and any
running threads.  I think I'm willing to live with those (yeah, I know,
those are the words of a man who is going to spend time chasing obscure
side-effects...)

But are there other things I'm missing?  Is my whole plan misguided
from the beginning?

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


Re: Simple account program

2005-03-18 Thread M.E.Farmer
Igorati wrote:
 Thank you all for your help. I am sorry that I am struggling with
 programming. I still am attempting to get it. Yes, I do need to
stop
 posting homework assignments, perhaps I will learn to write code
through
 more studying. I have gone through some toutorials if that makes you
feel
 any better. I do have a desire to learn. Thank you again. I will go
back
 and attempt to impliment this.

Igorati,
 A desire to learn , persistant study, and excercise is all you really
need ;)
I don't know how much you  'get' yet so I will assume you are just
starting.
We all have problems gaining that 'flash of insight' sometimes that
makes it all clear ( I am still trying to fully grasp metaclasses and
secretly envy Alex Martelli and just about every other genius on this
list ;).
So the best way I can tell you to learn a language is to read and write
it.
-Open a Python interpreter and start keying in Python and see what
happens.
-If you don't know what an interpreter is read the tutor
http://docs.python.org/tut/node4.html
-Use dir() to see what an object exposes to you.
-Learn about list, dictionary, tuple and string methods it will save
you months.
-Buy a book on Python. I found it easier to grasp from a book than the
net, and now I have reference I can give to friends to get them
started.
-Read thru the standard library when you have the basics down the
insight you will gain is priceless.
-Pick a module and learn it. write a program that uses that module in
some way( this will make it easier to spot the time you actually need
to write a solution)
-Find a program you like and start adding 'features' to it or taking
out 'features' you don't like.
-Python tutor list may be more appropriate for you right now till you
are up and running. http://www.python.org/mailman/listinfo/tutor
-Just keep reading and writing Python , you will 'get it'.
hth,
M.E.Farmer

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


Re: wxPython vs. pyQt

2005-03-18 Thread RM
Of course, the licensing terms may still be too restrictive for those
that want to create comercial closed source applications and can't
afford the comercial license of Qt.  That is why, for many, wxPython
will remain the preferred choice.

Being that you are inclined use Xemacs and xterm for your development,
I don't think you will have too much trouble with either one.
Currently, I think the choice between Qt and wx boils down to this:

Type of app   -   Choice   -   Reason

GPL or Company use only app - Qt - It is easier, cleaner, etc.
Commercial Closed Source  - Qt - Don't mind the license cost.
Any type  - wx - It is free.

Other (lesser, I think) considerations, however, may bee the appearance
of the app.  On linux/KDE you may prefer the Qt native look.  On
Linux/GNOME you may prefer wx's GTK native look.  On Windows, wx is
completely native, while I can't speak for Qt's look since I have never
seen it, but I know it is not completely native looking.

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


Re: How to I restart an interactive session?

2005-03-18 Thread Mike Meyer
markscottwright [EMAIL PROTECTED] writes:

 But, by deleting their namespace entries haven't I effectively unloaded
 them?  In other words, from the point of the interpreter, isn't the
 state at point A and point B the same?

 --- point A:
   import os
   del __main__.__dict__['os']
 --- point B

That depends on the module you import. At point B, sys.modules *will*
contain an entry for the imported module. That won't be true at point
A unless the module was a builtin one.

 I guess my question boils down to, is the state of the python
 interpreter kept anywhere other than the __main__ namespace?  Obviously
 the answer is yes - there's the current working directory and any
 running threads.  I think I'm willing to live with those (yeah, I know,
 those are the words of a man who is going to spend time chasing obscure
 side-effects...)

Yes. Various things in sys record information about the state of the
interpreter.

 But are there other things I'm missing?  Is my whole plan misguided
 from the beginning?

It's not clear that misguided is the correct term. You're trying to do
something with the interpreter that it wasn't designed for. I'd say
that was unwise. Whether or not it *should* have been designed for
what you want to do is another problem.

 mike
-- 
Mike Meyer [EMAIL PROTECTED]  http://www.mired.org/home/mwm/
Independent WWW/Perforce/FreeBSD/Unix consultant, email for more information.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Step by step: Compiling extensions with MS Visual C++ Toolkit 2003 - msvccompiler-patch.txt (0/1)

2005-03-18 Thread magoldfish
Is it possible to compile extension modules on windows platforms using
MS Visual C++ Express 2005, or Visual Studio 8?  If so, how would one
modify the instructions posted in this thread?  [assume I also have
Toolkit 2003 installed, if necessary, for msvcr71.lib]

Marcus


Mike C. Fletcher wrote:
 Martin Bless wrote:
 ...

 Two things first - not to forget:
 
 (1) In contrast to what Mike writes I had to use a different
registry
 key (see step 9)
 
 
 Which is expected (even noted on the page), particularly if you have
a
 different version of the SDKs.  The keys in the patch were extracted
 from an English Win2K Platform SDK.  Don't know of any *good* way to
 figure out the keys in a version-agnostic manner.  Suggestions
welcome...

 (2) I don't now what people mean when talking about msvcr71.lib.
 There's no such file on my machine. BUT there IS a msvcrt.lib a
 directory C:\Programme\Microsoft Visual Studio .NET 2003\Vc7\lib.
I
 guess the .\Vc7\. indicates we are talking of the expected lib.
 Correct? I don't know.
 
 
 This was sloppy on my part.  msvcr71.dll is the DLL used for Visual
 Studio 7.1, we want the .lib for that version of the DLL, but as you
 note, it is actually named msvcrt.lib (same as the one for Visual
Studio
 6.0).

 Get and install the platform SDK Windows XP SP2 SDK (about
 
 
 ...

 It is

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MicrosoftSDK\InstalledSDKs\B44C7E10-89BD-4A32-A3BF-D9D0BC4C9A05
 
 and it is not
 ...\63DADB24-DC99-45EB-A748-EC93AB8A7497.
 
 Find out about the correct key in your case and adjust the crucial
 line 133 in msvccompiler.py:
 

freeSDK=rSOFTWARE\Microsoft\MicrosoftSDK\InstalledSDKs\B44C7E10-89BD-4A32-A3BF-D9D0BC4C9A05
 
 
 ...
 Will have to figure out how to make this work across SDK versions
somehow.

 Thanks for the report,
 Mike

 
   Mike C. Fletcher
   Designer, VR Plumber, Coder
   http://www.vrplumber.com
   http://blog.vrplumber.com

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


survey of modules to be added to stdlib

2005-03-18 Thread Alia Khouri
This is an informal survey to gauge the community's interest in adding
popular modules to the python standard library.

In no particular order, here's my personal list of favourites:

path.py - Jason Orendorff
elementree - Fredrik Lundh
ctypes - Thomas Heller
psyco - Armin Rigo
IPython - Fernando Pérez

BTW is there an official set of conditions that have to be met before a
module can be accepted into the stdlib?

AK

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


Re: survey of modules to be added to stdlib

2005-03-18 Thread Martin v. Löwis
Alia Khouri wrote:
BTW is there an official set of conditions that have to be met before a
module can be accepted into the stdlib?
Yes - although this has never been followed to date: In PEP 2,
http://www.python.org/peps/pep-0002.html
a procedure is defined how new modules can be added. Essentially,
we need a document stating its intended purpose, and a commitment
by the authors to maintain the code.
This may rule out inclusion of some modules in your list, e.g.
if nobody steps forward to offer ongoing maintenance. Just that
users want to see the code in the library is not sufficient,
we also need somebody to do the actual work.
If none of the core developers respond favourably to requests
for inclusion, a library PEP can be seen as a last resort to
trigger a BDFL pronouncement. Depending on the module, I personally
would actively object inclusion if I have doubts whether the
module is going to be properly maintained; I will, of course,
obey to any BDFL pronouncement.
Furthermore, and more recently, we also started requiring that
code is *formally* contributed to the PSF, through the contrib
forms,
http://www.python.org/psf/contrib.html
This may rule out further modules: the authors of the code
have to agree to its inclusion in the library; somebody else
contributing the modules for the authors will not be acceptable.
However, the authors don't have to offer ongoing support for
the copy in Python - any other volunteer could step in instead.
Regards,
Martin
--
http://mail.python.org/mailman/listinfo/python-list


Re: Is Python like VB?

2005-03-18 Thread Tom Willis
On Fri, 18 Mar 2005 20:20:19 +, Steve Horsley [EMAIL PROTECTED] wrote:
 scattered wrote:
 
  You are right that VBA isn't being discontinued yet. My own interest in
  learning python is to find a replacement for Excel VBA. I'm a
  mathematician who likes to throw quick programs together for things
  like statistical simulations. I liked the ability to get functioning
  code quickly in VBA, together with the ability to easily generate
  graphs of the results, etc., but I finally got tired of the slow speed
  and verbose syntax. I'm hoping that Python (as packaged by Enthought
  together with various numerical and graphing modules) will be an
  appropriate replacement.
 
 Were you aware that OpenOffice.org version 2.0, which is due out soon
 (beta is available for download), can have python macros, as well as
 javascript and StarOffice Basic macros?
 
 Steve
 --
 http://mail.python.org/mailman/listinfo/python-list
 

http://udk.openoffice.org/python/scriptingframework/index.html

Damn that's hot! I am tingly :)

-- 
Thomas G. Willis
http://paperbackmusic.net
-- 
http://mail.python.org/mailman/listinfo/python-list


PyGTK Popup menu?

2005-03-18 Thread dataangel
I want to make a pygtk app that consists completely of a window. When I 
run it, a menu should appear where the mouse cursor is. I've been 
looking at the official pygtk tutorial and documentation, but everything 
seems to assume that I'm either creating a window to put the menu in (I 
just want it to be the menu floating by itself) or that I want a button 
press to trigger the menu appearing (it should just pop into existence 
when I run it).

I've tried just creating some menu items, appending them to a menu and 
then calling menu.popup(None,None,None,0,0) but nothing happens :/
--
http://mail.python.org/mailman/listinfo/python-list


  1   2   >