Parent module idea dropped? [WAS: import statement - package visibility problem]

2005-04-07 Thread Laszlo Zsolt Nagy
But onto the point you're making. I think its possibly a mis-viewing of the package idea in Python. A package creates a name space. If you create Lib/Server/Db with all the __init__.py files, its because you want to import Lib.Server.Db, rather than a way of organising your source files. I wen

Re: change extensions

2005-04-07 Thread Tim Roberts
"Bob Then" <[EMAIL PROTECTED]> wrote: >how can i change all files from one extension to another within a direcory? In Windows, the quickest way is: os.system( "rename *.old *.new" ) -- - Tim Roberts, [EMAIL PROTECTED] Providenza & Boekelheide, Inc. -- http://mail.python.org/mailman/listi

Re: Multiple inheritance: Interface problem workaround, please comment this

2005-04-07 Thread Axel Straschil
Hello! > (1) make A or B a mixin class that doesn't need __init__ called, or Would be a solution for classes that just give functionality, no data-structures. In that case, i would use functions, no classes ;-) I've seen code where there are classes without init and the hope that self has wh

Re: Sockets

2005-04-07 Thread Dan
On Fri, 08 Apr 2005 03:06:38 -, Grant Edwards <[EMAIL PROTECTED]> wrote: >Nope. You're thinking of C strings. Python strings aren't >terminated with a null. Yes, that make sense. Thanks for the input, and the note on struct. Dan -- http://mail.python.org/mailman/listinfo/python-list

Re: curious problem with large numbers

2005-04-07 Thread Michael Spencer
Steve Holden wrote: Scott David Daniels wrote: Terry Reedy wrote: On my Windows machine with 2.2.1, I get exactly what you expected: 1e1 1.#INF ... If you get wrong behavior on a later version, then a bug has been introduced somewhere, even perhaps in VC 7, used for 2.4. Nope, it is also the

Re: [JIM_SPAM] Microsoft supporting a .NET version of Python...

2005-04-07 Thread Steve Holden
Jim Hargrave wrote: http://www.gotdotnet.com/workspaces/workspace.aspx?id=ad7acff7-ab1e-4bcb-99c0-57ac5a3a9742 You really shoud try and get out more: http://www.pycon.org/dc2005/talks/keynote regards Steve -- Steve Holden+1 703 861 4237 +1 800 494 3119 Holden Web LLC http:

Re: within a class, redefining self with pickled file

2005-04-07 Thread Greg Ewing
Sean Blakey wrote: On 7 Apr 2005 15:27:06 -0700, syd <[EMAIL PROTECTED]> wrote: def unpickle(self): self = pickle.load(open(self.getFilePath('pickle'))) Note, however, that you can MODIFY self in-place within a method. You can probably hack together a solution that modifies self.__dict__, self._

Re: curious problem with large numbers

2005-04-07 Thread Steve Holden
Scott David Daniels wrote: Terry Reedy wrote: On my Windows machine with 2.2.1, I get exactly what you expected: 1e1 1.#INF ... If you get wrong behavior on a later version, then a bug has been introduced somewhere, even perhaps in VC 7, used for 2.4. Nope, it is also there for 2.3.4 (May 25

Re: How to name Exceptions that aren't Errors

2005-04-07 Thread Steve Holden
Roy Smith wrote: [...] I think my code is clearer, but I wouldn't go so far as to say I'm violently opposed to your code. I save violent opposition for really important matters like which text editor you use. +1 QOTW regards Steve -- Steve Holden+1 703 861 4237 +1 800 494 3119 Holden W

Re: Sockets

2005-04-07 Thread Grant Edwards
On 2005-04-08, Dan <[EMAIL PROTECTED]> wrote: > On Thu, 7 Apr 2005 21:52:11 -0500, [EMAIL PROTECTED] wrote: > >>Python strings always carry their length, and can have embedded NULs. >>s.write("\0\1\2\3") >>should write 4 bytes to the socket 's'. > > I'm taking binary data from a database, so it

Re: wxwindows event function arguments

2005-04-07 Thread Greg Krohn
lotmr wrote: I have a windows launch bar application that sits in the system tray. What I want to do is when i click on a button in the launch menu, it calls the event which then calls 'OnLaunch('path')' this does not seem possible. When I change 'OnLaunch(self, event)' to 'OnLaunch(self, event, pa

[JIM_SPAM] Microsoft supporting a .NET version of Python...

2005-04-07 Thread Jim Hargrave
http://www.gotdotnet.com/workspaces/workspace.aspx?id=ad7acff7-ab1e-4bcb-99c0-57ac5a3a9742 -- http://mail.python.org/mailman/listinfo/python-list

SWIG for Python - returning 64 bit value

2005-04-07 Thread akineko
Hello everyone, I'm very new to SWIG and I'm trying to use SWIG to interface my Python program to routines written in C. Only catch is it has to pass 40 bit data both ways. I found several postings in the Internet newsgroup related to such. My swig interface file is: %module ipc_msg %{ %} %typ

Re: curious problem with large numbers

2005-04-07 Thread Michael Spencer
Terry Reedy wrote: "Chris Fonnesbeck" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] However, on Windows (have tried on Mac, Linux) I get the following behaviour: inf = 1e1 inf 1.0 while I would have expected: 1.#INF On my Windows machine with 2.2.1, I get exactly what you ex

Re: Using weakrefs instead of __del__

2005-04-07 Thread Greg Ewing
Rhamphoryncus wrote: class RealFoo: refs = set() def __init__(self, front): self.refs.add(weakref.ref(front, self.cleanup)) def blah(self): print "Blah!" def cleanup(self, ref): print "Doing cleanup" self.refs.remove(ref) That won't work, because the bound method you're usin

Re: Sockets

2005-04-07 Thread Dan
On Thu, 7 Apr 2005 21:52:11 -0500, [EMAIL PROTECTED] wrote: >Python strings always carry their length, and can have embedded NULs. >s.write("\0\1\2\3") >should write 4 bytes to the socket 's'. I'm taking binary data from a database, so it's not really a Python string. Is there an easy way to

Re: Sockets

2005-04-07 Thread Grant Edwards
On 2005-04-08, Dan <[EMAIL PROTECTED]> wrote: > But it appears that the Python socket module has no method to send > binary data, it only sends strings. Grasshopper, things are often not what they appear. Likewise, they often appear to be what they are not. Strings and binary data are one and th

Re: Sockets

2005-04-07 Thread jepler
Python strings always carry their length, and can have embedded NULs. s.write("\0\1\2\3") should write 4 bytes to the socket 's'. Jeff pgpYpor1iHZad.pgp Description: PGP signature -- http://mail.python.org/mailman/listinfo/python-list

Sockets

2005-04-07 Thread Dan
I'm using the socket module and have run into a problem. I want to send binary data over the connection. With C, this is easy: write(sock_fd, data, length); But it appears that the Python socket module has no method to send binary data, it only sends strings. So there's no argument to tell

Re: text processing problem

2005-04-07 Thread Paul McGuire
Maurice - Here is a pyparsing treatment of your problem. It is certainly more verbose, but hopefully easier to follow and later maintain (modifying valid word characters, for instance). pyparsing implicitly ignores whitespace, so tabs and newlines within the expression are easily skipped, withou

Ó¿Ò, THE GREATEST NEWS EVER ! °º¤ø,¸¸,ø¤º°`°º¤ø°º¤ø,¸¸,ø¤º°`°º¤ø°º¤ø,¸¸,ø¤º°`°º¤ø°º¤ø,¸¸,ø¤º°`°º¤ø

2005-04-07 Thread RonGrossi_38116
http://www.print-it.blogspot.com << The Greatest News Ever! -- http://mail.python.org/mailman/listinfo/python-list

Re: How to name Exceptions that aren't Errors

2005-04-07 Thread Roy Smith
Leo Breebaart <[EMAIL PROTECTED]> wrote: > I've recently become rather fond of using Exceptions in Python to > signal special conditions that aren't errors, but which I feel > are better communicated up the call stack via the exception > mechanism than via e.g. return values. > > For instance, I'

Re: how can I extract all urls in a string by using re.findall() ?

2005-04-07 Thread could ildg
I agree with Cappy2112. I got more puzzled after I read the docs On 7 Apr 2005 15:13:04 -0700, Cappy2112 <[EMAIL PROTECTED]> wrote: > >>Reading the documentation on re might be helpfull here :-P > Many times, the python docs can make the problem more complicated, > espcecially with regexes. > > -

Re: oracle interface

2005-04-07 Thread Myles Strous
cx_Oracle here too (Win32, connecting to Oracle 9). Thanks, Computronix! (And, of course, thanks to the Python team and community.) -- http://mail.python.org/mailman/listinfo/python-list

Re: text processing problem

2005-04-07 Thread Maurice LING
Matt wrote: I'd HIGHLY suggest purchasing the excellent http://www.oreilly.com/catalog/regex2/index.html";>Mastering Regular Expressions by Jeff Friedl. Although it's mostly geared towards Perl, it will answer all your questions about regular expressions. If you're going to work with regexs, this

Re: text processing problem

2005-04-07 Thread Matt
Maurice LING wrote: > Matt wrote: > > > > > > Try this: > > import re > > my_expr = re.compile(r'(\w+) (\(\1\))') > > s = "this is (is) a test" > > print my_expr.sub(r'\1', s) > > #prints 'this is a test' > > > > M@ > > > > Thank you Matt. It works out well. The only think that gives it problem >

Re: How to name Exceptions that aren't Errors

2005-04-07 Thread Bengt Richter
On Thu, 07 Apr 2005 15:40:24 -0400, Steve Holden <[EMAIL PROTECTED]> wrote: >Leo Breebaart wrote: >> I've recently become rather fond of using Exceptions in Python to >> signal special conditions that aren't errors, but which I feel >> are better communicated up the call stack via the exception >>

Re: curious problem with large numbers

2005-04-07 Thread Scott David Daniels
Terry Reedy wrote: On my Windows machine with 2.2.1, I get exactly what you expected: 1e1 1.#INF ... If you get wrong behavior on a later version, then a bug has been introduced somewhere, even perhaps in VC 7, used for 2.4. Nope, it is also there for 2.3.4 (May 25 2004, 21:17:02). This is no

extending event class in wxpython

2005-04-07 Thread suryaprakashg
Hi all, I have a sub-classed wxtreectrl but i want to create an event when a node is added to my class . But i dont seem to understand how to do that. I want to create my own NODE_ADDED event which would be handled by main frame which creates an instance of my treectrl. Any help would be greatly

Re: text processing problem

2005-04-07 Thread Maurice LING
Matt wrote: Try this: import re my_expr = re.compile(r'(\w+) (\(\1\))') s = "this is (is) a test" print my_expr.sub(r'\1', s) #prints 'this is a test' M@ Thank you Matt. It works out well. The only think that gives it problem is in events as "there (there)", where between the word and the same

wxwindows event function arguments

2005-04-07 Thread lotmr
I have a windows launch bar application that sits in the system tray. What I want to do is when i click on a button in the launch menu, it calls the event which then calls 'OnLaunch('path')' this does not seem possible. When I change 'OnLaunch(self, event)' to 'OnLaunch(self, event, path)' it says

bourne shell parser in python

2005-04-07 Thread Dan Stromberg
Hi folks. We have a huge collection of sysadmin knowledge that's encoded in a vast array of bourne shell scripts. I'm now beginning to think that a transition to cfengine or similar might be a good idea, but I'm loathe to toss out all that /bin/sh code that's kept us from having to worry about n

Re: curious problem with large numbers

2005-04-07 Thread Terry Reedy
"Chris Fonnesbeck" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > However, on Windows (have tried on Mac, Linux) I get the following > behaviour: > inf = 1e1 inf > 1.0 > > while I would have expected: > > 1.#INF On my Windows machine with 2.2.1, I get exactly what y

Re: text processing problem

2005-04-07 Thread Matt
Maurice LING wrote: > Hi, > > I'm looking for a way to do this: I need to scan a text (paragraph or > so) and look for occurrences of " ()". That is, if the > text just before the open bracket is the same as the text in the > brackets, then I have to delete the brackets, with the text in it. > >

Re: within a class, redefining self with pickled file

2005-04-07 Thread Sean Blakey
On 7 Apr 2005 15:27:06 -0700, syd <[EMAIL PROTECTED]> wrote: > def unpickle(self): > self = pickle.load(open(self.getFilePath('pickle'))) > > This evidently does not work. Any idea why? I'd like to be able to > replace a lightly populated class (enough to identify the pickled > version correct

Re: Lambda: the Ultimate Design Flaw

2005-04-07 Thread Ron_Adam
On Thu, 7 Apr 2005 17:49:39 -0400, "Terry Reedy" <[EMAIL PROTECTED]> wrote: >"Ron_Adam" <[EMAIL PROTECTED]> wrote in message >news:[EMAIL PROTECTED] >> Python has one obvious best way to do things. > > >More exactly, 'should preferably have' rather than 'has'. > >> Meaning that the most obvious a

within a class, redefining self with pickled file

2005-04-07 Thread syd
def unpickle(self): self = pickle.load(open(self.getFilePath('pickle'))) This evidently does not work. Any idea why? I'd like to be able to replace a lightly populated class (enough to identify the pickled version correctly) with it's full version that's sitting pickled in a file. As of right

Re: how can I extract all urls in a string by using re.findall() ?

2005-04-07 Thread Cappy2112
>>Reading the documentation on re might be helpfull here :-P Many times, the python docs can make the problem more complicated, espcecially with regexes. -- http://mail.python.org/mailman/listinfo/python-list

Re: 'Address already in use' when using socket

2005-04-07 Thread Peter Hansen
Bearish wrote: I get 'Address already in use' errors when using sockets. Generally one can fix this using: sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) where "sock" is the server socket in question. Do this prior to attempting to bind to the port. -Peter -- http://mail.python.org/mai

Re: Lambda: the Ultimate Design Flaw

2005-04-07 Thread Philippa Cowderoy
On Thu, 7 Apr 2005, Frank Wilde wrote: Continuations rule! While continuations are a very interesting abstraction, the improvement of structured programming was to be able to prove properties of your programs in time linear to the size of the program instead of quadratic. I don't see how giving arg

text processing problem

2005-04-07 Thread Maurice LING
Hi, I'm looking for a way to do this: I need to scan a text (paragraph or so) and look for occurrences of " ()". That is, if the text just before the open bracket is the same as the text in the brackets, then I have to delete the brackets, with the text in it. Does anyone knows any way to achie

Re: Lambda: the Ultimate Design Flaw

2005-04-07 Thread Terry Reedy
"Ron_Adam" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Python has one obvious best way to do things. More exactly, 'should preferably have' rather than 'has'. > > Meaning that the most obvious and clearest way, the way that comes to > mind first, will in most cases, also be the

Re: Lambda: the Ultimate Design Flaw

2005-04-07 Thread Terry Reedy
"François Pinard" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] >To summarize, instead of saying "Python has only one way to do it", As I explained in response to Aahz, what Tim Peters wrote was that Python 'should preferably have only one obvious way to do it'. Omission of the

dynamic loading of code, and avoiding package/module name collisions.

2005-04-07 Thread John Perks and Sarah Mount
Long story short: what I'm looking for is information on how have a Python app that: * embeds an editor (or wxNoteBook full of editors) * loads code from the editors' text pane into the app * executes bits of it * then later unloads to make way for an edited version of the code. The new version nee

'Address already in use' when using socket

2005-04-07 Thread Bearish
I get 'Address already in use' errors when using sockets. Am I properly shutting down all connections? What am I doing wrong? I've looked at the examples and I can't figure out what I'm missing. I already read the Python Socket HOWTO at http://py-howto.sourceforge.net/sockets/sockets.html but I see

Re: How to name Exceptions that aren't Errors

2005-04-07 Thread Leo Breebaart
Max <[EMAIL PROTECTED]> writes: > LOOK EVERYONE, it's Leo Breebart. You are the same Leo > Breebart, right? Breeb*aa*rt. But otherwise, yeah -- I do frequent more than just one newsgroup. :-) > This guys famous in the alternative universe of > alt.fan.pratchett. I doubt anybody here cares! Who

Re: How to name Exceptions that aren't Errors

2005-04-07 Thread Aahz
In article <[EMAIL PROTECTED]>, Leo Breebaart <[EMAIL PROTECTED]> wrote: > >My question is twofold. First, I know that many programmers are >violently opposed to using exceptions in this fashion, i.e. for >anything other than, well, exceptional circumstances. But am I correct >in thinking that in

Re: curious problem with large numbers

2005-04-07 Thread Laszlo Zsolt Nagy
I thought it will be the same for FreeBSD, but here are the results: FreeBSD 4.8 with Python 2.3.4 Python 2.3.4 (#2, Nov 10 2004, 05:08:39) [GCC 2.95.4 20020320 [FreeBSD]] on freebsd4 Type "help", "copyright", "credits" or "license" for more information. >>> inf = 1e308*2 >>> inf Inf >>> float('Inf

Re: curious problem with large numbers

2005-04-07 Thread Kristian Zoerhoff
On Apr 7, 2005 3:34 PM, David M. Cooke > > I don't do Windows, so I can't say this will work, but try > > >>> inf = 1e308*2 I *do* do Windows, and that does work. The value of inf then becomes '1.#INF' as expected. Strangely, doing float('1.#INF') still fails on Windows. Weird, weird. -- Kr

Re: Use string in URLs

2005-04-07 Thread Leif K-Brooks
Markus Franz wrote: I want to use the string "rüffer" in a get-request, so I tried to encode it. My problem: But with urllib.quote I always get "r%FCffer", but I want to get "r%C3%BCffer" (with is correct in my opinion). urllib.quote(u'rüffer'.encode('utf8')) -- http://mail.python.org/mailman/li

Re: curious problem with large numbers

2005-04-07 Thread David M. Cooke
Chris Fonnesbeck <[EMAIL PROTECTED]> writes: > I have been developing a python module for Markov chain Monte Carlo > estimation, in which I frequently compare variable values with a very > large number, that I arbitrarily define as: > > inf = 1e1 > > However, on Windows (have tried on Mac, Lin

Re: Lambda: the Ultimate Design Flaw

2005-04-07 Thread Terry Reedy
"Aahz" <[EMAIL PROTECTED]> > Pinard <[EMAIL PROTECTED]> wrote: >>Sure, of course. Yet, our friendly argument is sliding away from was it >>originally was. The point was about not asserting in this forum that >>Python "has only one way to do it", because this is not true anymore. >> >>The princ

Re: How to name Exceptions that aren't Errors

2005-04-07 Thread Max
Leo Breebaart wrote: I've recently become rather fond of using Exceptions in Python to signal special conditions that aren't errors, but which I feel are better communicated up the call stack via the exception mechanism than via e.g. return values. Ummm... yeah, I quite agree. LOOK EVERYONE, it's L

Re: richcmpfunc semantics

2005-04-07 Thread David M. Cooke
harold fellermann <[EMAIL PROTECTED]> writes: > Thank you Greg, > > I figured most of it out in the meantime, myself. I only differ > from you in one point. > >>> What has to be done, if the function is invoked for an operator >>> I don't want to define? >> >> Return Py_NotImplemented. (Note that'

Re: curious problem with large numbers

2005-04-07 Thread Jeff Epler
You may want to read http://www.python.org/peps/pep-0754.html Part of the text reads The IEEE 754 standard defines a set of binary representations and algorithmic rules for floating point arithmetic. Included in the standard is a set of constants for representing special values, in

Re: import statement - package visibility problem

2005-04-07 Thread Laszlo Zsolt Nagy
Here is the example: http://designasign.biz/Lib2.zip Please extract the file and try to import Lib2 Although \Lib2\Client\Db\DatabaseConnection.py and \Lib2\Server\Db\DatabaseConnection.py have the same class name but they are in a different sub-package. From a programmer's view, I hope this is

Re: Problems extracting attachment from email

2005-04-07 Thread Lee Harr
On 2005-04-07, foten <[EMAIL PROTECTED]> wrote: > The problem I'm having is when I'm trying to extract the > attachement using > f=open(Filename, "wb") > f.write(msg.get_payload(decode=1)) > f.close() > Not the whole message is decoded and stored! > When only trying >

Re: Distributing Python Apps and MySQL

2005-04-07 Thread Jarek Zgoda
rbt napisał(a): I don't think one can distribute mysql within a software package w/o buying a commercial license to do so. Check out their licensing on their website here: "When your application is not licensed under either the GPL-compatible Free Software License as defined by the Free Softwar

Re: How to name Exceptions that aren't Errors

2005-04-07 Thread F. Petitjean
Le 7 Apr 2005 19:23:21 GMT, Leo Breebaart a écrit : > I've recently become rather fond of using Exceptions in Python to > signal special conditions that aren't errors, but which I feel > are better communicated up the call stack via the exception > mechanism than via e.g. return values. > > For in

curious problem with large numbers

2005-04-07 Thread Chris Fonnesbeck
I have been developing a python module for Markov chain Monte Carlo estimation, in which I frequently compare variable values with a very large number, that I arbitrarily define as: inf = 1e1 However, on Windows (have tried on Mac, Linux) I get the following behaviour: >>> inf = 1e1 >>>

Re: How to name Exceptions that aren't Errors

2005-04-07 Thread Steve Holden
Leo Breebaart wrote: I've recently become rather fond of using Exceptions in Python to signal special conditions that aren't errors, but which I feel are better communicated up the call stack via the exception mechanism than via e.g. return values. Absolutely. For instance, I'm thinking of methods

Re: Distributing Python Apps and MySQL

2005-04-07 Thread rbt
dcrespo wrote: Hi there... I want to distribute my python apps and the MySQL Database in the easiest way possible. I mean a user just run the installation file and all is automaticly installed. Any suggestions? My knowledge: I know, as many of you, that there's py2exe for compiling python apps for

How to name Exceptions that aren't Errors

2005-04-07 Thread Leo Breebaart
I've recently become rather fond of using Exceptions in Python to signal special conditions that aren't errors, but which I feel are better communicated up the call stack via the exception mechanism than via e.g. return values. For instance, I'm thinking of methods such as: def run(self):

Re: oracle interface

2005-04-07 Thread M.-A. Lemburg
Andrew Dalke wrote: > In searching I find there several different ways to > connect to an Oracle server on MS Windows: > > mxODBC - http://www.egenix.com/files/python/mxODBC.html > built on top of the ODBC drivers for a given database mxODBC works nicely with Oracl on Windows. There are two

Re: import statement - package visibility problem

2005-04-07 Thread Laszlo Zsolt Nagy
Paul Clinch wrote: I get: import Lib Traceback (most recent call last): File "", line 1, in ? ImportError: No module named Lib I guess there's a Lib/__init__.py. You are totally right. I was trying to create an example but Python found something on my PYTHONPATH. Sorry for the

Re: math - need divisors algorithm

2005-04-07 Thread Peter Schorn
Philp Smith wrote: Hi Does anyone have suggested code for a compact, efficient, elegant, most of all pythonic routine to produce a list of all the proper divisors of an integer (given a list of prime factors/powers) What about # Returns a list of all divisors of n = a1^e1*a2^e2* ... *an^en whe

Re: Web application toolkit recommendation?

2005-04-07 Thread Pierre Quentel
[EMAIL PROTECTED] a écrit : I have looked briefly at Karrigell. does it support user logins? S Yes, you can take a look at the "portal" demo to see how it works Regards, Pierre -- http://mail.python.org/mailman/listinfo/python-list

Re: Lambda: the Ultimate Design Flaw

2005-04-07 Thread Aahz
In article <[EMAIL PROTECTED]>, =?iso-8859-1?Q?Fran=E7ois?= Pinard <[EMAIL PROTECTED]> wrote: >[Aahz] >> >> I'll agree that Python currently has many examples of more than one >> way to do things (and even Python 3.0 won't remove every example >> [...]). But I won't agree that Only One Way has bee

Ply(LALR) and Yacc behaving differently

2005-04-07 Thread Åsmund Grammeltvedt
Hi. I am trying to implement a small compiler in python and, trying to use something a bit more pythonic than lex/yacc, ended up with ply (http://systems.cs.uchicago.edu/ply/). The only problem is that whereas yacc accepts the grammar and appears to parse it correctly, ply does not. Perhaps th

Re: sorting a list and counting interchanges

2005-04-07 Thread Bill Mill
> > I think it's harder for some people to see why the > > assert j not in seen > > must be true, although that's obvious after just a few hours' thought . That's where you get to leave comments like: #it follows logically that assert j not in seen or #by implication assert j not in see

Re: Python & MySQL

2005-04-07 Thread Andy Dustman
[EMAIL PROTECTED] wrote: > Okay, > > I had the brilliant idea right after posting to google the newsgroups > on this. > > db = MySQLdb.connect(user=database_user,passwd=database_password) > > db.autocommit(True) <--- One little line! You would be better off executing db.commit() periodically (at

Re: struct enhancements?

2005-04-07 Thread Tim Peters
[EMAIL PROTECTED] > I would like to be able to pack/unpack 8-byte longs, ... Have you tried struct's 'q' or 'Q' format codes? -- http://mail.python.org/mailman/listinfo/python-list

Re: struct enhancements?

2005-04-07 Thread lee_merrill
Thanks! I have 16 zillion ... well 16,000 strings that need trimming. Lee Larry Bates wrote: > Can't address the 8-byte longs, but to strip off null padding > in strings you merely do > > s=s.rstrip('\x00') > > Larry Bates -- http://mail.python.org/mailman/listinfo/python-list

Re: How to detect windows shutdown

2005-04-07 Thread vincent wehren
"Austin" <[EMAIL PROTECTED]> schrieb im Newsbeitrag news:[EMAIL PROTECTED] |I wrote a GUI program with wxPython. | The error message is: | | Unhandled exception | An unhandled exception occured. Press "Abort" to terminate the program, | "Retry" to exit the program normally and "Ignore" to try to c

Re: import statement - package visibility problem

2005-04-07 Thread Paul Clinch
Laszlo, For :- > Python 2.4.1 (#65, Mar 30 2005, 09:13:57) [MSC v.1310 32 bit (Intel)] on > win32 > Type "help", "copyright", "credits" or "license" for more information. > >>> import Lib > Traceback (most recent call last): > File "", line 1, in ? > File "Lib\__init__.py", line 1, in ? >

Use string in URLs

2005-04-07 Thread Markus Franz
Hi. I want to use the string "rüffer" in a get-request, so I tried to encode it. My problem: But with urllib.quote I always get "r%FCffer", but I want to get "r%C3%BCffer" (with is correct in my opinion). Thanks. Markus -- http://mail.python.org/mailman/listinfo/python-list

Manipulating Peach Tree (accounting) Btrieve database

2005-04-07 Thread Dave Boland
Has anyone used Python (or other language) to query and report on data in the accounting program Peach Tree? Peach Tree uses a Btrieve database, but I can't be certain the database conforms to all of the Btrieve standards. Some companies take liberties with things like that ;-). When all is

Re: Read 16 bit integer complex data

2005-04-07 Thread Greg
That worked, thanks a lot. Greg -- http://mail.python.org/mailman/listinfo/python-list

Re: sorting a list and counting interchanges

2005-04-07 Thread Bill Mill
On 7 Apr 2005 10:44:49 -0700, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > Tim's solution is very nice, it comes from basic things often taught in > good computer science courses. I dunno, that comes from my Abstract Algebra course a heck of a lot more than it came from any of my CS classes (I g

Re: sorting a list and counting interchanges

2005-04-07 Thread Tim Peters
[Paul Rubin] > Writing a sorting function from scratch for this purpose seems like > reinventing the wheel. Yup! list.sort() is going to be mounds faster. > Tim's answer of simply counting the cycles (without having to pay > attention to their length) is really clever. I didn't realize you coul

Re: Lambda: the Ultimate Design Flaw

2005-04-07 Thread Frank Wilde
Ulrich Hobelmann wrote: > alex goldman wrote: >> I personally think GOTO was unduly criticized by Dijkstra. With the >> benefit of hindsight, we can see that giving up GOTO in favor of >> other primitives failed to solve the decades-old software crisis. > The fault of goto in imperative languages

Re: Lambda: the Ultimate Design Flaw

2005-04-07 Thread Michael Spencer
Steve Holden wrote: Not at all - we just apply the same division techniques to the buffer space until we can map the pieces of cake one-to-one onto the buffers. That technique can be applied to layer cakes, but not all real cakes. Michael -- http://mail.python.org/mailman/listinfo/python-list

Re: sorting a list and counting interchanges

2005-04-07 Thread bearophileHUGS
Tim's solution is very nice, it comes from basic things often taught in good computer science courses. In Python when you have to do many (-1)**n you can do: (1-2*(n%2)) This seems quite faster. Bearophile -- http://mail.python.org/mailman/listinfo/python-list

Re: Python backend binding to PAM, NSS or pppd

2005-04-07 Thread Gerald Klix
Well, I am actually playing, right now. For http://www.carelix.org I implemented a module that * adds a user to passwd and * authenticates that user given a certificate and some other info on removable media * it creates an encrypted loopback file, that is mounted as the user's home direct

Re: sorting a list and counting interchanges

2005-04-07 Thread Paul Rubin
Peter Nuttall <[EMAIL PROTECTED]> writes: > I would just write a quicksort and have a counter in the swap function. > A cunning way to do it would be to multiply the counter by -1 for each > swap. if you want I can write what I had in mind. Wikipedia has a good > article of quicksort. Writing a so

Re: Lambda: the Ultimate Design Flaw

2005-04-07 Thread Steve Holden
Robin Becker wrote: Greg Ewing wrote: Scott David Daniels wrote: Aahz wrote: You just can't have your cake and eat it, too. I've always wondered about this turn of phrase. I seldom eat a cake at one sitting. You need to recursively subdivide the cake until you have a piece small enough to fit in

Re: Lambda: the Ultimate Design Flaw

2005-04-07 Thread Robin Becker
Greg Ewing wrote: Scott David Daniels wrote: Aahz wrote: You just can't have your cake and eat it, too. I've always wondered about this turn of phrase. I seldom eat a cake at one sitting. You need to recursively subdivide the cake until you have a piece small enough to fit in your input buffer.

Re: Best editor?

2005-04-07 Thread Michael George Lerner
Nicolay A. Vasiliev <[EMAIL PROTECTED]> wrote: > Hello! > What do you think all about ActiveState Komodo? Is this specifically to me? I haven't tried it, but I'm tempted. I've recently begun teaching my wife some Python in order to help her write a useful GUI app, and that makes it look particu

Re: logging as root using python script

2005-04-07 Thread [EMAIL PROTECTED]
use the program called 'expect' it can be called via python. you can build a script using the 'autoexpect' tool. http://www.linuxjournal.com/article/3065 cheers Raghul wrote: > Hi >Is it possible to login as a root in linux using python script? > What I need is when I execute a script it shou

Re: Erroneous line number error in Py2.4.1 [Windows 2000+SP3]

2005-04-07 Thread Timo
Martin v. Löwis wrote: > Timo wrote: > > Does anyone have a clue what is going on? > > No. Please make a bug report to sf.net/projects/python. > Done: http://sourceforge.net/tracker/index.php?func=detail&aid=1178484&group_id=5470&atid=105470 BR, Timo -- http://mail.python.org/mailman/listin

Re: Lambda: the Ultimate Design Flaw

2005-04-07 Thread Ron_Adam
On 7 Apr 2005 11:11:31 -0400, [EMAIL PROTECTED] (Aahz) wrote: >You're conflating two different things: > >* Whether Python currently has only one way to do things > >* Whether Python has a design goal of only one way to do things > >I'll agree that Python currently has many examples of more than o

Re: Multiple inheritance: Interface problem workaround, please comment this

2005-04-07 Thread Steven Bethard
Axel Straschil wrote: I solved all my problems for pythons multiple inheritance with this ng, thaks to all again, but there is one think I still dislike: class A(object): def __init__(self, a=None, **__eat): print "A" super(A, self).__init__() class B(object): def __init__(self, b=None, **_

Problems extracting attachment from email

2005-04-07 Thread foten
Hi community, This is the task I'm struggling with: - A user sends me an email with the subject '*3gp*' including an attached .3gp-file. - I then fetch that email, extracts the attachement and stores it localy as a file. - I then run a python-script that parses the stored file and ge

Re: client-client connection using socket

2005-04-07 Thread dcrespo
"Client" and "Server" are just definitions or convention names. If your program "listens" to connections, then it is a server. Just it. -- http://mail.python.org/mailman/listinfo/python-list

Re: Read 16 bit integer complex data

2005-04-07 Thread Jeff Epler
You may want to use the 'numeric' or 'numarray' extensions for this. The page on numarray is here: http://www.stsci.edu/resources/software_hardware/numarray numarray doesn't support "complex 16-bit integer" as a type, but you can get a complex, floating-point valued array from your integer val

Re: Lambda: the Ultimate Design Flaw

2005-04-07 Thread François Pinard
[Aahz] > I'll agree that Python currently has many examples of more than one > way to do things (and even Python 3.0 won't remove every example > [...]). But I won't agree that Only One Way has been abandoned as a > design principle. To summarize, instead of saying "Python has only one way to do

Multiple inheritance: Interface problem workaround, please comment this

2005-04-07 Thread Axel Straschil
Hello! I'm working on an HTML/Cgi widget's class where multiple inheritance well be sometime a great thing. I solved all my problems for pythons multiple inheritance with this ng, thaks to all again, but there is one think I still dislike: class A(object): def __init__(self, a=None, **__

Re: import statement - package visibility problem

2005-04-07 Thread Laszlo Zsolt Nagy
' under 'Adapters' then it means that 'DatabaseConnection' is an adapter. But it is not. :-) In the other direction, Adapters are deeper, so adapters should can DatabaseConnection-s (and in fact they are). Spelled: In the other direction, Adapter is deeper, so adapters should _be_ DatabaseCon

Re: import statement - package visibility problem

2005-04-07 Thread Laszlo Zsolt Nagy
2. Maybe the layering of your application is wrong. If DatabaseConnection provides common functionality to the different Adapters, it should be on the same layer or one beneath the Adapters. Another notice. If I put 'DatabaseConnection' under 'Adapters' then it means that 'DatabaseConnection'

Re: Best editor?

2005-04-07 Thread Brian
Yes, we vi/vim users are apparently extraordinary. Is that such a sad thing? ;-) -- http://mail.python.org/mailman/listinfo/python-list

  1   2   >