Re: Pre-PEP: Dictionary accumulator methods

2005-03-18 Thread Raymond Hettinger
> > d.count(key, qty) > > d.appendlist(key, *values) [Bengt Richter] > How about an efficient duck-typing value-incrementer to replace both? There is some Zen of Python that argues against this interesting idea. Also, I'm concerned that by folding appendlist() into valadd() we would lose an imp

Re: Pre-PEP: Dictionary accumulator methods

2005-03-18 Thread Roose
> +1 for inc instead of count. > appendlist seems a bit too specific (I do not use dictionaries of lists > that often). No way, I use that all the time. I use that more than count, I would say. Roose -- http://mail.python.org/mailman/listinfo/python-list

Re: Pre-PEP: Dictionary accumulator methods

2005-03-18 Thread Reinhold Birkenfeld
Raymond Hettinger wrote: > [Michele Simionato] >> +1 for inc instead of count. > > Any takers for tally()? Well, as a non-native speaker, I had to look up this one in my dictionary. That said, it may be bad luck on my side, but it may be that this word is relatively uncommon and there are many ot

Re: Simple account program

2005-03-18 Thread Chris Rebert (cybercobra)
Since everyone's improving the program, I thought I'd just tweak Dennis Lee Bieber's code a little. Here's the result. Good luck Ignorati! import time class Transaction(object): def __init__(self, payee, amount, date=None): # amount is the amt withdrawn/deposited self.payee =

Re: Pre-PEP: Dictionary accumulator methods

2005-03-18 Thread Paul Rubin
"Raymond Hettinger" <[EMAIL PROTECTED]> writes: > [Michele Simionato] > > +1 for inc instead of count. > > Any takers for tally()? I'd say "tally" has some connotation of a counter that can never go negative. I don't know if that behavior is desirable. Someone suggested deleting the key if the

Re: Pre-PEP: Dictionary accumulator methods

2005-03-18 Thread Raymond Hettinger
[Michele Simionato] > +1 for inc instead of count. Any takers for tally()? We should avoid abbreviations like inc() or incr() that different people tend to abbreviate differently (for example, that is why the new partial() function has its "keywords" argument spelled-out). The only other issue I

Re: Pre-PEP: Dictionary accumulator methods

2005-03-18 Thread Michael Spencer
Raymond Hettinger wrote: I would like to get everyone's thoughts on two new dictionary methods: +1 count ? appendlist The proposed names could possibly be improved (perhaps tally() is more active and clear than count()). IMO 'tally' is exactly the right method name One issue is with negative incre

Re: list of unique non-subset sets

2005-03-18 Thread Bengt Richter
On 18 Mar 2005 19:41:55 -0800, [EMAIL PROTECTED] wrote: >Once again my specs were incomplete. >By largest I mean exactly what you pointed out as in sum(map(len, >setlist)). > But that will not necessarily yield a single setlist taken from the source set list, so you still need a selection amongst

Re: Pre-PEP: Dictionary accumulator methods

2005-03-18 Thread Paul Rubin
"Michele Simionato" <[EMAIL PROTECTED]> writes: > +1 for inc instead of count. I'd prefer incr or increment to inc. add is also ok. count isn't so great. Something like add_count or inc_count or add_num or whatever could be ok. -- http://mail.python.org/mailman/listinfo/python-list

Re: Pre-PEP: Dictionary accumulator methods

2005-03-18 Thread Michele Simionato
+1 for inc instead of count. appendlist seems a bit too specific (I do not use dictionaries of lists that often). The problem with setdefault is the name, not the functionality. get_or_set would be a better name: we could use it as an alias for setdefault and then remove setdefault in Python 3000.

Re: wxPython vs. pyQt

2005-03-18 Thread Swaroop C H
On Sat, 19 Mar 2005 15:55:23 +1100, Mike P. <[EMAIL PROTECTED]> wrote: > Personally for ease of use Qt is the way to go. I'm really looking forward > to Qt 4 coming out, and then sometime later PyQt 4. Then I'll be able to > develop with my favourite APIs (Qt, OpenGL, and OpenSceneGraph) under a >

Re: wxPython vs. pyQt

2005-03-18 Thread Mike P.
"RM" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > 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 pre

Re: survey of modules to be added to stdlib

2005-03-18 Thread Swaroop C H
On Sat, 19 Mar 2005 03:40:31 GMT, Ron <[EMAIL PROTECTED]> wrote: > I would prefer to have a install utility included that retrieves a > list of modules we can install, update, or uninstall, from the web in > a consistent easy way. It would really be nice if they listed what > modules they were dep

Re: Pre-PEP: Dictionary accumulator methods

2005-03-18 Thread Bengt Richter
On Sat, 19 Mar 2005 03:14:07 GMT, [EMAIL PROTECTED] (Bengt Richter) wrote: [...] >Yes, but duck typing for any obj that supports "+" gets you a lot, ISTM at >this stage >of this BF ;-) Just in case, by "this BF," I meant to refer to my addval idea, with no offensive charaterization of anyone else

ElementTree Tidy HTML Tree Builder and comments

2005-03-18 Thread BjÃrn LindstrÃm
I'm considering using the ElementTree Tidy HTML Tree Builder for a web spidering program I'm developing. However, my program must be able to extract certain information from HTML comments. I'm basically creating my trees like this: TidyHTMLTreeBuilder.parse(urllib.urlopen(url)) What I want to k

Re: Pre-PEP: Dictionary accumulator methods

2005-03-18 Thread Brian van den Broek
Raymond Hettinger said unto the world upon 2005-03-18 20:24: I would like to get everyone's thoughts on two new dictionary methods: def count(self, value, qty=1): try: self[key] += qty except KeyError: self[key] = qty def appen

Re: Simple XML-to-Python conversion

2005-03-18 Thread Swaroop C H
On 18 Mar 2005 20:24:56 -0800, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > >From what I understand, this is how XML was standardized, in a sort of > hierarchical structure of infinite possibilities. The problem I'm > having with these structures is that I need to actively search through > each

Re: Pre-PEP: Dictionary accumulator methods

2005-03-18 Thread Raymond Hettinger
[Roose] > I like this, it is short, low impact, and makes things more readable. I > tend to go with just the literal way of doing it instead of using get and > setdefault, which I find awkward. Thanks. Many people find setdefault() to be an oddball. > But alas I had a my short, low impact, use

Re: Simple XML-to-Python conversion

2005-03-18 Thread [EMAIL PROTECTED]
I've tried xmltramp and element tree, but these tools aren't what I had in mind. I've come to the realization that it's not the tools that are lacking. In fact, I'm a big fan of ElementTree now, but would only use it for large parsing tasks. Instead, I think the problem is either inherent in the

Re: Pre-PEP: Dictionary accumulator methods

2005-03-18 Thread Raymond Hettinger
[Jeff Epler] > Maybe something for sets like 'appendlist' ('unionset'?) I do not follow. Can you provide a pure python equivalent? Raymond -- http://mail.python.org/mailman/listinfo/python-list

Re: create/access dynamic growth list

2005-03-18 Thread sam
Larry Bates wrote: 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

Sybase module 0.37pre1 released

2005-03-18 Thread Dave Cole
WHAT IS IT: The Sybase module provides a Python interface to the Sybase relational database system. It supports all of the Python Database API, version 2.0 with extensions. NOTES: This release contains a number of small bugfixes and patches received from users. I have been unable to find the sourc

Weekly Python Patch/Bug Summary

2005-03-18 Thread Kurt B. Kaiser
Patch / Bug Summary ___ Patches : 286 open ( +7) / 2801 closed ( +4) / 3087 total (+11) Bugs: 870 open (+19) / 4867 closed (+14) / 5737 total (+33) RFE : 175 open ( +2) / 150 closed ( +0) / 325 total ( +2) New / Reopened Patches __ inspect.p

Re: Pre-PEP: Dictionary accumulator methods

2005-03-18 Thread Jeff Epler
Maybe something for sets like 'appendlist' ('unionset'?) Jeff pgpCq9GushexV.pgp Description: PGP signature -- http://mail.python.org/mailman/listinfo/python-list

Re: list of unique non-subset sets

2005-03-18 Thread les_ander
Once again my specs were incomplete. By largest I mean exactly what you pointed out as in sum(map(len, setlist)). I think this might work--sorting of the initial list should do the trick. 1) sort the sets by size (in decending order) 2) put the first (largest) into a new list (Lu) for s in Lnew[1:

Re: survey of modules to be added to stdlib

2005-03-18 Thread Ron
On 18 Mar 2005 14:16:01 -0800, "Alia Khouri" <[EMAIL PROTECTED]> wrote: >This is an informal survey to gauge the community's interest in adding >popular modules to the python standard library. I would prefer to have a install utility included that retrieves a list of modules we can install, updat

Re: survey of modules to be added to stdlib

2005-03-18 Thread Paul Rubin
"Raymond Hettinger" <[EMAIL PROTECTED]> writes: > > psyco - Armin Rigo > This is platform specific. That's ok, there's plenty of platform specific modules in the stdlib already, and this seems like a good one to add. -- http://mail.python.org/mailman/listinfo/python-list

Re: Pre-PEP: Dictionary accumulator methods

2005-03-18 Thread Bengt Richter
On Sat, 19 Mar 2005 01:24:57 GMT, "Raymond Hettinger" <[EMAIL PROTECTED]> wrote: >I would like to get everyone's thoughts on two new dictionary methods: > >def count(self, value, qty=1): >try: >self[key] += qty >except KeyError: >self

Re: survey of modules to be added to stdlib

2005-03-18 Thread Raymond Hettinger
> psyco - Armin Rigo This is platform specific. Raymond -- http://mail.python.org/mailman/listinfo/python-list

Re: Pre-PEP: Dictionary accumulator methods

2005-03-18 Thread Roose
I like this, it is short, low impact, and makes things more readable. I tend to go with just the literal way of doing it instead of using get and setdefault, which I find awkward. But alas I had a my short, low impact, useful suggestion and I think it died. It was for any() and all() for lists.

Re: Working with Huge Text Files

2005-03-18 Thread Al Christians
Michael Hoffman wrote: [EMAIL PROTECTED] wrote: It will only be this simple if you can guarantee that the original file is actually sorted by the first field. And if not you can either sort the file ahead of time, or just keep reopening the files in append mode when necessary. You could sort them

Re: Working with Huge Text Files

2005-03-18 Thread Al Christians
I did some similar stuff way back about 12-15 years ago -- in 640k MS-DOS with gigabyte files on 33 MHz machines. I got good performance, able to bring up any record out of 10 million or so on the screen in a couple of seconds (not using Python, but that should not make much difference, maybe ev

Virus in your Mail to empire.support

2005-03-18 Thread root at smtp
The VirusCheck at the IMST generated the following Message: V I R U S A L E R T Our VirusCheck found a Virus (W32/Netsky-Q) in your eMail to "empire.support". This eMail has been deleted ! Now it is on you to check your System for Viruses This Syst

Re: Working with Huge Text Files

2005-03-18 Thread cwazir
Hi, Lorn Davies wrote: > . working with text files that range from 100MB to 1G in size. > . > XYZ,04JAN1993,9:30:27,28.87,7600,40,0,Z,N > XYZ,04JAN1993,9:30:28,28.87,1600,40,0,Z,N > . I've found that for working with simple large text files like this, nothing beats the plain old buil

Re: Pre-PEP: Dictionary accumulator methods

2005-03-18 Thread Raymond Hettinger
> >def count(self, value, qty=1): [Aahz] > You mean > def count(self, key, qty=1) > > Right? Yes. Also, there is a typo in the final snippet (pure python version of dictionary of dictionaries). It should read: if key not in d: d[key] = {subkey:value} else: d

Re: Working with Huge Text Files

2005-03-18 Thread [EMAIL PROTECTED]
[EMAIL PROTECTED] wrote: > Lorn Davies wrote: > > Hi there, I'm a Python newbie hoping for some direction in working > with > > text files that range from 100MB to 1G in size. Basically certain > rows, > > sorted by the first (primary) field maybe second (date), need to be > > copied and written t

Re: Pre-PEP: Dictionary accumulator methods

2005-03-18 Thread Aahz
In article <[EMAIL PROTECTED]>, Raymond Hettinger <[EMAIL PROTECTED]> wrote: > >I would like to get everyone's thoughts on two new dictionary methods: > >def count(self, value, qty=1): >try: >self[key] += qty >except KeyError: >self[ke

Re: Pre-PEP: Dictionary accumulator methods

2005-03-18 Thread Jeff Shannon
Raymond Hettinger wrote: def count(self, value, qty=1): try: self[key] += qty except KeyError: self[key] = qty I presume that the argument list is a typo, and should actually be def count(self, key, qty=1): ... Correct? Jeff Shanno

Re: Pre-PEP: Dictionary accumulator methods

2005-03-18 Thread Mike Rovner
Ivan Van Laningham wrote: Hi All-- Maybe I'm not getting it, but I'd think a better name for count would be add. As in d.add(key) d.add(key,-1) d.add(key,399) etc. IMHO inc (for increment) is better. d.inc(key) add can be read as add key to d Mike -- http://mail.python.org/mailman/listinfo/python-

Re: Working with Huge Text Files

2005-03-18 Thread Michael Hoffman
[EMAIL PROTECTED] wrote: It will only be this simple if you can guarantee that the original file is actually sorted by the first field. And if not you can either sort the file ahead of time, or just keep reopening the files in append mode when necessary. You could sort them in memory in your Python

Re: survey of modules to be added to stdlib

2005-03-18 Thread Neil Hodgson
Alia Khouri: > ctypes - Thomas Heller I would like this to go in but it won't be added as it allows unsafe code, such as dereferencing bad pointers. Neil -- http://mail.python.org/mailman/listinfo/python-list

Re: list of unique non-subset sets

2005-03-18 Thread Raymond Hettinger
[EMAIL PROTECTED] ] > >OK, so I need to be more precise. > >Given a list of sets, output the largest list of sets (from this list, > >order does not matter) such that: > >1) there is no set that is a PROPER subset of another set in this list > >2) no two sets have exactly the same members (100% ove

Re: Pre-PEP: Dictionary accumulator methods

2005-03-18 Thread Ivan Van Laningham
Hi All-- Maybe I'm not getting it, but I'd think a better name for count would be add. As in d.add(key) d.add(key,-1) d.add(key,399) etc. Raymond Hettinger wrote: > > I would like to get everyone's thoughts on two new dictionary methods: > > def count(self, value, qty=1): >

Pre-PEP: Dictionary accumulator methods

2005-03-18 Thread Raymond Hettinger
I would like to get everyone's thoughts on two new dictionary methods: def count(self, value, qty=1): try: self[key] += qty except KeyError: self[key] = qty def appendlist(self, key, *values): try:

Python tutorial for LinuxQuestions.org?

2005-03-18 Thread beliavsky
I think a short Python tutorial at LinuxQuestions.org http://www.linuxquestions.org/questions/answers.php?action=viewcat&catid=4 would be a good way of introducing Python to new programmers. There are currently tutorials there for C, C++, and Java that have been viewed thousands of times. Of course

Re: list of unique non-subset sets

2005-03-18 Thread Bengt Richter
On 18 Mar 2005 15:46:44 -0800, [EMAIL PROTECTED] wrote: >OK, so I need to be more precise. >Given a list of sets, output the largest list of sets (from this list, >order does not matter) such that: >1) there is no set that is a PROPER subset of another set in this list >2) no two sets have exactly

Re: Working with Huge Text Files

2005-03-18 Thread [EMAIL PROTECTED]
Lorn Davies wrote: > Hi there, I'm a Python newbie hoping for some direction in working with > text files that range from 100MB to 1G in size. Basically certain rows, > sorted by the first (primary) field maybe second (date), need to be > copied and written to their own file, and some string manip

Re: PyGTK and pyexe

2005-03-18 Thread Tom Cocagne
I used the instructions in the PyGTK FAQ and managed to get it working. Take a look at: http://www.async.com.br/faq/pygtk/index.py?req=show&file=faq21.005.htp Cheers, Rakis Viktor wrote: > Did anybody managed to "pack", a program that uses pygtk with pyexe? > > The best result I got was:

Working with Huge Text Files

2005-03-18 Thread Lorn Davies
Hi there, I'm a Python newbie hoping for some direction in working with text files that range from 100MB to 1G in size. Basically certain rows, sorted by the first (primary) field maybe second (date), need to be copied and written to their own file, and some string manipulations need to happen as w

PyGTK and pyexe

2005-03-18 Thread Viktor
Did anybody managed to "pack", a program that uses pygtk with pyexe? The best result I got was: Pango-ERROR **: file shape.c: line 75 (pango_shape): assertion faled: (glyphs->num_glyphs > 0) aborting... I'm using python2.4, pygtk-2.6.1-1.win32-py2.4, gtk-win32-2.6.4-rc1. Thanks in advance. --

Re: list of unique non-subset sets

2005-03-18 Thread les_ander
OK, so I need to be more precise. Given a list of sets, output the largest list of sets (from this list, order does not matter) such that: 1) there is no set that is a PROPER subset of another set in this list 2) no two sets have exactly the same members (100% overlap) Seems like this problem is m

ANN: 2005 International Obfuscated Ruby Code Contest (IORCC)

2005-03-18 Thread iorcc
IMMEDIATE RELEASE: Fri Mar 18 16:34:52 CST 2005 LOCATION: http://iorcc.dyndns.org/2005/press/031805.html ANNOUNCEMENT: International Obfuscated Ruby Code Contest (IORCC) Entry Deadline, Midnight on March 31st, 2005 Dear Rubyists, Perlists, Shellists, Cists and Hac

Re: setDocumentLocator in validating parser (xmlproc)

2005-03-18 Thread James Kew
"Cees Wesseling" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > 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? It's a known bug with a simple patch -- I don't know why i

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

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 togeth

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

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

program hangs when external process crashes

2005-03-18 Thread Earl Eiland
I'm executing WinRK.exe in a loop using the following code: for x in Files: Command_String = 'C:\Program Files\WinRK\WinRK.exe -create ' + os.path.join(InputDirectory, os.path.splitext(x)[0]) + ' -set compression_method ppmz -setg include_paths none -add ' + os.path.join(InputDirectory, x)

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: >

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_

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

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 y

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,

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 >> >>w

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

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

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: htt

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: htt

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 replacem

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 i

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]>; Sent: Friday, March 18, 2005 6:05 AM Subject: RE: COM connection point > Just use > > obj = win32com.client.Dispatch(obj) > >

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 quickl

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.pyt

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

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 mod

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 Shel

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 i

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 f

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 c

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 id

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 xmlp

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 applic

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

Re: Windows question from Mac guy

2005-03-18 Thread Thomas Heller
Charles Hartman <[EMAIL PROTECTED]> writes: > I'm sitting here (briefly!) with a Windows machine trying to build a > distributable for my app. I'm using py2exe and Inno Setup. (This is > Apple-framework Python 2.3, wxPython 2.5.3.8.) Everything works! > Except . . . > > My app has a data file, sca

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 nevertheles

Re: sgmlop: malformed charrefs?

2005-03-18 Thread Magnus Lie Hetland
In article <[EMAIL PROTECTED]>, Fredrik Lundh wrote: >Martin v. Löwis wrote: > >>> are the PyXML folks shipping the latest sgmlop? I'm pretty sure >>> they've forked the code (there's no UnicodeParser in the >>> effbot.org edition), and I have no idea how things work in the >>> fork. >> >> As we'v

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

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 i

OSX / Python 2.3 error"truncated 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 "lic

Re: Import mechanism to support multiple Python versions

2005-03-18 Thread Thomas Heller
Nicolas Fleury <[EMAIL PROTECTED]> writes: > 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. You may manipulate the p

[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 feat

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 d

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 nam

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-packa

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 > langu

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,

Windows question from Mac guy

2005-03-18 Thread Charles Hartman
I'm sitting here (briefly!) with a Windows machine trying to build a distributable for my app. I'm using py2exe and Inno Setup. (This is Apple-framework Python 2.3, wxPython 2.5.3.8.) Everything works! Except . . . My app has a data file, scandictionary.txt, that it needs to load when it start

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.VERB

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 execut

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 wan

  1   2   >