Re: Software licenses and releasing Python programs for review

2005-06-04 Thread Robert Kern
Mike Meyer wrote: > 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

Re: Help with pythonpath

2005-06-04 Thread Tim Roberts
Observer <[EMAIL PROTECTED]> wrote: > >Hi, im a newbie both to python and this list. >I hope someone can help me whith this: > >I have a directory structure like this: >. >|-- src >| `-- pkg >| |-- __init__.py >| |-- main.py >| `-- spkg1 >| |-- __init__.py >|

error in usin list with boost

2005-06-04 Thread GujuBoy
i have created a "cpp" file which has the followin code and when i try to compile it..it does not know what "list" is..it says its undefined..i also tried using #include but no differe...can someone please help. thanks static list retrieval_as_list(SplitText &self, int position, int re

Re: BUG pythonw vs subprocess

2005-06-04 Thread Tim Roberts
Robin Becker <[EMAIL PROTECTED]> wrote: >John J. Lee wrote: >> Paul Rubin writes: >> >>>I thought pythonw didn't provide a console and so it could be that >>>stdin and stdout aren't connected to anything. Popen therefore doesn't >>>make sense. You have to use sockets o

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 getFirstLine(f

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(serv

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

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 ye

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

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 a

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 le

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 all

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 d

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

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 qu

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

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:

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,

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 http://www.python.org/doc/current/lib/os-path.html#l2h-15

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 usef

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 im

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() ha

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

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 searche

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

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)

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

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

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 bu

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 do

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.

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

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 bzip/sto

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 use

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, inpu

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 "", line 1, in ? NameError: nam

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

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

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 digi

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

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

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

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=detail&aid=785816&group_id=86916&atid=581351 As you'll see from the discussion, Barry had problems with it from XEmacs and was thinking of r

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 th

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) server.

Re: calling ksh script from python

2005-06-04 Thread Sven Mascheck
(fup'2 set) In comp.unix.shell Donn Cave wrote: > Portability [ksh] > "echo" seems to mimic the behavior of sh on its host platform. Rather: both usually mimic echo(1) - some shells even inspect PATH (e.g. /usr/ucb/, /usr/5bin/ vs. /usr/bin/) and act accordingly. -- http://mail.python.org/mailma

potluck for google meeting?

2005-06-04 Thread donna
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 meeting.. if google will allow it. I'm volunteering to coordinate the potluck for the july google meeting.. we can just see how it goes.. Best Regards, Donna M. Snow

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 b

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 yo

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

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
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): > ... f

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 therefo

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 imp

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 natur

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

ANN: Axon 1.1.0 has been released!

2005-06-04 Thread Michael Sparks
Axon 1.1.0 has been released! What is it? === Axon is a collection of pure python modules from the Kamaelia project which allow you to build concurrent systems in a compositional manner using communicating python generators. Components are python generators are augmented by inbox and outbo

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

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

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 conta

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

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 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__()?

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 do

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 () > > No

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 dat

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 dat

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 spli

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

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

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 inde

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

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

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

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 ev

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 -- http://m

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 IDL

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 st

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 in

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(o

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

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

[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 sys.pat

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 __ex

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 f

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

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

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 us

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

Re: Removing a warnings filter?

2005-06-04 Thread Torsten Bronger
Hallöchen! 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. > >

  1   2   >