Re: how to get name of function from within function?

2005-06-04 Thread Christopher J. Bottaro
Steven Bethard wrote: [...snip...] Yes, has's suggestion is probably the right way to go here. I'm still uncertain as to your exact setup here. Are the functions you need to wrap in a list you have? Are they imported from another module? A short clip of your current code and what you want

Re: Scope

2005-06-04 Thread Terry Reedy
Elliot Temple [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] I want to write a function, foo, so the following works: def main(): n = 4 foo(n) print n #it prints 7 if foo needs to take different arguments, that'd be alright. Is this possible? No, you cannot

Re: any macro-like construct/technique/trick?

2005-06-04 Thread Paddy
If you still must have something like the c preprocessor then unix has m4 (and it seems there is a windows version http://gnuwin32.sourceforge.net/packages/m4.htm). The start of the doc reads: GNU M4 ** GNU `m4' is an implementation of the traditional UNIX macro processor. It is mostly

Re: For review: PEP 343: Anonymous Block Redux and Generator Enhancements

2005-06-04 Thread Andrew Dalke
Nicolas Fleury wrote: There's no change in order of deletion, it's just about defining the order of calls to __exit__, and they are exactly the same. BTW, my own understanding of this is proposal is still slight. I realize a bit better that I'm not explaining myself correctly. As far as I

Re: how to get name of function from within function?

2005-06-04 Thread Andrew Dalke
I'm with Steven Bethard on this; I don't know what you (Christopher J. Bottaro) are trying to do. Based on your example, does the following meet your needs? class Spam(object): ... def funcA(self): ... print A is called ... def __getattr__(self, name): ... if name.startswith(_): ...

Re: how to get name of function from within function?

2005-06-04 Thread Steven Bethard
Christopher J. Bottaro wrote: I haven't tried it yet, but this is what I would do with __call(): function __call($name, $args) { $name .= 'IMPL'; try { $this-$name($args); } except { # error handling; } } function funcA() { # do something } function funcBIMPL($a, $b) {

executing a command

2005-06-04 Thread andrea valle
Hi to all, I need to run a program from inside python (substantially, algorithmic batch processing). I'm on mac osx 10.3.8 with python 2.3 framework and macpython. Trying to use exec*, I checked references, Brueck Tanner, and then grab this code from effbot: program = python def

Re: Removing a warnings filter?

2005-06-04 Thread Torsten Bronger
Hallchen! Dave Benjamin [EMAIL PROTECTED] writes: Torsten Bronger wrote: When I add a warning filter with warnings.filterwarnings, how can I get rid of it? I've read about resetwarnings(), but it removes all filters, even those that I didn't install in a certain function. I have never

Re: [ANN] Snakelets 1.41 and Frog 1.6

2005-06-04 Thread thinfrog
It's very interesting, i'm glad to try. And it can access data by MYSQL/SQL or other database software? -- http://mail.python.org/mailman/listinfo/python-list

If - Or statements

2005-06-04 Thread Ognjen Bezanov
Another newbie-ish question. I want to create an if statement which will check if a particular variable matches one of the statements, and willl execute the statement if the variable matches any of the statements. I have tried the following (the pass is just used for testing) if ext[1] == mp3

Re: If - Or statements

2005-06-04 Thread Robert Kern
Ognjen Bezanov wrote: Another newbie-ish question. I want to create an if statement which will check if a particular variable matches one of the statements, and willl execute the statement if the variable matches any of the statements. I have tried the following (the pass is just used for

Re: For review: PEP 343: Anonymous Block Redux and Generator Enhancements

2005-06-04 Thread Robin Becker
Ilpo Nyyssönen wrote: ... with locking(mutex), opening(readfile) as input: ... with EXPR as x: BLOCK EXPR can be a tuple so the above would be ambiguous. -- Robin Becker -- http://mail.python.org/mailman/listinfo/python-list

SimpleXMLRPCServer security

2005-06-04 Thread Robin Becker
What are the security issues for an xmlrpc server with 127.0.0.1 as host? Clearly anyone with local access can connect to the server so we should protect the server and client code, but in my particular case the client starts as a cgi script and in general must be world readable/executable.

Re: If - Or statements

2005-06-04 Thread Ognjen Bezanov
Robert Kern wrote: Ognjen Bezanov wrote: Another newbie-ish question. I want to create an if statement which will check if a particular variable matches one of the statements, and willl execute the statement if the variable matches any of the statements. I have tried the following (the

Re: For review: PEP 343: Anonymous Block Redux and Generator Enhancements

2005-06-04 Thread Kent Johnson
Robin Becker wrote: Ilpo Nyyssönen wrote: with locking(mutex), opening(readfile) as input: ... with EXPR as x: BLOCK EXPR can be a tuple so the above would be ambiguous. I don't think EXPR can be a tuple; the result of evaluating EXPR must have __enter__() and __exit__()

[no subject]

2005-06-04 Thread Jatinder Singh
Hi guys I am working in a complex directory structure. I want to use a file (not .py) which is in some other directory. I couldn't do it.but if I copy the file in the same directory then it is working fine. Can anybody guide me how and where to add the path of the file. I have tried it with

Re: how to get name of function from within function?

2005-06-04 Thread Raymond Hettinger
[Christopher J. Bottaro] def myFunc(): print __myname__ myFunc() 'myFunc' Perhaps the __name__ attribute is what you want: def myFunc(): print myFunc.__name__ myFunc() myFunc -- http://mail.python.org/mailman/listinfo/python-list

Re: how to get name of function from within function?

2005-06-04 Thread Kent Johnson
Christopher J. Bottaro wrote: Steven Bethard wrote: [...snip...] Yes, has's suggestion is probably the right way to go here. I'm still uncertain as to your exact setup here. Are the functions you need to wrap in a list you have? Are they imported from another module? A short clip of your

Re: idiom for constructor?

2005-06-04 Thread Peter Dembinski
Steven Bethard [EMAIL PROTECTED] writes: Mac wrote: Is there a nice Python idiom for constructors which would expedite the following? class Foo: def __init__(self, a,b,c,d,...): self.a = a self.b = b self.c = c self.d = d ... py class Foo(object): ... def

Re: idiom for constructor?

2005-06-04 Thread Peter Dembinski
Peter Dembinski [EMAIL PROTECTED] writes: [snap] Eh, sorry, it should look like this: #v+ class A: def __init__(self, a, b, c, d): initial = {'a' : 1, 'b' : 2, 'c' : 3, 'd' : 4} initial = {'a' : a, 'b' : b, 'c' : c, 'd' : d} for param in

Re: If - Or statements

2005-06-04 Thread Robert Kern
Ognjen Bezanov wrote: Robert Kern wrote: Ognjen Bezanov wrote: Another newbie-ish question. I want to create an if statement which will check if a particular variable matches one of the statements, and willl execute the statement if the variable matches any of the statements. I have tried

ANN: eric3 3.7.0 released

2005-06-04 Thread Detlev Offenbach
Hi, this is to let all of you know about the release of eric3 3.7.0. Next to a bunch of bugfixes, it adds these features. - support for Ruby projects (debugger, syntax highlighting) - support for the generation of KDE UIs - introduction of watchpoints - added class browsers for Ruby and CORBA

Re: any macro-like construct/technique/trick?

2005-06-04 Thread Georges JEGO
Mac a écrit : # do some stuff if debug: emit_dbg_obj(DbgObjFoo(a,b,c)) Assuming your debug functions always return true, you could use: assert emit_dbg_obj(DbgObjFoo(a,b,c)) and have this code executed -or not- depending on the use of -O -- Georges --

Re: For review: PEP 343: Anonymous Block Redux and Generator Enhancements

2005-06-04 Thread Robin Becker
Kent Johnson wrote: Robin Becker wrote: Ilpo Nyyssönen wrote: with locking(mutex), opening(readfile) as input: ... with EXPR as x: BLOCK EXPR can be a tuple so the above would be ambiguous. I don't think EXPR can be a tuple; the result of evaluating EXPR must have

Re: For review: PEP 343: Anonymous Block Redux and Generator Enhancements

2005-06-04 Thread oren . tirosh
Ilpo Nyyssönen wrote: Nicolas Fleury [EMAIL PROTECTED] writes: def foo(): with locking(someMutex) with opening(readFilename) as input with opening(writeFilename) as output ... How about this instead: with locking(mutex), opening(readfile) as input: ... +1, and

Re: Software licenses and releasing Python programs for review

2005-06-04 Thread Steve Holden
Andreas Kostyrka wrote: On Thu, Jun 02, 2005 at 01:57:25AM -0700, Robert Kern wrote: And for thoroughness, allow me to add even if they have no intention or desire to profit monetarily. I can't explain exactly why this is the case, but it seems to be true in the overwhelming majority of

Re: any macro-like construct/technique/trick?

2005-06-04 Thread =?iso-8859-1?Q?Fran=E7ois?= Pinard
[Georges JEGO] Mac a écrit : # do some stuff if debug: emit_dbg_obj(DbgObjFoo(a,b,c)) Assuming your debug functions always return true, you could use: assert emit_dbg_obj(DbgObjFoo(a,b,c)) and have this code executed -or not- depending on the use of -O

Re: any macro-like construct/technique/trick?

2005-06-04 Thread =?iso-8859-1?Q?Fran=E7ois?= Pinard
[Paddy] If you still must have something like the c preprocessor then unix has m4 (and it seems there is a windows version http://gnuwin32.sourceforge.net/packages/m4.htm). The difficulty of `m4' for Python source is that macro expansions should be accompanied with proper adjustment of

Re: What are OOP's Jargons and Complexities?

2005-06-04 Thread Andrea Griffini
On Wed, 01 Jun 2005 23:25:00 +0200, Matthias Buelow [EMAIL PROTECTED] wrote: Of course it is a language, just not a standardized one (if you include Borland's extensions that make it practical). The history of runtime error 200 and its handling from borland is a clear example of what I mean with

Re: If - Or statements

2005-06-04 Thread rzed
Ognjen Bezanov [EMAIL PROTECTED] wrote in news:[EMAIL PROTECTED]: Robert Kern wrote: Ognjen Bezanov wrote: Another newbie-ish question. I want to create an if statement which will check if a particular variable matches one of the statements, and willl execute the statement if the

Walking through a mysql db

2005-06-04 Thread Jeff Elkins
I'm writing a small wxpython app to display and update a dataset. So far, I get the first record for display: try: cursor = conn.cursor () cursor.execute (SELECT * FROM dataset) item = cursor.fetchone () Now, how do I step through the dataset one row at a time? My form has

Re: If - Or statements

2005-06-04 Thread tiissa
Ognjen Bezanov wrote: ext = thefile.split('.') #get the file extension ext[1] = ext[1].lower() #convert to lowercase As a side note, ext[1] will be the first extension: 'foo.bar.ogg'.split('.')[1] 'bar' I'd advise ext[-1], the last element of the splitted

Re: Walking through a mysql db

2005-06-04 Thread Benjamin Niemann
Jeff Elkins wrote: I'm writing a small wxpython app to display and update a dataset. So far, I get the first record for display: try: cursor = conn.cursor () cursor.execute (SELECT * FROM dataset) item = cursor.fetchone () Now, how do I step through the dataset one

Re: Walking through a mysql db

2005-06-04 Thread wes weston
Jeff Elkins wrote: I'm writing a small wxpython app to display and update a dataset. So far, I get the first record for display: try: cursor = conn.cursor () cursor.execute (SELECT * FROM dataset) item = cursor.fetchone () Now, how do I step through the dataset one

Re: Walking through a mysql db

2005-06-04 Thread Jeff Elkins
On Saturday 04 June 2005 09:24 am, Jeff Elkins wrote: I'm writing a small wxpython app to display and update a dataset. So far, I get the first record for display: try: cursor = conn.cursor () cursor.execute (SELECT * FROM dataset) item = cursor.fetchone () Now, how do

Newbie Python XML

2005-06-04 Thread LenS
I have a situation at work. Will be receiving XML file which contains quote information for car insurance. I need to translate this file into a flat comma delimited file which will be imported into a software package. Each XML file I receive will contain information on one quote only. I have

Re: For review: PEP 343: Anonymous Block Redux and Generator Enhancements

2005-06-04 Thread Steven Bethard
Ilpo Nyyssönen wrote: How about this instead: with locking(mutex), opening(readfile) as input: ... I don't like the ambiguity this proposal introduces. What is input bound to? The return value of locking(mutex).__enter__() or the return value of opening(readfile).__enter__()?

Re: idiom for constructor?

2005-06-04 Thread Steven Bethard
Peter Dembinski wrote: class A: def __init__(self, a, b, c, d): initial = {'a' : a, 'b' : b, 'c' : c, 'd' : d} for param in initial.keys(): exec self.%s = initial['%s'] % (param, param) This is not a good use case for exec. Use setattr: for param in initial:

Re: For review: PEP 343: Anonymous Block Redux and Generator Enhancements

2005-06-04 Thread Nicolas Fleury
Andrew Dalke wrote: The implementation would need to track all the with/as forms in a block so they can be __exit__()ed as appropriate. In this case ghi.__exit() is called after jkl.__exit__() and before defg.__exit__ The PEP gives an easy-to-understand mapping from the proposed change to

Re: Newbie Python XML

2005-06-04 Thread Jerry Sievers
LenS [EMAIL PROTECTED] writes: I have a situation at work. Will be receiving XML file which contains quote information for car insurance. I need to translate this file into a flat comma delimited file which will be imported into a software package. Each XML file I receive will contain

Re: idiom for constructor?

2005-06-04 Thread Peter Dembinski
Steven Bethard [EMAIL PROTECTED] writes: Peter Dembinski wrote: class A: def __init__(self, a, b, c, d): initial = {'a' : a, 'b' : b, 'c' : c, 'd' : d} for param in initial.keys(): exec self.%s = initial['%s'] % (param, param) This is not a good use case for

Re: Scope

2005-06-04 Thread Ron Adam
Elliot Temple wrote: I want to write a function, foo, so the following works: def main(): n = 4 foo(n) print n #it prints 7 if foo needs to take different arguments, that'd be alright. Is this possible? It is possible if you pass mutable objects to foo such as lists

Re: Walking through a mysql db

2005-06-04 Thread Scott David Daniels
Jeff Elkins wrote: On Saturday 04 June 2005 09:24 am, Jeff Elkins wrote: ... Now, how do I step through the dataset one row at a time? My form has 'next' and 'back' buttons, and I'd like them to step forward or back, fetching the appropriate row in the table. I've tried setting cursor.rownumber

Re: Walking through a mysql db

2005-06-04 Thread Heiko Wundram
Am Samstag, 4. Juni 2005 17:23 schrieb Jeff Elkins: Within this same app, I've got a search function working, but I need the rownumber when a record is fetched. sql = select * from address where %s = %%s % arg1.lower() cursor.execute(sql, (arg2,)) item =

Re: Scope

2005-06-04 Thread Peter Dembinski
Elliot Temple [EMAIL PROTECTED] writes: I want to write a function, foo, so the following works: def main(): n = 4 foo(n) print n #it prints 7 if foo needs to take different arguments, that'd be alright. Is this possible? It is possible, but the more natural way would

Re: For review: PEP 343: Anonymous Block Redux and Generator Enhancements

2005-06-04 Thread Andrew Dalke
On Sat, 04 Jun 2005 10:43:48 -0600, Steven Bethard wrote: Ilpo Nyyssönen wrote: How about this instead: with locking(mutex), opening(readfile) as input: ... I don't like the ambiguity this proposal introduces. What is input bound to? It would use the same logic as the import

Re: [ANN] Snakelets 1.41 and Frog 1.6

2005-06-04 Thread Irmen de Jong
thinfrog wrote: It's very interesting, i'm glad to try. And it can access data by MYSQL/SQL or other database software? it meaning Snakelets, I assume. (because Frog, the blog server, doesn't use any database for storage) Snakelets does not contain ANY database connector. You can therefore

Re: how to get name of function from within function?

2005-06-04 Thread Christopher J. Bottaro
Steven Bethard wrote: ...snip... Something like this might work: py class C(object): ... def func_a(self): ... print func_a ... def func_b_impl(self): ... print func_b ... raise Exception ... def __getattr__(self, name): ... func =

using boost to return list

2005-06-04 Thread GujuBoy
i am trying to make a cpp file which will make an array and pass it to python as a list. how is this possible...i am using BOOST...please can someone point me at some examples thanks -- http://mail.python.org/mailman/listinfo/python-list

Re: how to get name of function from within function?

2005-06-04 Thread Christopher J. Bottaro
Kent Johnson wrote: ...snip... I guess I'm just lazy, but I don't want to write the wrapper func for each new func I want to add. I want it done automatically. You can do this almost automatically with a decorator: def in_try(func): def wrapper(*args, **kwargs): try:

Re: idiom for constructor?

2005-06-04 Thread Volker Grabsch
Peter Dembinski wrote: This is not a good use case for exec. Use setattr: OK, true. From the other side: what are the usual uses of 'exec'? An interactive Python interpreter. :-) No, seriously: Introspection is always better than exec. It is far less error phrone, especially because you

BayPIGgies: June 9, 7:30pm (IronPort)

2005-06-04 Thread Aahz
The next meeting of BayPIGgies will be Thurs, June 9 at 7:30pm at IronPort. Drew Perttula will discuss his Python-based lighting system controller. The system includes a music player, a variety of programs to design and time light cues, and drivers for hardware that outputs the DMX protocol used

Re: For review: PEP 343: Anonymous Block Redux and Generator Enhancements

2005-06-04 Thread Andrew Dalke
Nicolas Fleury wrote: I think it is simple and that the implementation is as much straight-forward. Think about it, it just means that: Okay, I think I understand now. Consider the following server = open_server_connection() with abc(server) with server.lock() do_something(server)

Komodo ide font color issue

2005-06-04 Thread meissnersd
Komodo ide font color issue I prefer a dark back ground with light text. So I edited my preferences and made a dark color scheme. I am using python and komodo is dumping exceptions out in the output window in red. Red text on a black background is awful. This does not change even when I set

Looking for help with a python-mode/pdbtrack/gdb patch

2005-06-04 Thread Skip Montanaro
Can someone who uses Emacs's python-mode, pdbtrack and gdb take a look at this simple but ancient patch: http://sourceforge.net/tracker/index.php?func=detailaid=785816group_id=86916atid=581351 As you'll see from the discussion, Barry had problems with it from XEmacs and was thinking of

Grand Challenge Pegasus Team: Programming Pegasus Bridge 1 ?

2005-06-04 Thread [EMAIL PROTECTED]
Folks, In a previous post[*] we made an announcement about the release of the drive-by-wire code for our entry in the DARPA Grand Challenge. We will do more in the future (including more data and more code). With regards to our building the full autonomous code, things are going along well.

Re: If - Or statements

2005-06-04 Thread Ognjen Bezanov
Robert Kern wrote: Ognjen Bezanov wrote: Robert Kern wrote: Ognjen Bezanov wrote: Another newbie-ish question. I want to create an if statement which will check if a particular variable matches one of the statements, and willl execute the statement if the variable matches any of the

Re: [Baypiggies] potluck for google meeting?

2005-06-04 Thread Shannon -jj Behrens
I'm a huge fan of potlucks, but I'm not entirely sure I'd trust the cooking of a bunch of engineers ;) -jj On 6/4/05, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: I know that typically you all meet somewhere for dinner beforehand.. or afterhand.. but I'd like to propose we try a potluck at the

Re: Walking through a mysql db

2005-06-04 Thread Jeff Elkins
Thanks for the replies! I went ahead and used the fetchall() approach and work with the array, writing changes back to the database. It's working fine. Jeff -- http://mail.python.org/mailman/listinfo/python-list

Re: decimal and trunkating

2005-06-04 Thread Facundo Batista
On 2 Jun 2005 23:34:52 -0700, Raymond Hettinger [EMAIL PROTECTED] wrote: i want to trunkate 199.999 to 199.99 getcontext.prec = 2 isn't what i'm after either, all that does is E's the value. do i really have to use floats to do this? The precision is the total number of digits (i.e

Re: For review: PEP 343: Anonymous Block Redux and Generator Enhancements

2005-06-04 Thread Steven Bethard
Andrew Dalke wrote: On Sat, 04 Jun 2005 10:43:48 -0600, Steven Bethard wrote: Ilpo Nyyssönen wrote: How about this instead: with locking(mutex), opening(readfile) as input: ... I don't like the ambiguity this proposal introduces. What is input bound to? It would use the same logic

Re: idiom for constructor?

2005-06-04 Thread Steven Bethard
Peter Dembinski wrote: From the other side: what are the usual uses of 'exec'? I have to say, I have yet to find a use for it. My intuition is that the good use cases for 'exec' have something to do with writing programs that allow users to interactively script the program actions. But I've

Re: how to get name of function from within function?

2005-06-04 Thread Steven Bethard
Christopher J. Bottaro wrote: Kent Johnson wrote: class C(object): @in_try def func_a(self): print func_a @in_try def func_b(self): print func_b raise Exception You could probably create a metaclass to apply the wrappers automatically but I like

Re: Scope

2005-06-04 Thread Steven Bethard
Peter Dembinski wrote: AFAIK inc is builtin function. And builtin functions doesn't have to be real functions, they can be just aliases to Python's VM bytecodes or sets of bytecodes. Wrong on both counts. ;) py inc Traceback (most recent call last): File interactive input, line 1, in ?

Re: For review: PEP 343: Anonymous Block Redux and Generator Enhancements

2005-06-04 Thread Andrew Dalke
Steven Bethard wrote: Ahh, so if I wanted the locking one I would write: with locking(mutex) as lock, opening(readfile) as input: ... That would make sense to me. There was another proposal that wrote this as: with locking(mutex), opening(readfile) as lock, input:

Q: functional/equational language, smells a little of Python

2005-06-04 Thread John J. Lee
Saw this on LWN: http://q-lang.sourceforge.net/ Looks interesting, and reminiscent of symbolic algebra systems like Mathematica. Also, the website mentions dynamic typing and Batteries Included, which made me think of Python. Damned silly name, though (perhaps pre-Google?). Anybody here used

csv and iterator protocol

2005-06-04 Thread Philippe C. Martin
Hi, I have the following working program: 1) I import data in csv format into internal data structures (dict + list) 2) I can export back to csv 3) I can store my internal data using pickle+bz2 4) I can reload it. Hovever I notice a factor 10 size loss using pickle. So I would like to

Re: using boost to return list

2005-06-04 Thread Neil Hodgson
GujuBoy: i am trying to make a cpp file which will make an array and pass it to python as a list. how is this possible...i am using BOOST...please can someone point me at some examples This returns a list when called from Python. static list retrieval_as_list(SplitText self, int

Re: weird cgi problem w/ apache

2005-06-04 Thread Chris Curvey
could it be the umask? -- http://mail.python.org/mailman/listinfo/python-list

Re: Controlling source IP address within urllib2

2005-06-04 Thread John J. Lee
Dan [EMAIL PROTECTED] writes: Does anybody know how to control the source IP address (IPv4) when using the urllib2 library? I have a Linux box with several IP addresses in the same subnet, and I want to simulate several individuals within that subnet accessing web pages independently. I

method = Klass.othermethod considered PITA

2005-06-04 Thread John J. Lee
It seems nice to do this class Klass: def _makeLoudNoise(self, *blah): ... woof = _makeLoudNoise One probably wants the above to work as if you'd instead defined woof in the more verbose form as follows: def woof(self, *blah): return self._makeLoudNoise(self, *blah) It

Problem on python 2.3.x was: [ANN] Snakelets 1.41 and Frog 1.6

2005-06-04 Thread Irmen de Jong
...darn, some users have reported that a strange problem occurs when running Snakelets 1.41 on Python 2.3.x (Python 2.4 is fine!) It seems that there is a bug in older versions of inspect.getmodule() and that bug causes Snakelets to stop working correctly on Python 2.3.x If you experience this

Re: weird cgi problem w/ apache

2005-06-04 Thread Rick Kwan
If it is umask, then that would be umask for the Apache process, not the second script (which I presume doesn't run as Apache). The CGI script can explicitly set the permissions when creating the folder using mkdir() or makedirs() so that others can write into it. (Depending on how public or

[no subject]

2005-06-04 Thread Robin Dunn
Announcing -- The 2.6.1.0 release of wxPython is now available for download at http://wxpython.org/download.php. Anybody keeping track will probably notice that the prior release (2.6.0.1) was released just about a week ago. This short turn-around time is because I was slow getting the

Re: method = Klass.othermethod considered PITA

2005-06-04 Thread Steven Bethard
John J. Lee wrote: It seems nice to do this class Klass: def _makeLoudNoise(self, *blah): ... woof = _makeLoudNoise Out of curiosity, why do you want to do this? 1. In derived classes, inheritance doesn't work right: class A: ... def foo(s):print 'foo' ... bar

Re: method = Klass.othermethod considered PITA

2005-06-04 Thread Leif K-Brooks
John J. Lee wrote: class Klass: def _makeLoudNoise(self, *blah): ... woof = _makeLoudNoise [...] At least in 2.3 (and 2.4, AFAIK), you can't pickle classes that do this. Works for me: Python 2.3.5 (#2, May 4 2005, 08:51:39) [GCC 3.3.5 (Debian 1:3.3.5-12)] on

ANN: wxPython 2.6.1.0

2005-06-04 Thread Robin Dunn
Announcing -- The 2.6.1.0 release of wxPython is now available for download at http://wxpython.org/download.php. Anybody keeping track will probably notice that the prior release (2.6.0.1) was released just about a week ago. This short turn-around time is because I was slow getting the

Sorted List (binary tree) why no built-in/module?

2005-06-04 Thread Alex Stapleton
Unless I've totally missed it, there isn't a binary tree/sorted list type arrangement in Python. Is there a particular reason for this? Sometimes it might be preferable over using a list and calling list.sort() all the time ;) On a somewhat unrelated note, does anyone know how python

Re: method = Klass.othermethod considered PITA

2005-06-04 Thread Jeff Epler
On Sat, Jun 04, 2005 at 10:43:39PM +, John J. Lee wrote: 1. In derived classes, inheritance doesn't work right: Did you expect it to print 'moo'? I'd have been surprised, and expected the behavior you got. 2. At least in 2.3 (and 2.4, AFAIK), you can't pickle classes that do this. In

Re: Grand Challenge Pegasus Team: Programming Pegasus Bridge 1 ?

2005-06-04 Thread Alex Stapleton
I'm thinking that with a decent dynamics engine (PyODE?) you could write a reasonably realistic simulator to test this sort of code on. Obviously it won't be as good as actually you know, driving a Jeep around by wire, but it'd be a tad cheaper and more time efficient for anyone interested

Re: Sorted List (binary tree) why no built-in/module?

2005-06-04 Thread Robert Kern
Alex Stapleton wrote: Unless I've totally missed it, there isn't a binary tree/sorted list type arrangement in Python. Is there a particular reason for this? Sometimes it might be preferable over using a list and calling list.sort() all the time ;) Well, I believe that list.sort() has

Re: Alternative history

2005-06-04 Thread Mike Meyer
[EMAIL PROTECTED] (Cameron Laird) writes: In article [EMAIL PROTECTED], Mike Meyer [EMAIL PROTECTED] wrote: . If it isn't a homework assignment, and you're honestly in such, then you should know there's been a lot of research in this area, because primes are important in

Re: method = Klass.othermethod considered PITA

2005-06-04 Thread Erik Max Francis
Steven Bethard wrote: John J. Lee wrote: It seems nice to do this class Klass: def _makeLoudNoise(self, *blah): ... woof = _makeLoudNoise Out of curiosity, why do you want to do this? There aren't too many clear use cases, but I've found it useful from time to

Re: executing a command

2005-06-04 Thread =?ISO-8859-1?Q?Tiago_St=FCrmer_Daitx?=
Hello,When you use one of the os.exec*p fnnctions python looks for the specified file in the directories refered by os.environ['PATH']. If and _only_ if your os.enviroment['PATH'] isn't set then it looks in os.defpath - you can check this at

Re:

2005-06-04 Thread =?ISO-8859-1?Q?Tiago_St=FCrmer_Daitx?=
That depends on what using a file means. You could check the thread executing a command ( http://mail.python.org/pipermail/python-list/2005-June/283963.html) and see if there's something related there, otherwise it would help if you could post what exactly you are trying to do (execute a file,

Why Eric3 does not have any documentation or FAQ?

2005-06-04 Thread Hsuan-Yeh Chang
Dear All, Does anyone know why? HYC -- http://mail.python.org/mailman/listinfo/python-list

Re: Looking for help with a python-mode/pdbtrack/gdb patch

2005-06-04 Thread =?ISO-8859-1?Q?Tiago_St=FCrmer_Daitx?=
Unfortunatly the only tip I can give you is that there's a list for mode-python in http://mail.python.org/mailman/listinfo/python-mode, but you probably already know about it. Regards, Tiago S DaitxOn 6/4/05, Skip Montanaro [EMAIL PROTECTED] wrote: Can someone who uses Emacs's python-mode,

Re: method = Klass.othermethod considered PITA

2005-06-04 Thread Steven Bethard
Erik Max Francis wrote: For instance, for a chat network bot framework, a certain form of bot will look for any attribute in its instance that starts with verb_ and a command and execute it when it hears it spoken: def verb_hello(self, convo): Respond to a greeting.

Re: Newbie Python XML

2005-06-04 Thread Kent Johnson
LenS wrote: I have a situation at work. Will be receiving XML file which contains quote information for car insurance. I need to translate this file into a flat comma delimited file which will be imported into a software package. Each XML file I receive will contain information on one quote

Re: csv and iterator protocol

2005-06-04 Thread Kent Johnson
Philippe C. Martin wrote: Can I initialize csv with input data stored in RAM (ex: a string) ? - so far I cannot get that to work. Or to rephrase the question, what Python RAM structure supports the iterator protocol ? Many, including strings, lists and dicts. For your needs, a list of strings

Re: Sorted List (binary tree) why no built-in/module?

2005-06-04 Thread =?iso-8859-1?Q?Fran=E7ois?= Pinard
[Alex Stapleton] Unless I've totally missed it, there isn't a binary tree/sorted list type arrangement in Python. Sometimes it might be preferable over using a list and calling list.sort() all the time ;) Well, after `some_list.sort()', `some_list' is indeed a sorted list. :-) You can use

Re: Newbie Python XML

2005-06-04 Thread uche . ogbuji
I have a situation at work. Will be receiving XML file which contains quote information for car insurance. I need to translate this file into a flat comma delimited file which will be imported into a software package. Each XML file I receive will contain information on one quote only. I have

Re: Software licenses and releasing Python programs for review

2005-06-04 Thread Mike Meyer
Steve Holden [EMAIL PROTECTED] writes: But this would only be a restriction if the code were to be redistributed, of course. It's stil perfectly legal to use it internaly without making the modified source available. I've heard people argue otherwise on this case. In particular, if you allow

Re: Elementtree and CDATA handling

2005-06-04 Thread uche . ogbuji
If, instead, you want to keep track of where the CDATA sections are, and output them again without change, you'll need to use an XML-handling interface that supports this feature. Typically, DOM implementations do - the default Python minidom does, as does pxdom. DOM is a more comprehensive but

Re: any macro-like construct/technique/trick?

2005-06-04 Thread Mike Meyer
Andrew Dalke [EMAIL PROTECTED] writes: Mac wrote: Is there a way to mimic the behaviour of C/C++'s preprocessor for macros? There are no standard or commonly accepted ways of doing that. You could do as Jordan Rastrick suggested and write your own sort of preprocessor, or use an existing

Re: For review: PEP 343: Anonymous Block Redux and Generator Enhancements

2005-06-04 Thread Nicolas Fleury
Ilpo Nyyssönen wrote: Nicolas Fleury [EMAIL PROTECTED] writes: What about making the ':' optional (and end implicitly at end of current block) to avoid over-indentation? def foo(): with locking(someMutex) with opening(readFilename) as input with opening(writeFilename) as output

Re: What are OOP's Jargons and Complexities?

2005-06-04 Thread Dale King
Anno Siegel wrote: Tassilo v. Parseval [EMAIL PROTECTED] wrote in comp.lang.perl.misc: Also sprach Dale King: David Formosa (aka ? the Platypus) wrote: On Tue, 24 May 2005 09:16:02 +0200, Tassilo v. Parseval [EMAIL PROTECTED] wrote: [...] I haven't yet come across a language that is both

Re: Easy way to detect hard drives and partitions in Linux

2005-06-04 Thread Mike Meyer
Jeff Epler [EMAIL PROTECTED] writes: I need a way to detect hard drives and their partitions... labels would be nice too... I did some googling but did not find anything all too useful. This will strictly be on Linux / Unix so any help would be greatly appreciated. You're not going to find a

Re: For review: PEP 343: Anonymous Block Redux and Generator Enhancements

2005-06-04 Thread Nicolas Fleury
Andrew Dalke wrote: Consider the following server = open_server_connection() with abc(server) with server.lock() do_something(server) server.close() it would be translated to server = open_server_connection() with abc(server): with server.lock() do_something(server)

Re: For review: PEP 343: Anonymous Block Redux and Generator Enhancements

2005-06-04 Thread Steven Bethard
Nicolas Fleury wrote: I prefer the optional-indentation syntax. The reason is simple (see my discussion with Andrew), most of the time the indentation is useless, even if you don't have multiple with-statements. So in my day-to-day work, I would prefer to write: def

  1   2   >