[ANN] PyTables 1.3.3 released

2006-08-25 Thread Francesc Altet
=== Announcing PyTables 1.3.3 === I'm happy to announce a new minor release of PyTables. In this one, we have focused on improving compatibility with latest beta versions of NumPy (0.9.8, 1.0b2, 1.0b3 and higher), adding some improvements and the

SpamBayes 1.1a3

2006-08-25 Thread skip
The SpamBayes team is pleased to announce release 1.1a3 of SpamBayes. As is now usual, this is both a release of the source code and of an installation program for all Microsoft Windows users. This is an *ALPHA* release. It should only be installed by users willing to try out experimental

Re: lazy arithmetic

2006-08-25 Thread Simon Forman
[EMAIL PROTECTED] wrote: Gabriel Genellina wrote: At Friday 25/8/2006 00:36, [EMAIL PROTECTED] wrote: # This is what I have in mind: class Item(object): def __add__(self, other): return Add(self, other) And this works fine... why make thinks complicated? Yes, I agree

Re: lazy arithmetic

2006-08-25 Thread Simon Forman
[EMAIL PROTECTED] wrote: Simon Forman wrote: Item.__add__ = Add is a very strange thing to do, I'm not surprised it didn't work. Yes it is strange. I also tried this even stranger thing: class Item(object): class __add__(object): def __init__(self, a, b=None): print

Re: pickling and endianess

2006-08-25 Thread Fredrik Lundh
Chandrashekhar kaushik wrote: Can an object pickled and saved on a little-endian machine be unpickled on a big-endian machine ? yes. the format uses a known byte order. /F -- http://mail.python.org/mailman/listinfo/python-list

Re: pickling and endianess

2006-08-25 Thread Tim Peters
[Chandrashekhar kaushik] Can an object pickled and saved on a little-endian machine be unpickled on a big-endian machine ? Yes. The pickle format is platform-independent (native endianness doesn't matter, and neither do the native sizes of C's various integer types). Does python handle this

Re: Is this a good idea or a waste of time?

2006-08-25 Thread Simon Forman
asincero wrote: Would it be considered good form to begin every method or function with a bunch of asserts checking to see if the parameters are of the correct type (in addition to seeing if they meet other kinds of precondition constraints)? Like: def foo(a, b, c, d): assert

Re: pickling and endianess

2006-08-25 Thread Chandrashekhar Kaushik
Thank you for the information.A request though.I am actually looking to implement serialization routines in C++.An am facing the problem of how to tackle endianess and sizeof issues.Could you give me a overview of how pickling is done in python ? Reading pickle.py is obviously the option , but

Re: pickling and endianess

2006-08-25 Thread Fredrik Lundh
Chandrashekhar Kaushik wrote: Thank you for the information. A request though. I am actually looking to implement serialization routines in C++. An am facing the problem of how to tackle endianess and sizeof issues. Could you give me a overview of how pickling is done in python ? Reading

Re: pickling and endianess

2006-08-25 Thread Gabriel Genellina
At Friday 25/8/2006 03:17, Chandrashekhar Kaushik wrote: I am actually looking to implement serialization routines in C++. An am facing the problem of how to tackle endianess and sizeof issues. Could you give me a overview of how pickling is done in python ? Reading pickle.py is obviously the

Re: pickling and endianess

2006-08-25 Thread Chandrashekhar Kaushik
The pickletools.py seems to be giving cool info on the same ( the PM virual machine and all ). Will try to salvage something out of that. I dont think i really need that much . Just need to be able to send data across the network and then retrieve it properly independent of the architecture at the

Re: pickling and endianess

2006-08-25 Thread Gabriel Genellina
At Friday 25/8/2006 03:37, Chandrashekhar Kaushik wrote: I dont think i really need that much . Just need to be able to send data across the network and then retrieve it properly independent of the architecture at the remote end :) What about old ASCII? Gabriel Genellina Softlab SRL

Re: lazy arithmetic

2006-08-25 Thread Gabriel G
At Friday 25/8/2006 02:18, [EMAIL PROTECTED] wrote: x+y get translated to x.__add__(y) No that's not true at all. The self argument to __add__ ends up being the Add instance, not the Item instance: z=x+y is translated to z.__add__(y) Well, I deleted my response after I noticed that Simon

Re: pickling and endianess

2006-08-25 Thread Chandrashekhar Kaushik
What about old ASCII? The data is large .it also contains floats double , so ascii will cause two problems - loss of precision and the data will bloat --shekhar -- http://mail.python.org/mailman/listinfo/python-list

Re: setup.py and file extensions like .c++

2006-08-25 Thread Glenn Hutchings
[EMAIL PROTECTED] wrote: Is there any way to get setup.py to recognize file extensions like .c++ in lieu of .cpp? I'd love to not have to rename the source files for the library I'm trying to wrap in a python C extension. The python docs imply that the file extension is dealt with by the

Re: Newbie question about numpy

2006-08-25 Thread Paul Johnston
On Thu, 24 Aug 2006 17:23:49 GMT, Dennis Lee Bieber [EMAIL PROTECTED] wrote: On Thu, 24 Aug 2006 16:38:45 +0100, Paul Johnston [EMAIL PROTECTED] declaimed the following in comp.lang.python: I know its a long time since my degree but that's not matrix multiplication is it ? Define

Re: callable to disappear?

2006-08-25 Thread Antoon Pardon
On 2006-08-23, Terry Reedy [EMAIL PROTECTED] wrote: faulkner [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] what's wrong with hasattr(obj, '__call__')? I have the impression that this is not currently true for all callables . If not, this may be improved in the future. Antoon

Re: sum and strings

2006-08-25 Thread Hendrik van Rooyen
Fredrik Lundh [EMAIL PROTECTED] Wrote: 8 | (I still think a join built-in would be nice, though. but anyone who | argues that join should support numbers too will be whacked with a | great big halibut.) | | /F Strange this - you don't *LOOK* like a

Re: lazy arithmetic

2006-08-25 Thread Peter Otten
[EMAIL PROTECTED] wrote: # This is what I have in mind: class Item(object): def __add__(self, other): return Add(self, other) class Add(Item): def __init__(self, a, b): self.a = a self.b = b a = Item() b = Item() c = a+b # Now, I am going absolutely crazy

smtpd and custom MAIL_FROM/RCPT_TO validation

2006-08-25 Thread alf
Hi, I use smtpd for the SMTP server in my app, but I need a little bit more as far as immediate MAIL_FROM/RCPT_TO validation. Returning from process_message is too late SMTP protocol-wise. The ad hoc solution is to create own SMTPServer2 by deriving from and own SMTPChannel2 by deriving

M$ windows python libs installed in arbitrary directories for customized python distributions

2006-08-25 Thread alf
Hi, for some reason I have to deal with custom python distributions. It turned out it is quite simple - I just install the python from python.org and all the libs needed. Then I take python2n.dll from c:\win*\system32 and move directly to PYTHONDIR. Then I can just tar/zip the PYTHON dir and

Re: how do you get the name of a dictionary?

2006-08-25 Thread Duncan Booth
Steven D'Aprano wrote: a, b, c, d = range(4) spam(a, b, c, d) Traceback (most recent call last): File stdin, line 1, in ? File stdin, line 6, in spam File stdin, line 5, in eggs File stdin, line 4, in beans ValueError: x is too small Of course you can't. x could be any one of a, b,

performance of dictionary lookup vs. object attributes

2006-08-25 Thread Andre Meyer
Hi all I was wondering about the performance comparison of either using a dictionary or an object for a large collection of things. Therefore I have run the attached test. I create a dictionary and an object. Both get the same number of items/attributes, respectively. Then, for both the values

IVI-COM (Interchangeable Virtual Instrument)

2006-08-25 Thread rubbishemail
Hello, has anyone experience using IVI-COM drivers from python? http://adn.tm.agilent.com/index.cgi?CONTENT_ID=1919 http://ivifoundation.org/ Many thanks Daniel -- http://mail.python.org/mailman/listinfo/python-list

Re: Is this a good idea or a waste of time?

2006-08-25 Thread Hendrik van Rooyen
Simon Forman [EMAIL PROTECTED] wrote: 8- | BTW, speaking of strictness, more stricter is invalid English, | just stricter is the correct form. ;-) or alternatively the construct more strict is also acceptable - Hendrik --

Consistency in Python

2006-08-25 Thread Hendrik van Rooyen
Hi, for S where S is a Standard Python type: The slice notation S[n] returns either: The n'th element of S, or The value of the dictionary entry whose key is n. This is beautiful because as a programmer you don't have to worry what S is... (and as an aside - This consistency

Re: OS X and Python - what is your install strategy?

2006-08-25 Thread Diez B. Roggisch
These days, I install the OS X universal binary provided on the Python language web site. You can find it at http://www.python.org/download/releases/2.4.3. It's more comprehensive and much more up-to-date than the version included in OS X. It is. But don't fall for the temptation to remove or

Fw: Is this a good idea or a waste of time?

2006-08-25 Thread Hendrik van Rooyen
Simon Forman [EMAIL PROTECTED] wrote: 8- | BTW, speaking of strictness, more stricter is invalid English, | just stricter is the correct form. ;-) or alternatively the construct more strict is also acceptable - Hendrik

Re: Consistency in Python

2006-08-25 Thread Diez B. Roggisch
Hendrik van Rooyen schrieb: Hi, for S where S is a Standard Python type: The slice notation S[n] returns either: The n'th element of S, or The value of the dictionary entry whose key is n. This is beautiful because as a programmer you don't have to worry what S is...

Re: callable to disappear?

2006-08-25 Thread Georg Brandl
Antoon Pardon wrote: I have been reading http://www.python.org/dev/peps/pep-3100/ en there is written: To be removed: ... callable(): just call the object and catch the exception ... Is there a chance this will be reconsidered? There was some discussion on

Re: List problem

2006-08-25 Thread Georg Brandl
[EMAIL PROTECTED] wrote: For example i write the following code in the Python command line; list = ['One,Two,Three,Four'] Then enter this command, which will then return the following; ['One,Two,Three,Four'] This is already wrong. Assignments do not return anything. Georg --

Re: sum and strings

2006-08-25 Thread Bryan Olson
Fredrik Lundh wrote: [...] besides, in all dictionaries I've consulted, the word sum means adding numbers. That's a result of not looking deeply enough. Fredrik Lundh is partially right, in that Sum usually refers to addition of numbers. Nevertheless, the idea that sum must refer to numbers is

Re: Consistency in Python

2006-08-25 Thread Paul Boddie
Hendrik van Rooyen wrote: There seems to be no common methods such as- prepend - for adding something to the beginning append - for adding something to the end insert[j] - for adding something somewhere in the middle Or have I missed something ? [...] BTW - I understand that

Re: how do you get the name of a dictionary?

2006-08-25 Thread Giles Brown
jojoba wrote: Does anyone know how to find the name of a python data type. Conside a dictionary: Banana = {} Then, how do i ask python for a string representing the name of the above dictionary (i.e. 'Banana')? As many people have already said this question doesn't really make sense, but I

Re: lazy arithmetic

2006-08-25 Thread pianomaestro
Simon Forman wrote: But that's a function, not a class. When you assign add to an attribute of Item it magically becomes a method of Item: Yes, I am looking to understand this magic. Sounds like I need to dig into these descriptor thingies (again). (sound of brain exploding).. Simon. --

Is this a bug of module struct?

2006-08-25 Thread rong . xian
Before I was bitten by the difference below, I think these two ways are the same. However, they are not. Is there any geek who can tell me if this is a bug? (some weird '\x00\x00' was inserted between '0123456789abcd' and 6 ) struct.pack('3I14sI',1,19960101,14,'0123456789abcd',6)

Re: Is this a bug of module struct?

2006-08-25 Thread rong . xian
I got it, alignment issue... struct.pack('!3I14sI',1,19960101,14,'0123456789abcd',6) '\x01\x00\x00\x00%\x910\x01\x0e\x00\x00\x000123456789abcd\x06\x00\x00\x00' struct.pack('!3I14s',1,19960101,14,'0123456789abcd')+struct.pack('!I',6)

Re: Pygame, mouse events and threads

2006-08-25 Thread Ben Sizer
[EMAIL PROTECTED] wrote: Ben Sizer wrote: [EMAIL PROTECTED] wrote: When I put the content of the run and input functions in the main thread, it's working, why not in the thread? Because event handling needs to be done in the main thread. So does rendering. This is a limitation of

Re: Modules... paths... newbie confusion

2006-08-25 Thread Steve Holden
Dennis Lee Bieber wrote: On Tue, 22 Aug 2006 14:32:36 +0100, Steve Holden [EMAIL PROTECTED] declaimed the following in comp.lang.python: You won;t get MySQLdb to run without running the setup.py since IIRC there's a compile step for a C library (and it's that compile step that needs to

Re: how do you get the name of a dictionary?

2006-08-25 Thread Steve Holden
Fredrik Lundh wrote: Steve Holden wrote: Right. Plus it's fun to imagine the effbot hitting itself as hard as some people would obviously have liked to hit it in the past :-) you mean the guy who's spent the last six months downrating every single post I've made on this list over at

Re: Python and STL efficiency

2006-08-25 Thread Ben Sizer
Neil Cerutti wrote: On 2006-08-24, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: It will run a lot faster if it doesn't have to keep resizing the array. I don't see why it should run a lot faster that way. Appending elements to a vector with push_back takes amortized constant time. In the

Re: RE Module

2006-08-25 Thread Anthra Norell
Roman, Your re works for me. I suspect you have tags spanning lines, a thing you get more often than not. If so, processing linewise doesn't work. You need to catch the tags like this: text = re.sub ('(.|\n)*?', '', text) If your text is reasonably small I would recommend this solution. Else

prevent unauthorized call to script

2006-08-25 Thread kudincendol
Hello everyone.I just learn Python this week. So I don't know if this question may have been asked by someone else.I have copy-paste a script called form.py from somewhere else. This script is called from form.html. Both are running in my Apache server. How do I prevent other html files from

Re: M$ windows python libs installed in arbitrary directories forcustomized python distributions

2006-08-25 Thread Fredrik Lundh
alf [EMAIL PROTECTED] wrote: It turned out it is quite simple - I just install the python from python.org and all the libs needed. Then I take python2n.dll from c:\win*\system32 and move directly to PYTHONDIR. Then I can just tar/zip the PYTHON dir and distribute around so users do not have

Re: Best Editor

2006-08-25 Thread mystilleef
I recommend Scribes on Linux. It's simple, fast and powerful. Website: http://scribes.sf.net/ Flash Demo: http://scribes.sf.net/snippets.htm GIF Demo: http://www.minds.may.ie/~dez/images/blog/scribes.html JAG CHAN wrote: Friends, I am trying to learn Python. It will be of great help to me if

Re: Consistency in Python

2006-08-25 Thread Paul McGuire
Paul Boddie [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] snip Moreover, append and insert return no result because the change occurs within an existing object - if you were to return a reference to the changed object, it would be the same reference as the one you already had.

Re: Consistency in Python

2006-08-25 Thread Paul Boddie
Paul McGuire wrote: There's nothing wrong with returning self from a mutator. This was a common idiom in Smalltalk (the syntax for this was ^self, which was probably the most common statement in any Smalltalk program), and permitted the chaining of property mutators into a single line, each

Re: Best Practices for Python Script Development?

2006-08-25 Thread Nick Craig-Wood
metaperl [EMAIL PROTECTED] wrote: high-quality scripts. I know about object-oriented programming and application configuration and have spent 6 years doing professional Perl but have decided that Python is the new choice of serious agile developers. I was where you are a couple of years

Re: performance of dictionary lookup vs. object attributes

2006-08-25 Thread bearophileHUGS
Andre Meyer: Is the test meaningful and are you surprised by the results? I am, actually, because I would have assumed that attribute access with an object should be faster because lookup can be precompiled. The results seem okay. Python is a dynamic language, object attributes (and methods,

Open Office and Python

2006-08-25 Thread F
Hello there! I'd like to load a .csv file to the Open Office spreadsheet from the command line using an arbitrary delimiter through Python. I don't need any fancy formatting and stuff like that, just putting the values in the spreadsheet will do. Is there a relatively simple way to do that?

Re: performance of dictionary lookup vs. object attributes

2006-08-25 Thread Peter Otten
Andre Meyer wrote: Hi all I was wondering about the performance comparison of either using a dictionary or an object for a large collection of things. Therefore I have run the attached test. I create a dictionary and an object. Both get the same number of items/attributes, respectively.

Re: performance of dictionary lookup vs. object attributes

2006-08-25 Thread Fredrik Lundh
Andre Meyer wrote: Is the test meaningful and are you surprised by the results? surprised by the amount of code you needed to test this, at least. and you might wish to use the proper spelling for v = self.obj.__getattribute__(a) which is v = getattr(obj, a)

Re: performance of dictionary lookup vs. object attributes

2006-08-25 Thread Andre Meyer
Good points! It's always good to learn from the pros! So, what it means is that the test is not meaningful, because of the different way that object attributes are accessed (not as o.x, which could be compiled). Nevertheless, the general impression remains that dicts *are* faster than objects,

Re: performance of dictionary lookup vs. object attributes

2006-08-25 Thread Fredrik Lundh
Peter Otten wrote: $ python -m timeit -s'class A(object): pass' -s 'a = A(); a.alpha = 42' 'a.__getattribute__(alpha)' 100 loops, best of 3: 0.674 usec per loop also: timeit -s class A(object): pass -s a = A(); a.alpha = 42 a.__getattribute__('alpha') 100 loops, best of

Re: Consistency in Python

2006-08-25 Thread Brendon Towle
Date: 25 Aug 2006 04:22:37 -0700From: "Paul Boddie" [EMAIL PROTECTED]Subject: Re: Consistency in PythonTo: python-list@python.orgMessage-ID: [EMAIL PROTECTED]Content-Type: text/plain; charset="iso-8859-1"Paul McGuire wrote: But with mutators that return self, a client could write any of these:bx =

Re: performance of dictionary lookup vs. object attributes

2006-08-25 Thread Fredrik Lundh
Andre Meyer wrote: So, what it means is that the test is not meaningful, because of the different way that object attributes are accessed (not as o.x, which could be compiled). correct, but you may be overestimating what the compiler can do. here's the byte code for the various cases: #

django's view.py as class not just methods

2006-08-25 Thread Skink
Hi, I'm relatively new to django and maybe my question is stupid, but... Is it possible to map in urls.py some url not to function in views.py (which has first argument with HttpRequest) but to some class method? In that case each instance of such class would be created when session starts and

Re: Consistency in Python

2006-08-25 Thread Fredrik Lundh
Brendon Towle wrote: So, my question is: Someone obviously thought that it was wise and proper to require the longer versions that I write above. Why? a) maybe they had a working carriage return key ? b) http://pyfaq.infogami.com/why-doesn-t-list-sort-return-the-sorted-list (this also

Re: Open Office and Python

2006-08-25 Thread Simon Brunning
On 8/25/06, F [EMAIL PROTECTED] wrote: I'd like to load a .csv file to the Open Office spreadsheet from the command line using an arbitrary delimiter through Python. I don't need any fancy formatting and stuff like that, just putting the values in the spreadsheet will do. Have you looked at

Re: Open Office and Python

2006-08-25 Thread Ben Sizer
F wrote: I'd like to load a .csv file to the Open Office spreadsheet from the command line using an arbitrary delimiter through Python. I don't need any fancy formatting and stuff like that, just putting the values in the spreadsheet will do. Is there a relatively simple way to do that? I

Re: Python-like C++ library

2006-08-25 Thread catalin . marinas
Will McGugan wrote: I'm forced to use C++ and STL at work, and consequently miss the ease of use of Python. I was wondering if there was a C++ library that implemented the fundamental objects of Python as close as possible, perhaps using STL underneath the hood. Not copying Python but it has

random writing access to a file in Python

2006-08-25 Thread Claudio Grondi
I have a 250 Gbyte file (occupies the whole hard drive space) and want to change only eight bytes in this file at a given offset of appr. 200 Gbyte (all other data in that file should remain unchanged). How can I do that in Python? Claudio Grondi --

Re: Is this a bug of module struct?

2006-08-25 Thread Grant Edwards
On 2006-08-25, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Before I was bitten by the difference below, I think these two ways are the same. However, they are not. As is explained here: http://www.python.org/doc/current/lib/module-struct.html Is there any geek who can tell me if this is a

Re: random writing access to a file in Python

2006-08-25 Thread Tim Peters
[Claudio Grondi] I have a 250 Gbyte file (occupies the whole hard drive space) Then where is Python stored ;-)? and want to change only eight bytes in this file at a given offset of appr. 200 Gbyte (all other data in that file should remain unchanged). How can I do that in Python? Same

Re: Best Practices for Python Script Development?

2006-08-25 Thread Ant
`Pydoc http://docs.python.org/lib/module-pydoc.html`_ seems to be built around modules and I want to document scripts. Any python script *is* a python module. So pydoc is what you are after here. Version Control === Subversion and Trac are a very good combination - Trac is a

Re: Python and STL efficiency

2006-08-25 Thread Ray
Neil Cerutti wrote: I don't see why it should run a lot faster that way. Appending elements to a vector with push_back takes amortized constant time. In the example above, preallocating 4 strings saves (probably) math.log(4, 2) reallocations of the vector's storage along with the

How to handle wrong input in getopt package in Python?

2006-08-25 Thread Daniel Mark
Hello all: I am using getopt package in Python and found a problem that I can not figure out an easy to do . // Correct input D:\python AddArrowOnImage.py --imageDir=c:/ // Incorrect input D:\python AddArrowOnImage.py --imageDi Traceback (most recent call last): File AddArrowOnImage.py, line

Don't use __slots__ (was Re: performance of dictionary lookup vs. object attributes)

2006-08-25 Thread Aahz
In article [EMAIL PROTECTED], [EMAIL PROTECTED] wrote: Andre Meyer: Is the test meaningful and are you surprised by the results? I am, actually, because I would have assumed that attribute access with an object should be faster because lookup can be precompiled. The results seem okay. Python

Re: Best Practices for Python Script Development?

2006-08-25 Thread skip
`Pydoc http://docs.python.org/lib/module-pydoc.html`_ seems to be built around modules and I want to document scripts. Ant Any python script *is* a python module. So pydoc is what you are Ant after here. Assuming you name your scripts so that they are importable (e.g.

Re: all ip addresses of machines in the local network

2006-08-25 Thread Ognjen B
Amit Khemka wrote: On 23 Aug 2006 21:46:21 -0700, damacy [EMAIL PROTECTED] wrote: hi, sandra. no, it's not as complicated as that. all i want to do is to load a database onto different machines residing in the same network. i hope there is a way doing it. or perhaps i have a poor

Re: random writing access to a file in Python

2006-08-25 Thread Claudio Grondi
Tim Peters wrote: [Claudio Grondi] I have a 250 Gbyte file (occupies the whole hard drive space) Then where is Python stored ;-)? and want to change only eight bytes in this file at a given offset of appr. 200 Gbyte (all other data in that file should remain unchanged). How can I

Re: sum and strings

2006-08-25 Thread Paul Rubin
Bryan Olson [EMAIL PROTECTED] writes: And herein is the problem: A class may implement __add__ any way the programmer chooses. Python should require, or at least document requirements, on further properties of addition. Python should insist that addition be symmetric an transitive, and

Re: Python and STL efficiency

2006-08-25 Thread Neil Cerutti
On 2006-08-25, Ben Sizer [EMAIL PROTECTED] wrote: Neil Cerutti wrote: On 2006-08-24, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: It will run a lot faster if it doesn't have to keep resizing the array. I don't see why it should run a lot faster that way. Appending elements to a vector with

Re: lazy arithmetic

2006-08-25 Thread Alex Martelli
[EMAIL PROTECTED] wrote: Simon Forman wrote: But that's a function, not a class. When you assign add to an attribute of Item it magically becomes a method of Item: Yes, I am looking to understand this magic. Sounds like I need to dig into these descriptor thingies (again). (sound of

Re: How to handle wrong input in getopt package in Python?

2006-08-25 Thread skip
Daniel getopt.GetoptError: option --imageDir requires argument Which is precisely what the getopt module should do. Daniel Is there any method in getopt or Python that I could easily Daniel check the validity of each command line input parameter? Getopt already did the validity

Re: performance of dictionary lookup vs. object attributes

2006-08-25 Thread Duncan Booth
Fredrik Lundh wrote: I am, actually, because I would have assumed that attribute access with an object should be faster because lookup can be precompiled. huh? you're using a reflection API; there's no way the compiler can figure out in advance what you're going to pass to getattr(). That

Re: sum and strings

2006-08-25 Thread Neil Cerutti
On 2006-08-25, Paul Rubin http wrote: Bryan Olson [EMAIL PROTECTED] writes: And herein is the problem: A class may implement __add__ any way the programmer chooses. Python should require, or at least document requirements, on further properties of addition. Python should insist that addition

Re: Consistency in Python

2006-08-25 Thread Brendon Towle
Message: 3 Date: Fri, 25 Aug 2006 15:28:46 +0200 From: "Fredrik Lundh" [EMAIL PROTECTED] Subject: Re: Consistency in Python Brendon Towle wrote: So, my question is: Someone obviously thought that it was wise and proper to require the longer versions that I write above. Why? a) maybe they had a

Re: Don't use __slots__ (was Re: performance of dictionary lookup vs. object attributes)

2006-08-25 Thread Gabriel Genellina
At Friday 25/8/2006 11:34, Aahz wrote: The results seem okay. Python is a dynamic language, object attributes (and methods, etc) are kept inside a dict, where you can add and remove them when you like. So using a dict is faster. You can also take a look at __slots__ Taking a look at __slots__

Re: sum and strings

2006-08-25 Thread Paul Rubin
Neil Cerutti [EMAIL PROTECTED] writes: So there isn't, it seems, a practical way of implementing the sum(list of strings) - ''.join(list of strings optimization. ''.join may not be the right way to do it, but obviously there are other ways. This isn't rocket science. --

Re: soap comlex data to plain xml

2006-08-25 Thread Chris Lambacher
You would probably get more responses on the pywebsvcs mailing list http://pywebsvcs.sf.net SOAP goes over HTML, so you can use httplib to do what you want. Just go look up the protocol details (hint use Google). You will probably want to use ZSI or SOAPpy to serialize the request body to xml

Creating an executable installer on Windows

2006-08-25 Thread Bernard Lebel
Hello, I'd like to know how one can create a Windows installer executable. I have this bunch modules, html files, pictures and directories that I'd like to install in various places on a disk drive. When the executable is run, it's like pretty much any standard installation: user answers a few

Re: Don't use __slots__ (was Re: performance of dictionary lookup vs. object attributes)

2006-08-25 Thread skip
Aahz Taking a look at __slots__ is fine as long as you don't actually Aahz use them. Gabriel Why? http://groups.google.com/group/comp.lang.python/browse_thread/thread/451ad25f9c648404/f4ac2dfde32b16fd?lnk=stq=Python+__slots__+aahzrnum=2#f4ac2dfde32b16fd Skip --

Re: sum and strings

2006-08-25 Thread Bryan Olson
Paul Rubin wrote: Are you saying abc+def should not be concatenation? I guess that's reasonable. No, I'm definitely not saying that, or at least I didn't mean that. As long as + is string concatenation though, the principle of least astonishment suggests that sum should conconcatenate

Re: Creating an executable installer on Windows

2006-08-25 Thread Larry Bates
Bernard Lebel wrote: Hello, I'd like to know how one can create a Windows installer executable. I have this bunch modules, html files, pictures and directories that I'd like to install in various places on a disk drive. When the executable is run, it's like pretty much any standard

Re: Consistency in Python

2006-08-25 Thread Terry Reedy
"Brendon Towle" [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED]... Message: 3 Date: Fri, 25 Aug 2006 15:28:46 +0200 From: "Fredrik Lundh" [EMAIL PROTECTED] Subject: Re: Consistency in Python Brendon Towle wrote: [snip] Please post

time.clock() going backwards??

2006-08-25 Thread Giovanni Bajo
Hello, I experimented something very strange, a few days ago. I was debugging an application at a customer's site, and the problem turned out to be that time.clock() was going backwards, that is it was sometimes (randomically) returning a floating point value which was less than the value

Re: RE Module

2006-08-25 Thread Roman
Thanks for your help. A thing I didn't mention is that before the statement row[0] = re.sub(r'.*?', '', row[0]), I have row[0]=re.sub(r'[^ 0-9A-Za-z\\'\.\,[EMAIL PROTECTED](\)\*\\%\%\\\/\:\;\?\`\~\\]', '', row[0]) statement. Hence, the line separators are going to be gone. You mentioned the

Re: sum and strings

2006-08-25 Thread Paddy
Paddy wrote: SNIP Why not make sum work for strings too? It would remove what seems like an arbitrary restriction and aid duck-typing. If the answer is that the sum optimisations don't work for the string datatype, then wouldn't it be better to put a trap in the sum code diverting strings

Re: time.clock() going backwards??

2006-08-25 Thread Michiel Sikma
Op 25-aug-2006, om 16:13 heeft Giovanni Bajo het volgende geschreven: Hello, Is it possible this to be a bug in Python itself (maybe, shooting at the moon, in the conversion between the 64bit performance counter and the floating point representation returned by time.clock ()), or

get a line of text from a socket...

2006-08-25 Thread KraftDiner
If you don't know how long your input data is going to be how can you at least treat it a text line at a time... like looking for new line in the data... Right now recv blocks. Yes I could do a select, but the examples seem a bit complicated for a simple line oriented input... --

Re: time.clock() going backwards??

2006-08-25 Thread K.S.Sreeram
Giovanni Bajo wrote: Hello, I experimented something very strange, a few days ago. I was debugging an application at a customer's site, and the problem turned out to be that time.clock() was going backwards, that is it was sometimes (randomically) returning a floating point value which was

Re: get a line of text from a socket...

2006-08-25 Thread Marc 'BlackJack' Rintsch
In [EMAIL PROTECTED], KraftDiner wrote: If you don't know how long your input data is going to be how can you at least treat it a text line at a time... like looking for new line in the data... Right now recv blocks. Yes I could do a select, but the examples seem a bit complicated for a

namespace problems

2006-08-25 Thread Kiran
Hi all, I am trying to get the following to work, but cant seem to do it the way i want to. ok, so I come into python and do the following: x = 1 then, i have a file called test.py in which i say: print x Now, after having defined x =1 in the python interpreter, i come in and say: import test

Re: CONSTRUCT - Module Attributes and Execution Environment

2006-08-25 Thread lazaridis_com
Fuzzyman wrote: lazaridis_com wrote: I would like to change the construct: if __name__ == '__main__': to something like: if exec.isMain(): My (OO thought) is to place a class in an separate code module and to instantiate an singleton instance which would keep th something like

Re: CONSTRUCT - Module Attributes and Execution Environment

2006-08-25 Thread lazaridis_com
Duncan Booth wrote: lazaridis_com wrote: Are ther alternative constructs/mechanism available, which could be used to add this functionality possiby directly to a code-module? How about something along these lines: -- auto.py - import sys, atexit def

ANN: DMetaph.py An implementation of the Double Metaphone algorithm

2006-08-25 Thread Timothy Grant
Hello everyone, I recently had a need to do some work with fuzzy matches, so I ported Lawrence Philips DMetaph class from C++ to Python. This is currently pretty much a line for line port of his his C++ code. It is not very pythonic at all. Because it is SO ugly, I'm not yet making it available

Re: get a line of text from a socket...

2006-08-25 Thread Jean-Paul Calderone
On 25 Aug 2006 09:37:09 -0700, KraftDiner [EMAIL PROTECTED] wrote: If you don't know how long your input data is going to be how can you at least treat it a text line at a time... like looking for new line in the data... Right now recv blocks. Yes I could do a select, but the examples seem a bit

Re: Best Editor

2006-08-25 Thread crystalattice
JAG CHAN wrote: Friends, I am trying to learn Python. It will be of great help to me if you let me know which one would be best editor for learning Python. Plese note that I would like to have multiplatform editor which will be useful for both LInux and Windows XP. Thanks. My choice is

Re: Don't use __slots__ (was Re: performance of dictionary lookup vs. object attributes)

2006-08-25 Thread bearophileHUGS
Aahz wrote: Taking a look at __slots__ is fine as long as you don't actually use them. I remember the recent discussion about such matters... but I don't understand its dangers fully still. I assume __slots__ may be removed in Python 3.0, but maybe experts need it now an then. Or maybe a experts

  1   2   >