Re: BASIC vs Python

2004-12-18 Thread Andrew Dalke
Dennis Lee Bieber wrote: > Ah, but you said "standard" module for Python... The > graphics/sound extensions on your TI 99/4A were not "standard" BASIC... I assume by "standard" you mean some sort of formal standard, like ANSI Basic or ISO C? If so, well, there's no "standard" Python. What

Re: Use macros in Excel via win32com

2004-12-18 Thread chris
Thanks, but the problem is that I need to create the entire Excel document from scratch, dynamically, via the Python script. I want the script to add the macro code. -Chris -- http://mail.python.org/mailman/listinfo/python-list

Re: A completely silly question

2004-12-18 Thread Craig Ringer
On Sat, 2004-12-18 at 00:40, Amir Dekel wrote: > This must be the silliest question ever: > > What about user input in Python? (like stdin) > Where can I find it? I can't find any references to it in the documentation. Under UNIX, I generally either use curses, or just put the terminal into raw m

Re: Use macros in Excel via win32com

2004-12-18 Thread Gregor Horvath
chris wrote: I'm creating an excel document dynamically from scratch using Python and the win32com module. All is well, but now I need to add a macro to the spreadsheet and run it (to enable some sorting features in the spreadsheet). I think I know how to run a macro once it's installed (using th

Re: Easy "here documents" ??

2004-12-18 Thread Nick Coghlan
Jim Hill wrote: Is there a way to produce a very long multiline string of output with variables' values inserted without having to resort to this wacky """v = %s"""%(variable) business? Try combining Python 2.4's subprocess module with its string Templates. Cheers, Nick. -- Nick Coghlan | [EMAI

Re: expression form of one-to-many dict?

2004-12-18 Thread Nick Craig-Wood
Steven Bethard <[EMAIL PROTECTED]> wrote: > map = {} > for key, value in sequence: > map.setdefault(key, []).append(value) I was thinking about exactly that the other day, when converting some perl to python. [ digression: In perl, you do push @{$map->{$key}}, $value If $map->{$key} d

Re: regular expression for javadoc style comment

2004-12-18 Thread Craig Ringer
On Fri, 2004-12-17 at 09:40, Alessandro Crugnola wrote: > Hi all, > i need to use a regular expression to match javadoc style comments in a file, > something like > > /** >* Constructs a new Call instance. >* >* @param object the object the Function shall be executed

Re: Upgrading Python Article

2004-12-18 Thread Tim Roberts
JanC <[EMAIL PROTECTED]> wrote: >Tim Roberts schreef: > >> I don't think that's fair. Visual C++ 7.1 is signficantly better at >> compliance than their past compilers. > >AFAIK that's only for C++, not for C...? Yes. Microsoft has largely chosen to ignore C99. According to the Visual Studio te

Re: Plugin system; imp module head scratch

2004-12-18 Thread Nick Coghlan
Dave wrote: Hi, all, I'm trying to implement a simple plugin framework, with some unexpected results. I'm using Python 2.3.4 on Windows 2000. My script loader.py loads plugin packages from a directory (in this case its own), and checks a variable defined in the package's __init__.py for information

Re: Plugin system; imp module head scratch

2004-12-18 Thread Keith Dart
Dave wrote: Hi, all, I'm trying to implement a simple plugin framework, with some unexpected results. I'm using Python 2.3.4 on Windows 2000. What would be the difference between a "plugin" and a regular Python module? -- ~ Kei

Re: Easy "here documents" ??

2004-12-18 Thread vincent wehren
Peter Hansen wrote: Jim Hill wrote: I've done some Googling around on this and it seems like creating a here document is a bit tricky with Python. Trivial via triple-quoted strings if there's no need for variable interpolation but requiring a long, long formatted arglist via (%s,%s,%s,ad infinitum

Re: Easy "here documents" ??

2004-12-18 Thread M.E.Farmer
I was curious so I googled , looks like a unix thing :) http://www.faqs.org/docs/abs/HTML/here-docs.html Ok I am with Peter on this , still clueless. What about string replacement. py> x = """ Hello me name is ~NAME~. \n I am ~AGE~ years old.\n ...I live in ~CITY~.\n The city of ~CITY~ i

odbc script

2004-12-18 Thread Chris
Hello, I posted a while back about a newbie database question and got a lot of great help here. My script that I am creating has come a long way (For me!) and almost does what I need it too. I am basicly using a dictionary to update a access database using an odbc connector. I am ab

Re: How do I define the search path for personal library

2004-12-18 Thread Peter Hansen
[EMAIL PROTECTED] wrote: Dear all, i have a simple question. Suppose I have my classes such as myClass1.py myClass2.py etc which I keep in a special folder ~/py_libs Now suppose I have a program that is not in py_libs but I want to do import myClass1 # note: myClass1 is not in the current directory

Re: Easy "here documents" ??

2004-12-18 Thread Peter Hansen
Jim Hill wrote: I've done some Googling around on this and it seems like creating a here document is a bit tricky with Python. Trivial via triple-quoted strings if there's no need for variable interpolation but requiring a long, long formatted arglist via (%s,%s,%s,ad infinitum) if there is. So m

Re: Cool object trick

2004-12-18 Thread Carl Banks
Bengt Richter wrote: > m=type('',(),{})() Nick Coghlan wrote: > Heh. > > Look ma, Perlython! I doubt anyone could perform such a ghastly hack so simply and straightforwardly in Perl. -- CARL BANKS -- http://mail.python.org/mailman/listinfo/python-list

Re: Replace single item in tkinter ListBox

2004-12-18 Thread jepler
To the best of my knowledge, the only way to do this is as you describe: delete the old item, then insert the new item. The Tk manpage for "listbox" doesn't describe any commands to only update an item in the list. Actually, you may have another choice, if your Tk is new enough---Tk supports (in

Re: BASIC vs Python

2004-12-18 Thread Scott Robinson
On Fri, 17 Dec 2004 20:41:11 -0600, Mike Meyer <[EMAIL PROTECTED]> wrote: >Scott Robinson <[EMAIL PROTECTED]> writes: > >> Forth seems better than basic, but is *weird* (I tried it for a >> while). I'm not sure going from Forth to C (or Python) would be much >> easier than Basic to C or Python.

Re: A rational proposal

2004-12-18 Thread Paul Rubin
[EMAIL PROTECTED] (Alex Martelli) writes: > gmpy wraps GMP, which is covered by LGPL; therefore, gmpy itself is > LGPL, and thus, sadly, cannot be included with python (otherwise, > speaking as gmpy's author, I'd be glad to fix its design to meet your > objections). There's no obstacle to includin

Re: A rational proposal

2004-12-18 Thread Alex Martelli
Raymond L. Buvel <[EMAIL PROTECTED]> wrote: > Mike Meyer wrote: > > PEP: XXX > > Title: A rational number module for Python > > > I think it is a good idea to have rationals as part of the standard > distribution but why not base this on the gmpy module > (https://sourceforge.net/projects/gmpy

Re: BASIC vs Python

2004-12-18 Thread Scott Robinson
On Fri, 17 Dec 2004 20:41:11 -0600, Mike Meyer <[EMAIL PROTECTED]> wrote: >Scott Robinson <[EMAIL PROTECTED]> writes: > >> Forth seems better than basic, but is *weird* (I tried it for a >> while). I'm not sure going from Forth to C (or Python) would be much >> easier than Basic to C or Python.

Re: How about "pure virtual methods"?

2004-12-18 Thread Alex Martelli
Noam Raphael <[EMAIL PROTECTED]> wrote: > What I want is that if I have this module: > > == > > class BaseClass(object): > def __init__(self): > ... > > @notimplemented > def save_data(self, filename): > """This method should save the interna

Re: Use macros in Excel via win32com

2004-12-18 Thread [EMAIL PROTECTED]
"chris" <[EMAIL PROTECTED]> wrote: >I'm creating an excel document dynamically from scratch using Python >and the win32com module. All is well, but now I need to add a macro to >the spreadsheet and run it (to enable some sorting features in the >spreadsheet). I think I know how to run a macro on

How do I define the search path for personal library

2004-12-18 Thread les_ander
Dear all, i have a simple question. Suppose I have my classes such as myClass1.py myClass2.py etc which I keep in a special folder ~/py_libs Now suppose I have a program that is not in py_libs but I want to do import myClass1 # note: myClass1 is not in the current directory how can I set the sear

Easy "here documents" ??

2004-12-18 Thread Jim Hill
I've done some Googling around on this and it seems like creating a here document is a bit tricky with Python. Trivial via triple-quoted strings if there's no need for variable interpolation but requiring a long, long formatted arglist via (%s,%s,%s,ad infinitum) if there is. So my question is:

Use macros in Excel via win32com

2004-12-18 Thread chris
I'm creating an excel document dynamically from scratch using Python and the win32com module. All is well, but now I need to add a macro to the spreadsheet and run it (to enable some sorting features in the spreadsheet). I think I know how to run a macro once it's installed (using the Run method

Plugin system; imp module head scratch

2004-12-18 Thread Dave
Hi, all, I'm trying to implement a simple plugin framework, with some unexpected results. I'm using Python 2.3.4 on Windows 2000. My script loader.py loads plugin packages from a directory (in this case its own), and checks a variable defined in the package's __init__.py for information on the pl

Re: How about "pure virtual methods"?

2004-12-18 Thread Erik Max Francis
Noam Raphael wrote: Well, what do you say? Raising NotImplementedError in the methods that need to be overridden is much more customary, more straightforward, and already works fine. -- Erik Max Francis && [EMAIL PROTECTED] && http://www.alcyone.com/max/ San Jose, CA, USA && 37 20 N 121 53 W && A

Re: How about "pure virtual methods"?

2004-12-18 Thread Jp Calderone
On Sun, 19 Dec 2004 01:49:50 +0200, Noam Raphael <[EMAIL PROTECTED]> wrote: >Hello, > > I thought about a new Python feature. Please tell me what you think > about it. > > Say you want to write a base class with some unimplemented methods, that > subclasses must implement (or maybe even just de

Replace single item in tkinter ListBox

2004-12-18 Thread Zhang Le
Hello, Is there a quick way to replace the content of a single item in tkinter's listbox? Currently my solution is to first delete the item, then insert a new item at the same position. I think there may be better way. Zhang Le -- http://mail.python.org/mailman/listinfo/python-list

How about "pure virtual methods"?

2004-12-18 Thread Noam Raphael
Hello, I thought about a new Python feature. Please tell me what you think about it. Say you want to write a base class with some unimplemented methods, that subclasses must implement (or maybe even just declare an interface, with no methods implemented). Right now, you don't really have a way

Re: A beginner's problem...

2004-12-18 Thread Nick Coghlan
Amir Dekel wrote: Mike Meyer wrote: Doing a second import will find the module in sys.modules and not bother looking in the file system. The solution is to reload(module) instead of import module. What if I import using "from module import class"? It seems to me that I can't use reload the

Re: A rational proposal

2004-12-18 Thread Nick Coghlan
Mike Meyer wrote: max() and min() are already part of the standard library. Providing them as instance methods is quite irregular. They don't handle decimals or rationals. This is following the lead of the decimal package. As Tim pointed out - decimal has its own versions of max & min which conform

Re: A beginner's problem...

2004-12-18 Thread Mike Meyer
Amir Dekel <[EMAIL PROTECTED]> writes: > Mike Meyer wrote: >> Doing a second import will find the module in sys.modules and not >> bother looking in the file system. The solution is to reload(module) >> instead of import module. >> What if I import using "from module import class"? It see

Re: BASIC vs Python

2004-12-18 Thread Mike Meyer
Dennis Lee Bieber <[EMAIL PROTECTED]> writes: I like your categories, but you forgot one. > On Fri, 17 Dec 2004 13:54:45 -0500, Adam DePrince <[EMAIL PROTECTED]> > declaimed the following in comp.lang.python: >> I'd like to ask everybody a simple question. How many computer >> languages are you

Re: A beginner's problem...

2004-12-18 Thread Amir Dekel
Mike Meyer wrote: Doing a second import will find the module in sys.modules and not bother looking in the file system. The solution is to reload(module) instead of import module. What if I import using "from module import class"? It seems to me that I can't use reload then, or I just could

Re: better lambda support in the future?

2004-12-18 Thread Nick Coghlan
Bengt Richter wrote: It is a little sneaky though, so it might not be prudent to promote without a little more experimentation? I just like to explore ;-) I don't think even the py-dev discussions of this settled on whether such tricks were "very cool" or "downright evil". They're probably less e

Re: A beginner's problem...

2004-12-18 Thread Mike Meyer
[Format recovered from top posting.] "James Martin" <[EMAIL PROTECTED]> writes: > > > "Amir Dekel" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] >> Hello everyone, >> First, I have to say that Python is one of the coolest programing >> languages I have seen. >> And now for the prob

Re: Cool object trick

2004-12-18 Thread Nick Coghlan
Robert Brewer wrote: Bengt Richter wrote: >>> m=type('',(),{})() >>> m.title = 'not so fast ;-)' >>> m.title 'not so fast ;-)' Now THAT is a cool object trick. :) Heh. Look ma, Perlython! Cheers, Nick. -- Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia --

Re: os.walk bug?

2004-12-18 Thread Alex Martelli
Terry Reedy <[EMAIL PROTECTED]> wrote: > "Alex Martelli" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > > for item in alist: > >if isnasty(item): > >alist.remove(item) > > > > changing the header to ``in alist[:]:'' or ``in list(alist):'' probably > > makes this code

Re: os.walk bug?

2004-12-18 Thread Terry Reedy
"Alex Martelli" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > for item in alist: >if isnasty(item): >alist.remove(item) > > changing the header to ``in alist[:]:'' or ``in list(alist):'' probably > makes this code work, but it still can't make it GOOD... good would be:

Re: better lambda support in the future?

2004-12-18 Thread Bengt Richter
On Sat, 18 Dec 2004 14:39:54 -0500, "Terry Reedy" <[EMAIL PROTECTED]> wrote: > >"Bengt Richter" <[EMAIL PROTECTED]> wrote in message >news:[EMAIL PROTECTED] >> On Sat, 18 Dec 2004 03:05:08 -0500, "Terry Reedy" <[EMAIL PROTECTED]> >> wrote: >>>To avoid the redundancy of 'a' and '_a', etc, how abo

Re: expression form of one-to-many dict?

2004-12-18 Thread Terry Reedy
In respect to map(func, seq) versus [func(i) for i in seq], for pre-existing func, 'OP' wrote The map form, in this case, parses instantly in my brain, while the listcomp certainly takes a few cycles. And note that I'm not talking about the typing conciseness, but about the

Re: A beginner's problem...

2004-12-18 Thread James Martin
Try deleting the Compiled Python File that was created during import -- extension pyc. Then import again. It seems to me (I'm a novice too) that, when you import a module, Python automatically compiles it. Then when you import it later, the compiled version is imported if it exists. "Amir Dek

Re: better lambda support in the future?

2004-12-18 Thread Doug Holton
Jason Zheng wrote: I'm wondering why python still has limited lambda support. What's stopping the developers of python to support more lisp-like lambda function? See boo and its support for closures: http://boo.codehaus.org/ http://boo.codehaus.org/Closures It works with "def" or "do", or single-

Re: ActiveState Python 2.4 Woes

2004-12-18 Thread Chuck
Just installed Python 2.4 (from Python.org) and the Win32 extesions (from Mark's site) and am now having NO problems. I'll report more info as I experience it. -- http://mail.python.org/mailman/listinfo/python-list

Re: How to set condition breakpoints?

2004-12-18 Thread Dieter Maurer
"Christopher J. Bottaro" <[EMAIL PROTECTED]> writes on Fri, 10 Dec 2004 11:45:19 -0600: > ... > Hmm, thanks for the suggestions. One more quick question. Is it even > possible to set a breakpoint in a class method in pdb.py? I can't even say > "break Class.f" without the condition. I don't thi

ActiveState Python 2.4 Woes

2004-12-18 Thread Chuck
I am having a lot of problems with this distribution. Is anyone else? Among many, many problems in the debugger I also see the error below when I start PythonWin using the context menu when selecting a python file in the windows shell explorer. Anyone having this problem? I done a complete unins

Re: better lambda support in the future?

2004-12-18 Thread Terry Reedy
"Bengt Richter" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > On Sat, 18 Dec 2004 03:05:08 -0500, "Terry Reedy" <[EMAIL PROTECTED]> > wrote: >>To avoid the redundancy of 'a' and '_a', etc, how about (untested): >> >>def dispvia(f): >> dispatch[f.__name__.split('_')[1]] = f >> r

Re: A rational proposal

2004-12-18 Thread Terry Reedy
"Mike Meyer" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] >>> Title: A rational number module for Python >> 1. I would call this Not Necessary but Nice. Perhaps the time has come to include rationals in the Standard Library, given that its expansion will be a focus of the 2.5

Re: A rational proposal

2004-12-18 Thread Mike Meyer
Jp Calderone <[EMAIL PROTECTED]> writes: > They do handle decimals. They handle any object which define __cmp__, > or the appropriate rich comparison methods. That settles that. They're gone from the proposal. So is the method inverse, as that's simply 1/rational.

Re: A rational proposal

2004-12-18 Thread Tim Peters
[Jp Calderone] ... > The Decimal type seems to define min and max so that NaNs > can be treated specially, but I glean this understanding from only > a moment of reading decimal.py. Perhaps someone more well > informed can declare definitively the purpose of these methods. To conform to the sema

Re: A rational proposal

2004-12-18 Thread Jp Calderone
On Sat, 18 Dec 2004 12:40:04 -0600, Mike Meyer <[EMAIL PROTECTED]> wrote: >"John Roth" <[EMAIL PROTECTED]> writes: > > > "Mike Meyer" <[EMAIL PROTECTED]> wrote in message > > news:[EMAIL PROTECTED] > >> PEP: XXX > >> Title: A rational number module for Python > >> The ``Rational`` class shall defi

Re: A rational proposal

2004-12-18 Thread Jp Calderone
On Sat, 18 Dec 2004 12:29:10 -0600, Mike Meyer <[EMAIL PROTECTED]> wrote: >"Raymond L. Buvel" <[EMAIL PROTECTED]> writes: > > > Mike Meyer wrote: > >> PEP: XXX > >> Title: A rational number module for Python > > > > > > I think it is a good idea to have rationals as part of the standard > > distr

example code sought

2004-12-18 Thread Sean McIlroy
There's something quite simple I'd like to do, but I'm hampered by lack of knowledge regarding Tkinter. If someone could help me out with a snippet of maximally-simple code showing, in general terms, how to do this, that would be really great. What I want to do is simply to move a shape around on t

Re: A rational proposal

2004-12-18 Thread Mike Meyer
"John Roth" <[EMAIL PROTECTED]> writes: > "Mike Meyer" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] >> PEP: XXX >> Title: A rational number module for Python >> The ``Rational`` class shall define all the standard mathematical >> operations: addition, subtraction, multiplication,

Re: A rational proposal

2004-12-18 Thread Mike Meyer
"Raymond L. Buvel" <[EMAIL PROTECTED]> writes: > Mike Meyer wrote: >> PEP: XXX >> Title: A rational number module for Python > > > I think it is a good idea to have rationals as part of the standard > distribution but why not base this on the gmpy module > (https://sourceforge.net/projects/gmpy)?

Re: BASIC vs Python

2004-12-18 Thread It's me
Does this one count? http://hacks.oreilly.com/pub/h/2630 "Jan Dries" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Michael Hoffman wrote: > > Gregor Horvath wrote: > > > > > Or make any given standard python object accessible from MS Excel in 2 > > > minutes. > > > > from win32

Re: A rational proposal

2004-12-18 Thread John Roth
"Mike Meyer" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] PEP: XXX Title: A rational number module for Python Version: $Revision: 1.4 $ Last-Modified: $Date: 2003/09/22 04:51:50 $ Author: Mike Meyer <[EMAIL PROTECTED]> Status: Draft Type: Staqndards Content-Type: text/x-rst Created:

RE: Cool object trick

2004-12-18 Thread Robert Brewer
Bengt Richter wrote: > >>> m=type('',(),{})() > >>> m.title = 'not so fast ;-)' > >>> m.title > 'not so fast ;-)' Now THAT is a cool object trick. :) FuManChu -- http://mail.python.org/mailman/listinfo/python-list

Re: Maven like tool?

2004-12-18 Thread John Roth
"Byron Saltysiak" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] Hi, I'm new to Python and looking to run a large project that would need automated builds and project reports such as unit test coverage. Maven is a great Java software to do this - but is there something I should use fo

Re: BASIC vs Python

2004-12-18 Thread It's me
"Jan Dries" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Michael Hoffman wrote: > > Gregor Horvath wrote: > > > > > Or make any given standard python object accessible from MS Excel in 2 > > > minutes. > > > > from win32com.client import Dispatch > > > > xlApp = Dispatch("Excel.

Re: os.walk bug?

2004-12-18 Thread Alex Martelli
Adam DePrince <[EMAIL PROTECTED]> wrote: > Each iteration of os.walk returns three parameters; one of those, dirs, > is a list of directories within the current directory pointed at by > root. Yes, it does. > Am I correct to assume that you beleve that by changing the contents of > dir you will

Re: A rational proposal

2004-12-18 Thread Raymond L. Buvel
Mike Meyer wrote: PEP: XXX Title: A rational number module for Python I think it is a good idea to have rationals as part of the standard distribution but why not base this on the gmpy module (https://sourceforge.net/projects/gmpy)? That module already provides good performance. However, it d

Re: better lambda support in the future?

2004-12-18 Thread Robin Becker
Terry Reedy wrote: "Jp Calderone" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] On Fri, 17 Dec 2004 18:16:08 -0500, Terry Reedy <[EMAIL PROTECTED]> wrote: . For one-off uses not eligible for lambda treatment, where you really do not care about the name, use the same name, such

Re: DNS.DiscoverNameServer query

2004-12-18 Thread Steve Holden
Fredrik Lundh wrote: Hi Michael eh? where can I get the DNS packag for Python - I haven't been able to find it so far. googling for "python dns" brings up links to: http://www.digitallumber.com/oak (server) http://sourceforge.net/projects/pydns/ (client library) among the first few hits

Re: DNS.DiscoverNameServer query

2004-12-18 Thread Fredrik Lundh
> Hi Michael eh? > where can I get the DNS packag for Python - I haven't been able > to find it so far. googling for "python dns" brings up links to: http://www.digitallumber.com/oak (server) http://sourceforge.net/projects/pydns/ (client library) among the first few hits -- but those

Maven like tool?

2004-12-18 Thread Byron Saltysiak
Hi, I'm new to Python and looking to run a large project that would need automated builds and project reports such as unit test coverage. Maven is a great Java software to do this - but is there something I should use for Python? I did some searching on SF and this list but can't figure out what t

DNS.DiscoverNameServer query

2004-12-18 Thread hs
Hi Michael   where can I get the DNS packag for Python - I haven't been able to find it so far.   Thanks a lot and best regards.   Herbert -- http://mail.python.org/mailman/listinfo/python-list

Re: BASIC vs Python

2004-12-18 Thread Jan Dries
Michael Hoffman wrote: Gregor Horvath wrote: > Or make any given standard python object accessible from MS Excel in 2 > minutes. from win32com.client import Dispatch xlApp = Dispatch("Excel.Application") xlApp.Visible = 1 xlApp.Workbooks.Add() xlApp.ActiveSheet.Cells(1,1).Value = 'Python Rules!'

Re: Why are tuples immutable?

2004-12-18 Thread Roy Smith
Nick Coghlan <[EMAIL PROTECTED]> wrote: [quoting from the Reference Manual] > If a class defines mutable objects and implements a __cmp__() > or __eq__() method, it should not implement __hash__(), since the dictionary > implementation requires that a key's hash value is immutable (if the object'

Re: BASIC vs Python

2004-12-18 Thread Michael Hoffman
Gregor Horvath wrote: > Or make any given standard python object accessible from MS Excel in 2 > minutes. from win32com.client import Dispatch xlApp = Dispatch("Excel.Application") xlApp.Visible = 1 xlApp.Workbooks.Add() xlApp.ActiveSheet.Cells(1,1).Value = 'Python Rules!' xlApp.ActiveWorkbook.Acti

Re: BASIC vs Python

2004-12-18 Thread Alan Gauld
On Sat, 18 Dec 2004 08:41:46 +0100, Gregor Horvath <[EMAIL PROTECTED]> wrote: > That means that you can set a breakpoint. While the debugger stops you > can edit the sourcecode (to some extent) without stopping program > execution and let the interpreter run this new code without restarting > t

Re: PyCrust: What am I suppose to do?

2004-12-18 Thread Jim Sizelove
It's me wrote: I am trying out PyCrust and at a lost what to do next. With the previous IDE I tried, the IDE pops up the console and the editor. From the editor, I can set up breakpoints and debug and so forth. Yes, I can even run the script. With PyCrust, the nice looking 3-pane window pops up

Re: Troubleshooting: re.finditer() creates object even when no match found

2004-12-18 Thread Michael Hoffman
Steven Bethard wrote: first, iterable = peek(iterable) I really like this as a general solution to a problem that bothers me occasionally. IMHO it's much better than having UndoFiles or similar things lying about for every use case. Thanks! -- Michael Hoffman -- http://mail.python.org/mailman/li

Re: Is this a good use for lambda

2004-12-18 Thread Michael Hoffman
Charlie Taylor wrote: flow = integrate(lambda x: 2.0*pi * d(x)* v(x) * sin(a(x)),xBeg, xEnd) def _flow_func(x): return 2.0 * pi * d(x) * v(x) * sin(a(x)) flow = integrate(_flow_func, xBeg, xEnd) root = findRoot(xBeg, xEnd, lambda x: y2+ lp*(x-x2) -wallFunc( x )[0], tolerance=1.0E-15) d

Re: setup.py - just what is it for ?

2004-12-18 Thread richardshea
OK thanks for the idea. I have tried this with rather strange restults. First, in order to be sure I knew what was going on, I wrote a script, SpawnvTestTarget0.py, which didn't do much apart from write to a file. I then wrote another script which spawnv'd SpawnvTestTarget0.py from within the CGI

Re: expression form of one-to-many dict?

2004-12-18 Thread Steven Bethard
Fredrik Lundh wrote: Steven Bethard wrote: The map form, in this case, parses instantly in my brain, while the listcomp certainly takes a few cycles. And note that I'm not talking about the typing conciseness, but about the effort for my brain. But maybe I'm just wired funny :) Well, different at

Re: Troubleshooting: re.finditer() creates object even when no match found

2004-12-18 Thread Steven Bethard
Nick Coghlan wrote: Nick Coghlan wrote: Chris Lasher wrote: Hello, I really like the finditer() method of the re module. I'm having difficulty at the moment, however, because finditer() still creates a callable-iterator oject, even when no match is found. This is undesirable in cases where I would

Re: problem to compile a win32 module with Python2.4

2004-12-18 Thread Fredrik Lundh
"vincent delft" wrote: > I've a module written in C and the associated setup.py. > Work fine (and compile fine with mvc) with Python 2.3.x > > Now I've installed Python 2.4 (all the rest unchanged) > When I try to compile it, I've got a message saying that .NET SDK must be > installed. the m

problem to compile a win32 module with Python2.4

2004-12-18 Thread vincent delft
I've a module written in C and the associated setup.py. Work fine (and compile fine with mvc) with Python 2.3.x Now I've installed Python 2.4 (all the rest unchanged) When I try to compile it, I've got a message saying that .NET SDK must be installed. Am I the only one having this problem (n

Re: better lambda support in the future?

2004-12-18 Thread Bengt Richter
On Sat, 18 Dec 2004 03:05:08 -0500, "Terry Reedy" <[EMAIL PROTECTED]> wrote: > >"Bengt Richter" <[EMAIL PROTECTED]> wrote in message >news:[EMAIL PROTECTED] >> Looks like your standard pattern could be updated: >> >> >>> dispatch = {} >> >>> >> >>> def dispvia(name): >> ... def _(f, name=name

Re: better lambda support in the future?

2004-12-18 Thread Dima Dorfman
On 2004-12-18, Terry Reedy <[EMAIL PROTECTED]> wrote: > > "Dima Dorfman" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] >> Both languages compile all three functions (f and the two versions of >> g) once and choose which g to return at run-time. > > *If* OCaml or any other 'other' l

Re: Why are tuples immutable?

2004-12-18 Thread Terry Reedy
"Nick Coghlan" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Although, it looks like new-style classes currently don't apply this > rule - you get the default hash implementation from object no matter > what: > > Py> class NotHashable(object): > ... def __cmp__(self, other):

Re: better lambda support in the future?

2004-12-18 Thread Nick Coghlan
Terry Reedy wrote: To avoid the redundancy of 'a' and '_a', etc, how about (untested): def dispvia(f): dispatch[f.__name__.split('_')[1]] = f return f A similar idea: Py> class DispatchTable(dict): ... def __init__(self, prefix=""): ... self._prefix = prefix ... self._ignored = len(pr

Re: Cool object trick

2004-12-18 Thread Fredrik Lundh
Bengt Richter wrote: > >>> m = object() > >>> m.title = 'not so fast ;-)' > Traceback (most recent call last): > File "", line 1, in ? > AttributeError: 'object' object has no attribute 'title' >>> m = object() >>> m.title = 'yeah, that's stupid' Traceback (most recent call last): File "", li

Re: Is this a good use for lambda

2004-12-18 Thread Terry Reedy
"Charlie Taylor" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > > I find that I use lambda functions mainly for callbacks to things like > integration or root finding routines as follows. > > flow = integrate(lambda x: 2.0*pi * d(x)* v(x) * sin(a(x)),xBeg, xEnd) > > root = findRoot

Re: Cool object trick

2004-12-18 Thread Bengt Richter
On Sat, 18 Dec 2004 08:39:47 +0100, "Fredrik Lundh" <[EMAIL PROTECTED]> wrote: >Carl Banks wrote: > >> For example: >> >> .def lookup_reference(key): >> . >> .return Bunch(title=title,author=author,...) >> >> The code quickly and easily returns a object with the desired key

Re: BASIC vs Python

2004-12-18 Thread Gregor Horvath
Andrew Dalke wrote: Huh? I'm talking about my views of myself. I said that BASIC was a programming language I could learn without access to anyone else, on a microcomputer circa 1982. All I had was the book that came with the computer, and after a while a book on BASIC games. The machine I had w

Re: better lambda support in the future?

2004-12-18 Thread Terry Reedy
"Bengt Richter" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Looks like your standard pattern could be updated: > > >>> dispatch = {} > >>> > >>> def dispvia(name): > ... def _(f, name=name): > ... dispatch[name] = f > ... return f > ... return _ > ... > >

Re: BASIC vs Python

2004-12-18 Thread Gregor Horvath
Adam DePrince wrote: On Fri, 2004-12-17 at 09:25, Steve Holden wrote: Or make any given standard python object accessible from MS Excel in 2 minutes. What you describe is a political, not technical, challenge. What I describe is a daily costumer demand. Like or not, the world uses Excel and co