Re: Is Python like VB?

2005-03-16 Thread Ville Vainio
> "Cappy" == Cappy2112 <[EMAIL PROTECTED]> writes: Cappy> VB has a much better IDE than the IDE's for Python, Cappy> although Eric3 is one of the best, and is absolutely free. Eric3 is not easily available for win32, due to current state of Qt licensing (will change with Qt4 I think)

HELP: Bitmaps Using Tkinter ?

2005-03-16 Thread Peter Moscatt
When placing an image onto a button object with: b=Button(root,bitmap="@image.xbm") Do I have to use a XBM or are there other formats that I can use ? Pete -- http://mail.python.org/mailman/listinfo/python-list

Re: Getting current variable name

2005-03-16 Thread Ron
pl wrote: Hi all, I followed the mails entitled 'How to turn a variable name into a string?' in march 2005 posts as I have a similar problem. Use the locals() function instead of globals(). Thanks by the way, I was wondering how to do this also, your post, and Daniel pointing out 'is', helped me w

Re: Lisp-likeness

2005-03-16 Thread Ville Vainio
> "Michele" == michele simionato <[EMAIL PROTECTED]> writes: Michele> But then why he agreed to have the loop variable Michele> disappear outside a generator comprehension? I think Michele> there is something more than a backward compatibility Michele> concern. With normal fo

Re: Is Python like VB?

2005-03-16 Thread Harlin Seritt
"Would Python meet our requirements? " Yes and no. Because Python is a very high-level language and dynamically typed it is easy to learn. Python doesn't make use of pointers but you are able to write object-oriented code (as opposed to just being object-friendly like Visual Basic is). You will fi

Calling the C API from Python and Python program from same C API - bidirectional

2005-03-16 Thread Praveen, Tayal (IE10)
Hi Guys, I am having problems in the following C API program where myOtim_system is callable from python function. The module is listed below - static PyObject * myOptim_system(PyObject *self, PyObject *args) { const char *command; double u0, v0, u1, v1, u2, v2, u3, v3; int sts;

Re: Is Python like VB?

2005-03-16 Thread Cappy2112
First of all, discontinuing VB doesn't mean you have to stop using it. I worked on a project which was compiled with Visual C 1.52, for many years after it was not supported. The project is used by nearly every engineer at the company where I work. We are still devleoping the project I work on now

Re: code for Computer Language Shootout

2005-03-16 Thread Raymond Hettinger
> > . import string, itertools, sys > > . > > . t = string.maketrans('ACBDGHKMNSRUTWVYacbdghkmnsrutwvy', > > . 'TGVHCDMKNSYAAWBRTGVHCDMKNSYAAWBR') > > . > > . for h,b in itertools.groupby( file(sys.argv[1]), lambda x: x[0] in > > ">;" ): > > . if h: > > . print "".j

Re: Itertools wishlists

2005-03-16 Thread Raymond Hettinger
>itertools.window() with n=2 got rejected. Almost all proposed uses had better > >solutions (such as an accumulator variable or fibonacci sequence style logic: > >a, b = b, a+b). Writing it in C afforded only small speed advantage over a > >solution using izip() and tee(). [Christos TZOTZIOY Geo

Re: wxPython vs. pyQt

2005-03-16 Thread Simon John
I used to be a wxPython lover, but it was mainly due to the crappy PyQt licensing terms, rather than any merits of wx (although I like the native LnF). After trying to do a large-ish project using wxPython, I found that I was limited by the lack of widgets and the layout system. My latest project

Linking problems under irix6 with embedded Python2.4

2005-03-16 Thread Wolfgang
I have a problem with linking my CPP Code under a irix6 machine (sgi, UNIX). In my CPP code I use some Functions which are written in Python. So its a kind of CPP wrapper for my Python functions In my Python Code I use threads to communicate over the network and stuff like this. Compilation and lin

Re: Turning String into Numerical Equation

2005-03-16 Thread Steven Bethard
Giovanni Bajo wrote: Then, I should start my usual rant about how is really sad to send patches to Python and have them ignored for years (not even an acknowledge). Really sad. This is why I'm not going to do that again. I don't know the last time you read python-dev, but a number of the senior Py

Is Python like VB?

2005-03-16 Thread Mike Cox
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 means that it doesn't have all the hard stuff like pointers, classes and templat

ANNOUNCE: wxPython 2.5.4.1

2005-03-16 Thread Robin Dunn
Announcing -- I'm pleased to announce the 2.5.4.1 release of wxPython, now available for download at http://wxpython.org/download.php What is wxPython? - wxPython is a GUI toolkit for the Python programming language. It allows Python programmers to create programs with a rob

Re: RotatingFileHandler and logging config file

2005-03-16 Thread Bengt Richter
On Wed, 16 Mar 2005 20:48:40 -0800, Rob Cranfill <[EMAIL PROTECTED]> 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,

Re: wxPython vs. pyQt

2005-03-16 Thread Scott Frankel
I have just started using wxPython. I selected it over pyQT for licensing reasons. I'm no gui app expert. But that said, I've found the toolkit approachable and the user community very helpful. Scott On Mar 16, 2005, at 9:11 PM, [EMAIL PROTECTED] wrote: I've narrowed down my toolkit selection

wxPython vs. pyQt

2005-03-16 Thread eholbroo
I've narrowed down my toolkit selection for my project to wxPython and pyQt, and now i'd like to hear any opinions, war stories, peeves, etc, about them, particularly from anyone who's used _both_toolkits_. I'm only mildly interested in the IDEs and UI designers for each, as i want to do as much as

Re: RotatingFileHandler and logging config file

2005-03-16 Thread Rob Cranfill
Peter Hansen wrote: The missing piece of the puzzle might be the connection between the 'args' in the config file and the arguments passed to the __init__ method of the class Yes, I can puzzle out the constructor args ("constructor", heh heh, must be a Java Man) but it's how to get it to do a

Re: RotatingFileHandler and logging config file

2005-03-16 Thread Rob Cranfill
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 RotatingFileH

Re: How to create stuffit files on Linux?

2005-03-16 Thread James Stroud
Your users are, what me might call, "ignorant luddites". The built in 'File->Create Archive' command produces a zip file in OSX. I propose that zip is indeed the native compressed format. Perhaps you should install OS 7.5 on their machines (c. 1993) to make them feel more comfortable. James O

Re: How to create stuffit files on Linux?

2005-03-16 Thread Noah
The problem is that my users want to see .sit files. I know it's sort of silly. Zip files are foreign and frightening to them. I mentioned zip files, but they didn't want to deal with them. Is there a native OS X archive or package format? Obviously it must have tar and gzip installed, but I wonde

Re: Lisp-likeness

2005-03-16 Thread michele . simionato
But then why he agreed to have the loop variable disappear outside a generator comprehension? I think there is something more than a backward compatibility concern. Michele Simionato -- http://mail.python.org/mailman/listinfo/python-list

Re: Why tuple with one item is no tuple

2005-03-16 Thread Jeremy Bowers
On Wed, 16 Mar 2005 17:28:51 -0800, James Stroud wrote: > On Wednesday 16 March 2005 04:45 pm, Robert Kern wrote: >> > This would be very unambiguous. >> >> Not entirely. >> >> > Then, the purity would manifest itself the naked comma being an empty >> > tuple. Think about the zen of: >> > >> > Â Â

Re: Python becoming less Lisp-like

2005-03-16 Thread news.sydney.pipenetworks.com
Jeff Shannon wrote: news.sydney.pipenetworks.com wrote: More in relation to the original topic, why can't people just ignore features they don't understand and may never use directly. Because they may get stuck maintaining code that uses those features. Now, I'm generally in agreement with you

Re: ElementTree, how to get the whole content of a tag

2005-03-16 Thread Damjan
>> Is there any way I could get everything between the and tag? >> >> >> text >> some other text >> and then some more >> gettext(et) > '\n text\n some other text\n and then some more\n' I acctually need to get '\n text\n some other text\n and then some more\n' And if there we

Re: Lisp-likeness

2005-03-16 Thread Greg Ewing
Michele Simionato wrote: However this approach has a drawback (which is not there in Scheme, since Scheme has set!): if a new scope was created at each iteration (which is what the function call is doing) we could not reassign variables (i.e. they would become names locals to the "for" scope, touch

Re: code for Computer Language Shootout

2005-03-16 Thread Jacob Lee
On Wed, 16 Mar 2005 16:45:53 -0800, bearophileHUGS wrote: > Michael Spencer's version is nice, this is a bit shortened version. The > main() isn't useful for this very short loop, and you can use shorter > variable names to make lines shorter (this code isn't much readable, > it's just for the Sho

delny & qhull installed on Windows?

2005-03-16 Thread Jochen Schmidt
Hi There, Has anybody managed to install the Python delny package including qhull on windows? I tried and got a linker error back: C:\Program Files\Microsoft Visual Studio\VC98\BIN\link.exe /DLL /nologo /INCREMENTAL:NO /LIBPATH:C:\Python23\libs /LIBPATH:C:\Python23\PCBuild qhull.lib /EXPORT:ini

Re: Python becoming less Lisp-like

2005-03-16 Thread Jeremy Bowers
On Wed, 16 Mar 2005 16:35:57 -0600, Mike Meyer wrote: > The real problem is that newbies won't know which features are "meta" > features best left to experts, and which features are ok for everyday > programmers to use. > > We recently saw a thread (couldn't find it in google groups) where > some

Obfuscated Python: fun with shadowing builtins

2005-03-16 Thread Michael Hoffman
I was compelled to write this today for some reason. builtins = """__import__ abs basestring bool callable chr classmethod cmp compile complex delattr dict dir divmod enumerate eval execfile file filter float frozenset getattr globals hasattr hash help hex id input int isinstance issubclass iter le

Re: I can do it in sed...

2005-03-16 Thread Damjan
Or, much nicer > if line[:5]=='start': printing=1 if line.startswith('start'): printing=1 > if line[:3]=='end': printing=0 if line.endswith('end'): printing=0 -- damjan -- http://mail.python.org/mailman/listinfo/python-list

Re: Why tuple with one item is no tuple

2005-03-16 Thread James Stroud
On Wednesday 16 March 2005 04:45 pm, Robert Kern wrote: > > This would be very unambiguous. > > Not entirely. > > > Then, the purity would manifest itself the naked comma being an empty > > tuple. Think about the zen of: > > > >    , > > Is that a tuple or grit on my monitor?  :-) OK, OK, I'll giv

Re: I can do it in sed...

2005-03-16 Thread John Machin
Kotlin Sam wrote: > I have spent so much time using sed and awk that I think that way. Now, > when I have to do some Python things, I am having to break out of my > sed-ness and awk-ness, and it is causing me problems. I'm trying. Honest! > > Here are the two things that I'm trying to do: >

Re: I can do it in sed...

2005-03-16 Thread Terry Hancock
On Wednesday 16 March 2005 06:01 pm, Kotlin Sam wrote: > Here are the two things that I'm trying to do: > In sed, I can print every line between ^start to ^end by using > /^start/,/^end/p. It's quick, easy, and doesn't take much time. Is there > a way to do this easily in Python? You mea

Re: Why tuple with one item is no tuple

2005-03-16 Thread Robert Kern
James Stroud wrote: On Wednesday 16 March 2005 07:22 am, Diez B. Roggisch wrote: As I said: show me which parentheses to use I kind of like the comma as a tuple "parentheses" ,1,2,3, replacing (1,2,3) or 1,2,3, or 1,2,3 or (isn't this is getting out of hand?) (1,2,3,) Why not--except of course for

I can do it in sed...

2005-03-16 Thread Kotlin Sam
I have spent so much time using sed and awk that I think that way. Now, when I have to do some Python things, I am having to break out of my sed-ness and awk-ness, and it is causing me problems. I'm trying. Honest! Here are the two things that I'm trying to do: In sed, I can print every line be

Re: code for Computer Language Shootout

2005-03-16 Thread bearophileHUGS
Michael Spencer's version is nice, this is a bit shortened version. The main() isn't useful for this very short loop, and you can use shorter variable names to make lines shorter (this code isn't much readable, it's just for the Shootout, "production quality" code has probably to be more readable.

Re: Turning String into Numerical Equation

2005-03-16 Thread Giovanni Bajo
Steven Bethard wrote: >> In fact, the documentation for eval() could be improved to explain >> the benefits of setting __builtins__ in the globals. > > Well, if you think you're pretty clear on what's happening, a patch is > always appreciated. =) I have a feeling that the docs are at least > par

Re: Why tuple with one item is no tuple

2005-03-16 Thread James Stroud
On Wednesday 16 March 2005 07:22 am, Diez B. Roggisch wrote: > As I said: show me which parentheses to use I kind of like the comma as a tuple "parentheses" ,1,2,3, replacing (1,2,3) or 1,2,3, or 1,2,3 or (isn't this is getting out of hand?) (1,2,3,) Why not--except of course for backward comp

Re: computing a weighted sum

2005-03-16 Thread John Machin
Fernando Perez wrote: > [EMAIL PROTECTED] wrote: > > > Suppose I have a list of n floats x and a list of n floats w and I want > > to compute x[0]*w[0] + .. + x[n-1]*w[n-1]. > > > > Is there some elegant expression (perhaps using lambda) to have it done > > in one statement ? As in : > > y =

Re: code for Computer Language Shootout

2005-03-16 Thread Michael Spencer
Steven Bethard wrote: Michael Spencer wrote: def output(seq, linelength = 60): if seq: iterseq = iter(seq) while iterseq: print "".join(islice(iterseq,linelength)) Worth noting: "while iterseq" only works because for this case, you have a list iterator, which provi

RE: code for Computer Language Shootout

2005-03-16 Thread Delaney, Timothy C (Timothy)
Jacob Lee wrote: >> # alias methods to avoid repeated lookup >> join = ''.join I would actually do the alias here sometimes, but give it a semantically-useful name ... nosep_join = ''.join ... Tim Delaney -- http://mail.python.org/mailman/listinfo/python-list

Re: Why tuple with one item is no tuple

2005-03-16 Thread Daniel Dittmar
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 co

COM connection point

2005-03-16 Thread Oy Politics
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 prope

Re: Python becoming less Lisp-like

2005-03-16 Thread Mike Meyer
[EMAIL PROTECTED] (Paul Boddie) writes: > Steven Bethard <[EMAIL PROTECTED]> wrote in message news:<[EMAIL > PROTECTED]>... >> >> Certainly descriptors in the "wrong hands" could lead to confusing, >> unreadable code. But Python is a "we're all adults here" language, and >> so we have to trus

Re: ElementTree, how to get the whole content of a tag

2005-03-16 Thread Fredrik Lundh
Damjan <[EMAIL PROTECTED]> wrote: > Given the folowing XML snippet, I build an ElementTree instance with > et=ElementTree.fromstring(..). Now et.text returns just '\n text\n some > other text'. > Is there any way I could get everything between the and tag? > > > text > some other text > an

Re: When is a thread garbage collected?

2005-03-16 Thread "Martin v. Löwis"
Kent Johnson wrote: If I create and start a thread without keeping a reference to the thread, when is the thread garbage collected? When the last reference to the Thread disappears, which is definitely after the thread terminates. (Notice that this sentence uses the word thread twice: once to deno

Re: computing a weighted sum

2005-03-16 Thread Fernando Perez
[EMAIL PROTECTED] wrote: > Suppose I have a list of n floats x and a list of n floats w and I want > to compute x[0]*w[0] + .. + x[n-1]*w[n-1]. > > Is there some elegant expression (perhaps using lambda) to have it done > in one statement ? As in : > y = lambda x,w : ... > > I ask because t

Simple XML-to-Python conversion

2005-03-16 Thread [EMAIL PROTECTED]
I've been searching high and low for a way to simply convert a small XML configuration file to Python data structures. I came across gnosis XML tools, but need a built-in option for doing something similar. My knowledge of DOM and anything beyond simple XML structures is rudimentary at best. Is

ElementTree, how to get the whole content of a tag

2005-03-16 Thread Damjan
Given the folowing XML snippet, I build an ElementTree instance with et=ElementTree.fromstring(..). Now et.text returns just '\n text\n some other text'. Is there any way I could get everything between the and tag? text some other text and then some more -- damjan -- http://mail.p

Re: Listbox fill=BOTH expand=YES (Tkinter)

2005-03-16 Thread Raseliarison nirinA
"Christos TZOTZIOY Georgiou" wrote: > On Tue, 15 Mar 2005 16:48:17 +0300, > rumours say that [i] might have written: > > >yes, indeed. > import Tkconstants > 'True' and 'YES' in dir(Tkconstants) > >True > > > >thanks Harlin, > > I hope you also know that > > .>> 'inexistent keyword' and '

Re: Good use for Jython

2005-03-16 Thread Sean Blakey
On 15 Mar 2005 23:54:16 -0800, Mike Wimpe <[EMAIL PROTECTED]> wrote: > Other than being used to wrap Java classes, what other real use is > there for Jython being that Python has many other GUI toolkits > available? Also, these toolkits like Tkinter are so much better for > client usage (and faster

Re: multiple import of a load of variables

2005-03-16 Thread Jeff Shannon
Torsten Bronger wrote: HallÃchen! "Fuzzyman" <[EMAIL PROTECTED]> writes: [...] I'm not entirely clear what you are trying to do The following: "variables.py" looks like this a = 1 b = 2 Then I have helper_a.py, helper_b.py, and helper_c.py which begin with from variables import * And finally, my_

Re: iterable terminology (for language lawyers)

2005-03-16 Thread Raymond Hettinger
[R. Hettinger] > > You're best bet is to quote the tutorial's glossary, > > http://docs.python.org/tut/node18.html : [Michele Simionato] > Aha! That glossary looks like a nice new addition to the tutorial. > Maybe the standard library and the language > reference should link to it somewhere? (mayb

Re: getting data with proper encoding to the finish

2005-03-16 Thread John Machin
Ksenia Marasanova wrote: > John, Serge, thanks for your help! Thank *you* for having interesting problems :-) > > utf-16le encoding didn't help. I had however to solve it yesterday, > so I used csv module to create CSV file and then import it in Excel. > Excel still had troubles with accented ch

Re: importerror all 3rd party modules

2005-03-16 Thread John Machin
nyiann wrote: > Hi, > > Brand new to python. I am trying to install the py2exe modeule, and when > I run scripts (simple ones I've made, and examples) I get an importerror. > At the python command line I type: > import py2exe > and get: 'ImportError: no module named py2exe Aside: py2exe is used

Re: Python becoming less Lisp-like

2005-03-16 Thread Jeff Shannon
news.sydney.pipenetworks.com wrote: More in relation to the original topic, why can't people just ignore features they don't understand and may never use directly. Because they may get stuck maintaining code that uses those features. Now, I'm generally in agreement with you -- in general, Pytho

Re: Writing C readable bitfield structs?

2005-03-16 Thread phark52
Roy Smith wrote: > In article <[EMAIL PROTECTED]>, > Cappy2112 <[EMAIL PROTECTED]> wrote: > >there is a bitfiled mainpulator class inthe Cookbook, but I don't > >understand his explanation, and the example given doesn't really show > >off the features of the class. > > I assume you're talking abou

Re: code for Computer Language Shootout

2005-03-16 Thread Steven Bethard
Michael Spencer wrote: def output(seq, linelength = 60): if seq: iterseq = iter(seq) while iterseq: print "".join(islice(iterseq,linelength)) Worth noting: "while iterseq" only works because for this case, you have a list iterator, which provides a __len__ method.

Re: Jython Phone Interview Advice

2005-03-16 Thread George Jempty
Jeremy Bowers wrote: > On Tue, 15 Mar 2005 03:21:19 -0800, George Jempty wrote: > > I'm noticing that Javascript's array/"hash" literal syntax is EXACTLY the > > same as that for Python lists/dictionaries. > > No it isn't, quite. > > Two differences of note, one literally syntax and one technically

Re: __getitem__ method on (meta)classes

2005-03-16 Thread Steven Bethard
Ron Garret wrote: Using a metaclass allows you to distinguish Fred the plumber from Fred the electrician. But that may or may not be what one actually wants. Not sure what you mean here. The non metaclass solution still has separate enum.item objects for each new enum. Consider your implementa

Re: Good use for Jython

2005-03-16 Thread Kent Johnson
Mike Wimpe wrote: Other than being used to wrap Java classes, what other real use is there for Jython being that Python has many other GUI toolkits available? Also, these toolkits like Tkinter are so much better for client usage (and faster) than Swing, so what would be the advantage for using Jyth

replace from end of string?

2005-03-16 Thread Brian van den Broek
Hi all, in writing my response to Mark Leeds' recent question about replacing text at the end of a string, I was moved to wonder if it wouldn't it be handy if the replace method of string instances did one of the following: took a negative integer for count and interpreted that as replace the

Re: newbie: modifying a string in python

2005-03-16 Thread Charles Hartman
You're right that the code you give will not have the desired effect, because strings (unlike lists) are immutable. But slicing comes to your rescue: for s in stks: s = s.strip() if s[-2:] == 'GR': s = s[:-2] + 'GF' -- though I'm sure more experienced people will offer more efficient solutions. Ch

newbie : modifying a string in python

2005-03-16 Thread Leeds, Mark
I want to modify a string in the following way :   for s in stks:   s = s.strip()   if ( s[-2:] == ‘GR’ ):   s[-2:]= ‘GF’   so, if the last two characters are GR, I want to change them to GF ( there will be other if statements also but I am just putting this one

Re: _conditionally_ returning to point where exception was raised?

2005-03-16 Thread Skip Montanaro
>> ... The calling method detects the exception, but needs to get input >> from the user before deciding whether A.CalledMethod() should >> continue being executed or permantently stop/cancel the execution of >> the remaining code in A.CalledMethod(). Can this be done? Bengt>

Re: newbie : modifying a string in python

2005-03-16 Thread Brian van den Broek
Leeds, Mark said unto the world upon 2005-03-16 14:46: I want to modify a string in the following way : for s in stks: s = s.strip() if ( s[-2:] == 'GR' ): s[-2:]= 'GF' so, if the last two characters are GR, I want to change them to GF ( there will be other if statem

Re: Turning String into Numerical Equation

2005-03-16 Thread Michael Spencer
Giovanni Bajo wrote: Michael Spencer wrote: In fact, I believe my solution to be totally safe, That's a bold claim! I'll readily concede that I can't access func_globals from restricted mode eval (others may know better). But your interpreter is still be vulnerable to DOS-style attack from rogue

Re: Writing C readable bitfield structs?

2005-03-16 Thread Roy Smith
In article <[EMAIL PROTECTED]>, Cappy2112 <[EMAIL PROTECTED]> wrote: >there is a bitfiled mainpulator class inthe Cookbook, but I don't >understand his explanation, and the example given doesn't really show >off the features of the class. I assume you're talking about the struct module? If you gi

Re: Writing C readable bitfield structs?

2005-03-16 Thread Cappy2112
there is a bitfiled mainpulator class inthe Cookbook, but I don't understand his explanation, and the example given doesn't really show off the features of the class. I too need bit-level manipulation, and will probably have to write my own class to do it. -- http://mail.python.org/mailman/listi

When is a thread garbage collected?

2005-03-16 Thread Kent Johnson
If I create and start a thread without keeping a reference to the thread, when is the thread garbage collected? What I would like is for the thread to run to completion, then be GCed. I can't find anything in the docs that specifies this behavior; nor can I think of any other behaviour that seem

Re: _conditionally_ returning to point where exception was raised?

2005-03-16 Thread Bengt Richter
On 16 Mar 2005 09:53:11 -0800, "MackS" <[EMAIL PROTECTED]> wrote: >Hi > >I'm new to Python and would like to know if the following is possible. > >Say I have one lower-level object A and one user-interface object B. >Suppose B.CallingMethod() calls A.CalledMethod(), the latter method >stumbles upo

Re: _conditionally_ returning to point where exception was raised?

2005-03-16 Thread infidel
There's no "Resume Next" in python. Once you catch an exception, the only way you can go is forward from that point. So if B.CallingMethod catches an exception that was raised in A.CalledMethod, all it could do is try calling A.CalledMethod again, it can't jump back to the point where the excepti

Access denied calling FireEvent in Python

2005-03-16 Thread calfdog
Hello, Does anyone know a workaround for calling fireEvent. With the latest from Microsoft OS XP2 and Hot fixes to IE it now gives an "access denied" error in Python when called. Here is what I am trying to do: Set the "campus" listbox value and theb call fire event, such as in the code below. I

Re: compiled open source Windows lisp (was Re: Python becoming less Lisp-like)

2005-03-16 Thread Brandon J. Van Every
Carl Shapiro wrote: > "Brandon J. Van Every" <[EMAIL PROTECTED]> > writes: > >> Last I looked, 2 years ago?, there were no compiled, open source >> lisps that ran on Windows. Has this changed? > > I have a virtually completed port of CMUCL to Win32. [etc] Ah, so you're the brave lad I heard abou

importerror all 3rd party modules

2005-03-16 Thread nyiann
Hi, Brand new to python. I am trying to install the py2exe modeule, and when I run scripts (simple ones I've made, and examples) I get an importerror. At the python command line I type: import py2exe and get: 'ImportError: no module named py2exe So installed everything on my laptop (windows me)

Re: Python becoming less Lisp-like

2005-03-16 Thread Kay Schluehr
Torsten Bronger wrote: > Hallöchen! Moin! > [First, I wanted to say "descriptors" instead of "decorators" (I > superseded my post).] > > The goal is to trigger function calls when attributes are accessed. > This is called properties in C# (and maybe in Ruby, too). Python > now also has this conc

Re: code for Computer Language Shootout

2005-03-16 Thread Michael Spencer
F. Petitjean wrote: Le Tue, 15 Mar 2005 23:21:02 -0800, Michael Spencer a écrit : def output(seq, linelength = 60): if seq: iterseq = iter(seq) while iterseq: print "".join(islice(iterseq,linelength)) I suppose you mean : print "".join( str(item) for item

Re: [OT] Who Knows of a Good Computational Physics Textbook?

2005-03-16 Thread Dan Sommers
Thank you beliavsky, Sean, and Scott for the pointers. Regards, Dan -- Dan Sommers Îâ à Îâ à c = 1 -- http://mail.python.org/mailman/listinfo/python-list

Re: will it cause any problems to open a read-only file & not close it?

2005-03-16 Thread Jeff Shannon
Tim Roberts wrote: Sara Khalatbari <[EMAIL PROTECTED]> wrote: Dear friends In a code, I'm opening a file to read. Like : lines = open(filename).readlines() & I'm never closing it. I'm not writing in that file, I just read it. Will it cause any problems if you open a file to read & never close it

_conditionally_ returning to point where exception was raised?

2005-03-16 Thread MackS
Hi I'm new to Python and would like to know if the following is possible. Say I have one lower-level object A and one user-interface object B. Suppose B.CallingMethod() calls A.CalledMethod(), the latter method stumbles upon an IO error and raises an exception. The calling method detects the exce

Re: Writing C readable bitfield structs?

2005-03-16 Thread Larry Bates
[EMAIL PROTECTED] wrote: > How would I go about writing a bitfield that can be read by my C app? I > want to pack a few bools into one int. > > I know an extended module exists (npstruct) which helps you do this but > I want to do it manually or using one of the standard modules. > struct.pack is

Re: __getitem__ method on (meta)classes

2005-03-16 Thread Ron Garret
In article <[EMAIL PROTECTED]>, Steven Bethard <[EMAIL PROTECTED]> wrote: > Ron Garret wrote: > > In article <[EMAIL PROTECTED]>, > > Steven Bethard <[EMAIL PROTECTED]> wrote: > > > >>>Yeah, except I actually left out one thing: I also want type(v)==e1. > >> > >>Why? In Python usually you rel

Re: Mark attribute as read-only

2005-03-16 Thread Steven Bethard
Florian Lindner wrote: how can I mark a attribute of a class as read-only (for non classmembers)? Yes, stupid question, but the docu gave me no help. Declare it as such in the documentation. ;) If you want to provide error messages, you could alternatively define a property: py> class C(object):

Re: Minidom empty script element bug

2005-03-16 Thread Derek Basch
Cross post from XML-SIG: --- Walter Dörwald <[EMAIL PROTECTED]> wrote: > Martin v. Löwis sagte: > > Derek Basch wrote: > > >[...] > >> How do I get minidom to NOT render an empty script element? Should I > submit a bug report? > > > > That said, I think there is a simple solution: add an empty Tex

How to add a shapefile to an existing ArcMap 9.x project using Python?

2005-03-16 Thread syed_saqib_ali
Hi. I have an Instance of ArcMap 9.0 running. I also have a shapefile named myShape (actually corresponding to 4 files on the disk: myShape.dbf, myShape.shp, myShape.pnt and myShape.shx) I would like to write some Python code that inserts myShape into the running instance of ArcMap9.0 as

Re: computing a weighted sum

2005-03-16 Thread andreif
Even if language permits sum(x*w for x, w in zip(x, w)) would seem confusing for anyone watching the code Maybe sum(xi*wi for xi, wi in zip(x, w)) would be more appropiate Andrei -- http://mail.python.org/mailman/listinfo/python-list

[OT] Re: Python becoming less Lisp-like

2005-03-16 Thread Brian van den Broek
news.sydney.pipenetworks.com said unto the world upon 2005-03-16 05:57: trust the guy to do a good job. If you don't, then you can write it yourself which means you can do exactly how you want it which again makes the whole argument mute. Anyone else having images of mimes engaged in street figh

Mark attribute as read-only

2005-03-16 Thread Florian Lindner
Hello, how can I mark a attribute of a class as read-only (for non classmembers)? Yes, stupid question, but the docu gave me no help. Thanks, Florian -- http://mail.python.org/mailman/listinfo/python-list

Writing C readable bitfield structs?

2005-03-16 Thread phark52
How would I go about writing a bitfield that can be read by my C app? I want to pack a few bools into one int. I know an extended module exists (npstruct) which helps you do this but I want to do it manually or using one of the standard modules. -- http://mail.python.org/mailman/listinfo/python-

Re: Why tuple with one item is no tuple

2005-03-16 Thread Diez B. Roggisch
> I think he meant that Python should have introduced different operators > for addition and sequence concatenation. 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 + ? He could have use

Re: Why tuple with one item is no tuple

2005-03-16 Thread Steven Bethard
Daniel Dittmar wrote: But what the heck, I find list comprehension rather awful. Sacrilege! ;) STeVe -- http://mail.python.org/mailman/listinfo/python-list

Re: computing a weighted sum

2005-03-16 Thread Steven Bethard
Will McGugan wrote: In Python 2.3 sum( [ _x * _w for _x, _w in zip( x, w ) ] ) or in 2.4 sum( _x * _w for _x, _w in zip( x, w ) ) Any reason for the leading underscores? If you're trying to avoid polluting your namespace, you should note that generator expressions don't leak their loop variables

Re: Getting current variable name

2005-03-16 Thread Steven Bethard
pl wrote: I followed the mails entitled 'How to turn a variable name into a string?' in march 2005 posts as I have a similar problem. I have to get some list variable names at some point in my program. So I ended up looking into globals() to get them with a small function like this: #!/usr/bin/pyth

Re: Why tuple with one item is no tuple

2005-03-16 Thread Daniel Dittmar
Diez B. Roggisch 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. And no way in mathematics or

Re: computing a weighted sum

2005-03-16 Thread TZOTZIOY
On 16 Mar 2005 06:49:09 -0800, rumours say that [EMAIL PROTECTED] might have written: >Suppose I have a list of n floats x and a list of n floats w and I want >to compute x[0]*w[0] + .. + x[n-1]*w[n-1]. > >Is there some elegant expression (perhaps using lambda) to have it done >in one statement ?

Re: Turning String into Numerical Equation

2005-03-16 Thread Steven Bethard
Giovanni Bajo wrote: In fact, the documentation for eval() could be improved to explain the benefits of setting __builtins__ in the globals. Well, if you think you're pretty clear on what's happening, a patch is always appreciated. =) I have a feeling that the docs are at least partially vague b

Re: computing a weighted sum

2005-03-16 Thread andreif
Thanks Will, the 2.4 expression looks really nice. -- http://mail.python.org/mailman/listinfo/python-list

Re: Good use for Jython

2005-03-16 Thread Tom Willis
On 15 Mar 2005 23:54:16 -0800, Mike Wimpe <[EMAIL PROTECTED]> wrote: > Other than being used to wrap Java classes, what other real use is > there for Jython being that Python has many other GUI toolkits > available? Also, these toolkits like Tkinter are so much better for > client usage (and faster

Re: Why tuple with one item is no tuple

2005-03-16 Thread Diez B. Roggisch
> That ambiguity is only caused because python uses the same characters > for very different operations and to be honest I don't like that. As I said: show me which parentheses to use - and keep in mind that: - < and > are for comparisions and the same ambiguity troubles arise - unicode surely

  1   2   >