Re: Little Q: how to print a variable's name, not its value?

2005-03-31 Thread Duncan Booth
[EMAIL PROTECTED] wrote: But surely if you create an integer object and assign it a value, e.g. a = 3, why shouldn't Python be able to tell you something like the following: name(a) 'a' ? But why should it return 'a' and not one of these? tokenize.tok_name[3] token.tok_name[3]

Re: Little Q: how to print a variable's name, not its value?

2005-03-31 Thread Bengt Richter
On 30 Mar 2005 21:56:06 -0800, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: my god, I've created a monster! Maybe I should restate my original problem. Actually, the word 'problem' is too strong. I had a little curiosity about whether I could write a couple of lines of code more succinctly, or

Re: Little Q: how to print a variable's name, not its value?

2005-03-31 Thread Bill Mill
On 31 Mar 2005 08:13:30 GMT, Duncan Booth [EMAIL PROTECTED] wrote: [EMAIL PROTECTED] wrote: But surely if you create an integer object and assign it a value, e.g. a = 3, why shouldn't Python be able to tell you something like the following: name(a) 'a' ? But why should it return

Re: Little Q: how to print a variable's name, not its value?

2005-03-31 Thread Aaron Bingham
Stewart Midwinter [EMAIL PROTECTED] writes: [snip] Taking this idea a little further, I'd like to build a 'variable inspector' for my GUI app, so that I don't have to resort to debug statements. Instead, I could pop open a window that lists every variable that has an expected None, string,

Re: UnicodeEncodeError in string conversion

2005-03-31 Thread Serge Orlov
Maurice LING wrote: Hi, I'm working on a script that searches a public database and retrives results using SOAP interface. However, it seems that the results may contains unicodes. When I try to pump the results into Firebird database using kinterbasdb module, some results will give me a

Re: Formated String in optparse

2005-03-31 Thread Peter Otten
Norbert Thek wrote: Is there an easy way to convince optparse to accept newline in the helpstring? and more importand also in the 'desc' string. I tried everything (from the os.linesep) to \n, \r, \r\n, ... The official way (write your own Formatter class) is a bit tedious indeed. Here's a

Re: LD_LIBRARY_PATH - how to set?

2005-03-31 Thread Roman Yakovenko
On 31 Mar 2005 00:51:21 -0800, Serge Orlov [EMAIL PROTECTED] wrote: Roman Yakovenko wrote: Hi. I have small problem. I need to load extension module that depends on shared library. Before actually importing module I tried to edit os.environ or to call directly to os.putenv without any

Re: PIL

2005-03-31 Thread Denis S. Otkidach
On Wed, 30 Mar 2005 08:33:44 -0800 (PST) suresh mathi wrote: SM All 3 images that i try to paste are having a SM transparent background. SM When i try to open the image and paste the background SM becomes black. I masked the black areas but still the SM shape is not that clear. I had similar

Re: Secure scripts variables

2005-03-31 Thread Paul Rubin
Florian Lindner [EMAIL PROTECTED] writes: AFAIK scripts can't be setuid? Can you tell me what you mean and how to do it? Actually it looks like Linux doesn't support setuid scripts. I thought the feature had been restored. There is a well-known security hole but there are workarounds for it

Re: Formated String in optparse

2005-03-31 Thread MyHaz
If you haven't looked into it, you may like the way class OptionParser() makes the help text for you. - Haz -- http://mail.python.org/mailman/listinfo/python-list

Re: Formated String in optparse

2005-03-31 Thread Peter Otten
MyHaz wrote: If you haven't looked into it, you may like the way class OptionParser() makes the help text for you. What do you mean? To clarify: OptionParser's help message in the default format is usage: discard_newline.py [options] einsamer nie als im august erfuellungsstunde im gelaende

Re: [Tkinter] LONG POST ALERT: Setting application icon on Linux

2005-03-31 Thread Tim Jarman
Jeff Epler wrote: I have written a rather hackish extension to use NET_WM_ICON to set full-color icons in Tkinter apps. You can read about it here: http://craie.unpy.net/aether/index.cgi/software/01112237744 you'll probably need to take a look at the EWMH spec, too. If KDE supports

property and virtuality

2005-03-31 Thread Laszlo Zsolt Nagy
My problem is about properties and the virtuality of the methods. I would like to create a property whose get and set methods are virtual. I had the same problems in Delphi before and the solution was the same. I created a private _get method and a public get method. The former one will call the

no module named fcntl

2005-03-31 Thread Prakash A
Hello All, I new user to python. I am using a product called FSH, some of its parts are implemented in Python. This is like a ssh to run a command on remote machine. First time while runningthe fsh there was on. # fshd Traceback (most recent call last): File "/usr/bin/in.fshd",

Re: How To Do It Faster?!?

2005-03-31 Thread Laszlo Zsolt Nagy
[EMAIL PROTECTED] wrote: Hello NG, in my application, I use os.walk() to walk on a BIG directory. I need to retrieve the files, in each sub-directory, that are owned by a particular user. Noting that I am on Windows (2000 or XP), this is what I do: for root, dirs, files in

Re: property and virtuality

2005-03-31 Thread Diez B. Roggisch
I cannot override C2._getname instead, because c2.name would print 'Test2 instead of lala. Clearly, the property stores a reference to the get and set methods and it is not possible to have it use the new methods. Creating a new property is the worst - need to duplicate code and also C3.name

Re: LD_LIBRARY_PATH - how to set?

2005-03-31 Thread Joal Heagney
Roman Yakovenko wrote: Thanks for help. But it is not exactly solution I am looking for. I would like to do it from python script. For example update_env() #- this function will change LD_LIBRARY_PATH import extension_that_depends_on_shared_library Roman On Mar 31, 2005 9:35 AM, John Abel [EMAIL

Re: LD_LIBRARY_PATH - how to set?

2005-03-31 Thread Joal Heagney
Joal Heagney wrote: Roman Yakovenko wrote: Thanks for help. But it is not exactly solution I am looking for. I would like to do it from python script. For example update_env() #- this function will change LD_LIBRARY_PATH import extension_that_depends_on_shared_library Roman On Mar 31, 2005 9:35

Re: math - need divisors algorithm

2005-03-31 Thread Joal Heagney
Ed Suominen wrote: 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) Is this compact enough? :-) def properDivisors(N): return

Error

2005-03-31 Thread Bounced mail
The original message was received at Thu, 31 Mar 2005 14:40:33 +0200 from python.org [34.34.108.175] - The following addresses had permanent fatal errors - python-list@python.org - Transcript of the session follows - ... while talking to 136.158.179.151: DATA 400-aturner;

Re: LD_LIBRARY_PATH - how to set?

2005-03-31 Thread Antoon Pardon
Op 2005-03-31, Joal Heagney schreef [EMAIL PROTECTED]: Joal Heagney wrote: Roman Yakovenko wrote: Thanks for help. But it is not exactly solution I am looking for. I would like to do it from python script. For example update_env() #- this function will change LD_LIBRARY_PATH import

How To Do It Faster?!?

2005-03-31 Thread andrea . gavana
Hello NG, in my application, I use os.walk() to walk on a BIG directory. I need to retrieve the files, in each sub-directory, that are owned by a particular user. Noting that I am on Windows (2000 or XP), this is what I do: for root, dirs, files in os.walk(MyBIGDirectory): a =

Re: property and virtuality

2005-03-31 Thread Laszlo Zsolt Nagy
I'm not aware of possibility that works as you first expected. You yourself explained why. But _maybe_ you can use lambda here - that creates the layer of indirection one needs. foo = property(lambda self: self.get_foo(), lamda self,v: self.set_foo(v)) Great. I'll think about this and decide

Rif: Re: How To Do It Faster?!?

2005-03-31 Thread andrea . gavana
Hello Lazslo NG, You can use the stat module to get attributes like last modification date, uid, gid etc. The documentation of the stat module has a nice example. Probably it will be faster because you are running an external program (well, dir may be resident but still the OS needs to create a

hex string into binary format?

2005-03-31 Thread Tertius Cronje
Hi, How do I get a hexvalued string to a format recognized for binary calculation? import binascii s1 = '1C46BE3D9F6AA820' s2 = '8667B5236D89CD46' i1 = binascii.unhexlify(s1) i2 = binascii.unhexlify(s2) x = i1 ^i2 TypeError: unsupported operand type(s) for ^: 'str' and 'str' Many

Generating RTF with Python

2005-03-31 Thread Andreas Jung
Hi, does anyone know of a high-level solution to produce RTF from Python (something similar to Reportlab for producing PDF)? Thanks, Andreas pgptlX6o8zD33.pgp Description: PGP signature -- http://mail.python.org/mailman/listinfo/python-list

RE: Generating RTF with Python

2005-03-31 Thread Tertius Cronje
I'll use http://www.tug.org/ or a smaller solution http://lout.sourceforge.net/ together with one of many Python template solutions to generate to generate reports. HTH T -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Andreas Jung Sent: Thursday,

Re: How To Do It Faster?!?

2005-03-31 Thread Max Erickson
I don't quite understand what your program is doing. The user=a[18::20] looks really fragile/specific to a directory to me. Try something like this: a=os.popen(dir /s /q /-c /a-d + root).read().splitlines() Should give you the dir output split into lines, for every file below root(notice that

Re: Making a DLL with python?

2005-03-31 Thread Gerald Klix
I think you can, as long as you have a C-Compiler available. I used pyrex to embedd python into a Linux PAM-Module and i used C-Types to embbed Python into a Windows DLL. With hindsight, the pyrex solution was much fatser to develop and less complicated. Pyrex provides an example. Ctypes:

AttributeError: 'module' object has no attribute 'setdefaulttimeout'

2005-03-31 Thread adrian
I get those errors when I run: /usr/local/bin/SquidClamAV_Redirector.py -c /etc/squid/SquidClamAV_Redirector.conf ## Traceback (most recent call last): File /usr/local/bin/SquidClamAV_Redirector.py, line 573, in ? redirector = SquidClamAV_Redirector(config) File

Re: Recording Video with Python

2005-03-31 Thread Diez B. Roggisch
[EMAIL PROTECTED] wrote: Is there a video module so that I can write a Linux Python script to record video coming over USB video cams? You can open the device and read the images - I've done that before. No module needed. But I don't remember how things worked - just download the source for a

Re: Making a DLL with python?

2005-03-31 Thread Diez B. Roggisch
[EMAIL PROTECTED] wrote: Can I use python to make a regular Windows DLL that will be called from other programs? I know I can use the win32 extensions to make a COM server, but I need a straight DLL. Maybe elmer is what you need - no own experiences though.

Re: AttributeError: 'module' object has no attribute 'setdefaulttimeout'

2005-03-31 Thread Peter Otten
adrian wrote: urllib.socket.setdefaulttimeout(self.timeout) AttributeError: 'module' object has no attribute 'setdefaulttimeout' socket.setdefaulttimeout() was added in Python 2.3. You need to upgrade. Peter -- http://mail.python.org/mailman/listinfo/python-list

(no subject)

2005-03-31 Thread python-list-bounces+archive=mail-archive . com
#! rnews 1066 Newsgroups: comp.lang.python Path: news.xs4all.nl!newsspool.news.xs4all.nl!transit.news.xs4all.nl!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!nntp.abs.net!attws2!ip.att.net!NetNews1!xyzzy!nntp From: Harry George [EMAIL PROTECTED] Subject: Re: hex string into binary format?

Re: Generating RTF with Python

2005-03-31 Thread Axel Straschil
Hello! does anyone know of a high-level solution to produce RTF from Python=20 (something similar to Reportlab for producing PDF)? Spend hours of googeling and searching, also in this NG, about two months ago. My conclusion is: On windwos, maybe you can include some hacks with dll's, under

Re: hex string into binary format?

2005-03-31 Thread Peter Hansen
Tertius Cronje wrote: How do I get a hexvalued string to a format recognized for binary calculation? import binascii s1 = '1C46BE3D9F6AA820' s2 = '8667B5236D89CD46' i1 = binascii.unhexlify(s1) i2 = binascii.unhexlify(s2) Try this instead: i1 = long(s1, 16) i2 = long(s2, 16) x = i1 ^i2 --

Re: tkinter destroy()

2005-03-31 Thread max(01)*
[EMAIL PROTECTED] wrote: Your app seems to give the right state values only if you select 'Freni a posto'. But I see you recognize that with your 'FIXME' note. also the app seems to have too many variables and widgets defined as self objects. That isn't necessary unless they will be used

Re: redundant imports

2005-03-31 Thread Peter Hansen
max(01)* wrote: this leads me to another question. since *.pyc files are automatically created the first time an import statement in executed on a given module, i guess that if i ship a program with modules for use in a directory where the user has no write privileges then i must ship the

Re: PyParsing module or HTMLParser

2005-03-31 Thread Paul McGuire
Yes, drop me a note if you get stuck. -- Paul base64.decodestring('cHRtY2dAYXVzdGluLnJyLmNvbQ==') -- http://mail.python.org/mailman/listinfo/python-list

ANN: PyDev 0.9.2 released

2005-03-31 Thread Fabio Zadrozny
Hi All, PyDev - Python IDE (Python development enviroment for Eclipse) version 0.9.2 has just been released. Check the homepage (http://pydev.sourceforge.net/) for more details. Regards, Fabio Zadrozny -- Software Developer ESSS - Engineering

Re: problem running the cgi module

2005-03-31 Thread Kent Johnson
chris patton wrote: Hi everyone. I'm trying to code an HTML file on my computer to make it work with the cgi module. For some reason I can't get it running. This is my HTML script: -- form method=post action=C:\chris_on_c\hacking\formprinter.py

Re: Generating RTF with Python

2005-03-31 Thread Max M
Axel Straschil wrote: Hello! does anyone know of a high-level solution to produce RTF from Python=20 (something similar to Reportlab for producing PDF)? Spend hours of googeling and searching, also in this NG, about two months ago. My conclusion is: On windwos, maybe you can include some hacks

Re: Access denied calling FireEvent in Python

2005-03-31 Thread calfdog
Regarding the call to FireEvent: I still do not understand why you could call fi­reEvent('onchange') and now it you have to call Fi­reEvent('onchange') to avoid the Access denied message In Ruby or Perl you still call fi­reEvent('onchange') it has not changed and you do not get the access denied

Re: AttributeError: 'module' object has no attribute 'setdefaulttimeout'

2005-03-31 Thread infidel
That just means the urllib.socket module doesn't have any function named setdefaulttimeout in it. It appears there might be something wrong with your socket module as mine has it: py import urllib py f = urllib.socket.setdefaulttimeout py f built-in function setdefaulttimeout --

A question about the use of PyArg_Parse function

2005-03-31 Thread Barak Azulay
Hi, I hope I'm writing to the rightplace. In case I'm out of place can you please refer to the right direction. I have a question about the correct way to use PyArg_Parse API function. I'm writing a C module to be called from python code (ver 2.3.4) In one of the function I have to

Re: property and virtuality

2005-03-31 Thread Steven Bethard
Laszlo Zsolt Nagy wrote: My problem is about properties and the virtuality of the methods. I would like to create a property whose get and set methods are virtual. Perhaps you want to roll your own VirtualProperty descriptor? Here's one based off the property implementation in Raymond

Re: returning a list: IndexError

2005-03-31 Thread Steven Bethard
[EMAIL PROTECTED] wrote: Thats right. I wanted c1 and c2 to retrieve the values returned by t1 and t2 . Values for t1 and t2 could be anything. Also tbl is global. Then you need to return t1 and t2 in test, e.g.: py import numarray as na py tbl = na.zeros((32, 16)) py def test(): ... t1 = 0x0

Problem with national characters

2005-03-31 Thread Leif B. Kristensen
I'm developing a routine that will parse user input. For simplicity, I'm converting the entire input string to upper case. One of the words that will have special meaning for the parser is the word før, (before in English). However, this word is not recognized. A test in the interactive shell

Re: Generating RTF with Python

2005-03-31 Thread Axel Straschil
Hello! I looked at this a while ago, which might be a starter. http://pyrtf.sourceforge.net/ Don't remember why I didn't spent much time on that. Sombody has experience with pyrtf on an production project (is it stable ;-)) Lg, AXEL. -- Aber naja, ich bin eher der Forentyp. Wolfibolfi's

Re: urllib.urlretireve problem

2005-03-31 Thread Ritesh Raj Sarraf
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Diez B. Roggisch wrote: You could for instance try and see what kind of result you got using the unix file command - it will tell you that you received a html file, not a deb. Or check the mimetype returned - its text/html in the error case of

split an iteration

2005-03-31 Thread Robin Becker
This function from texlib in oedipus.sf.net is a real cpu hog and I determined to see if it could be optimized. def add_active_node(self, active_nodes, node): Add a node to the active node list. The node is added so that the list of active nodes is always sorted by line number, and

Re: Turn of globals in a function?

2005-03-31 Thread Ron_Adam
On Thu, 31 Mar 2005 16:28:15 +1200, Greg Ewing [EMAIL PROTECTED] wrote: Oren Tirosh wrote: def noglobals(f): . import new . return new.function( . f.func_code, . {'__builtins__':__builtins__}, . f.func_name, . f.func_defaults, . f.func_closure . )

ANN: ActivePython 2.4.1 build 245 is available

2005-03-31 Thread Trent Mick
I'm pleased to announce that ActivePython 2.4.1 build 245 is now available from: http://www.ActiveState.com/Products/ActivePython ActivePython 2.4.1.245 is a bug-fix release matching the recent core Python 2.4.1 release. ActivePython builds for Linux, Solaris and Windows are available. We

Re: AttributeError: 'module' object has no attribute 'setdefaulttimeout'

2005-03-31 Thread Steve Holden
Peter Otten wrote: adrian wrote: urllib.socket.setdefaulttimeout(self.timeout) AttributeError: 'module' object has no attribute 'setdefaulttimeout' socket.setdefaulttimeout() was added in Python 2.3. You need to upgrade. Peter Alternatively you might still be ablet o get Tom O'Malley's

Re: Little Q: how to print a variable's name, not its value?

2005-03-31 Thread Ron_Adam
On 30 Mar 2005 08:43:17 GMT, Duncan Booth [EMAIL PROTECTED] wrote: Here is a rough attempt at printing the names of a variable. It will pick up several names where appropriate, but deliberately doesn't attempt to get all possible names (as you say, that could result in endless loops). In

Re: split an iteration

2005-03-31 Thread Peter Otten
Robin Becker wrote: Is there a fast way to get enumerate to operate over a slice of an iterable? I think you don't need that here: e = enumerate(active_nodes) for insert_index, a in e: # ... for index, a in e: # ... Peter -- http://mail.python.org/mailman/listinfo/python-list

Printing Varable Names Tool.. Feedback requested.

2005-03-31 Thread Ron_Adam
Hi, Sometimes it just helps to see what's going on, so I've been trying to write a tool to examine what names are pointing to what objects in the current scope. This still has some glitches, like not working in winpython or the command line, I get a 'stack not deep enough' error. I haven't

Re: hiding a frame in tkinter

2005-03-31 Thread faramarz yari
thanks -- http://mail.python.org/mailman/listinfo/python-list

Re: Printing Varable Names Tool.. Feedback requested.

2005-03-31 Thread Ron_Adam
On Thu, 31 Mar 2005 18:37:53 GMT, Ron_Adam [EMAIL PROTECTED] wrote: Hi, Sometimes it just helps to see what's going on, so I've been trying to write a tool to examine what names are pointing to what objects in the current scope. This still has some glitches, like not working in winpython or

Re: problem running the cgi module

2005-03-31 Thread chris patton
Thanks alot. This helps tremendously -- http://mail.python.org/mailman/listinfo/python-list

How To Do It Faster?!?

2005-03-31 Thread andrea_gavana
Hello max NG, I don't quite understand what your program is doing. The user=a[18::20] looks really fragile/specific to a directory to me. I corrected it to user=a[18::5][:-2], it was my mistake. However, that command is NOT specific to a particular directory. You can try to whatever directory

Stylistic question about inheritance

2005-03-31 Thread Andrew Koenig
Suppose I want to define a class hierarchy that represents expressions, for use in a compiler or something similar. We might imagine various kinds of expressions, classified by their top-level operator (if any). So, an expression might be a primary (which, in turn, might be a variable or a

Change between Python 2.3 and 2.4 under WinXP

2005-03-31 Thread Franz Steinhäusler
Hello, My second question from my last post (PyQt on Python 2.4), I think, is a little got under (i have installed both Python 2.3 and Python 2.4) Is there any possibility under WinXP, to alterntate quickly (with batch file or similary) between python23 and python24. Many thanks, -- Franz

Controling the ALU

2005-03-31 Thread Cesar Andres Roldan Garcia
Hi How can I control an ALU from a PC using Python? Thanks! Hola... Como puedo controlar la ALU de un PC usando Pyhton? Gracias! -- Atentamente, Cesar Andres Roldan Garcia Presidente Comunidad Académica Microsoft Javeriana Teléfono: 300 8169857 Cali - Colombia --

Re: Stylistic question about inheritance

2005-03-31 Thread Carl Banks
Andrew Koenig wrote: [snip] Of course, there are reasons to have a base class anyway. For example, I might want it so that type queries such as isinstance(foo, Expr) work. My question is: Are there other reasons to create a base class when I don't really need it right now? Well, Python

Re: Stylistic question about inheritance

2005-03-31 Thread Martin v. Löwis
Andrew Koenig wrote: Of course, there are reasons to have a base class anyway. For example, I might want it so that type queries such as isinstance(foo, Expr) work. My question is: Are there other reasons to create a base class when I don't really need it right now? You would normally try to

Re: Stylistic question about inheritance

2005-03-31 Thread Lonnie Princehouse
If you try this sort of inheritance, I'd recommend writing down the formal grammar before you start writing classes. Don't try to define the grammar through the inheritance hierarchy; it's too easy to accidentally build a hierarchy that can't be translated into a single-pass-parsable grammar...

Re: Stylistic question about inheritance

2005-03-31 Thread Andrew Koenig
Carl Banks [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Well, Python seems to get along fine without the ability to do isinstance(foo,file_like_object); probably better off in the end for it. So I'd say you should generally not do it. Inheritence is for when different classes

Re: Stylistic question about inheritance

2005-03-31 Thread Andrew Koenig
Martin v. Löwis [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] You would normally try to avoid type queries, and rely on virtual methods instead, if possible. Of course. It seems likely for the application that code can be shared across different subclasses, for example, you

Re: Change between Python 2.3 and 2.4 under WinXP

2005-03-31 Thread Martin v. Löwis
Franz Steinhäusler wrote: Is there any possibility under WinXP, to alterntate quickly (with batch file or similary) between python23 and python24. No need to change between them. Just install them both, and select which one to use on a per-invocation base. I.e. do c:\python23\python.exe foo.py

Re: Stylistic question about inheritance

2005-03-31 Thread Andrew Koenig
Lonnie Princehouse [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] If you try this sort of inheritance, I'd recommend writing down the formal grammar before you start writing classes. Don't try to define the grammar through the inheritance hierarchy; it's too easy to accidentally

Re: Stylistic question about inheritance

2005-03-31 Thread Irmen de Jong
Andrew Koenig wrote: Lonnie Princehouse [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] If you try this sort of inheritance, I'd recommend writing down the formal grammar before you start writing classes. Don't try to define the grammar through the inheritance hierarchy; it's too

Re: Controling the ALU

2005-03-31 Thread Grant Edwards
On 2005-03-31, Cesar Andres Roldan Garcia [EMAIL PROTECTED] wrote: How can I control an ALU from a PC using Python? The ALU is buried pretty deep in the CPU. The ALU is part of what is actually executing the instructions that _are_ Python. -- Grant Edwards grante

Re: Stylistic question about inheritance

2005-03-31 Thread Donn Cave
In article [EMAIL PROTECTED], Andrew Koenig [EMAIL PROTECTED] wrote: Carl Banks [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Well, Python seems to get along fine without the ability to do isinstance(foo,file_like_object); probably better off in the end for it. So I'd

RE: IMAP4.search by message-id ?

2005-03-31 Thread Sean Dodsworth
Tony Meyer wrote: Can anyone tell me how to get a message's number from the message-id using IMAP4.search? I've tried this: resp, items = server.search(None, 'HEADER', 'Message-id', msgID) but it gives me a 'bogus search criteria' error import imaplib i =

Re: Change between Python 2.3 and 2.4 under WinXP

2005-03-31 Thread Peter Hansen
Martin v. Löwis wrote: Franz Steinhäusler wrote: Is there any possibility under WinXP, to alterntate quickly (with batch file or similary) between python23 and python24. If you are concerned that the .py association changes, you have two options: 1. manually edit the registry. Under

Re: Stylistic question about inheritance

2005-03-31 Thread Stefan Seefeld
Andrew Koenig wrote: Of course, there are reasons to have a base class anyway. For example, I might want it so that type queries such as isinstance(foo, Expr) work. My question is: Are there other reasons to create a base class when I don't really need it right now? Coming from C++ myself, I

(no subject)

2005-03-31 Thread python-list-bounces+archive=mail-archive . com
#! rnews 1765 Newsgroups: comp.lang.python Path:

Re: Stylistic question about inheritance

2005-03-31 Thread Martin v. Löwis
Andrew Koenig wrote: So, for example, you don't think it's worth including the base class as a way of indicating future intent? No. In this respect, I believe in XP: refactor when the need comes up, but not before. Regards, Martin -- http://mail.python.org/mailman/listinfo/python-list

Re: Stylistic question about inheritance

2005-03-31 Thread Bengt Richter
On Thu, 31 Mar 2005 20:24:08 GMT, Andrew Koenig [EMAIL PROTECTED] wrote: Martin v. Löwis [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] You would normally try to avoid type queries, and rely on virtual methods instead, if possible. Of course. It seems likely for the application

Re: Controling the ALU

2005-03-31 Thread Michael Spencer
Grant Edwards wrote: On 2005-03-31, Cesar Andres Roldan Garcia [EMAIL PROTECTED] wrote: How can I control an ALU from a PC using Python? The ALU is buried pretty deep in the CPU. The ALU is part of what is actually executing the instructions that _are_ Python. Maybe: from __builtin__ import

Re: split an iteration

2005-03-31 Thread Raymond Hettinger
[Robin Becker] This function from texlib in oedipus.sf.net is a real cpu hog and I determined to see if it could be optimized. def add_active_node(self, active_nodes, node): Add a node to the active node list. The node is added so that the list of active nodes is always

Re: Problem with national characters

2005-03-31 Thread david . tolpin
Is there a way around this problem? put import sys sys.setdefaultencoding('UTF-8') into sitecustomize.py in the top level of your PYTHONPATH . -- http://mail.python.org/mailman/listinfo/python-list

Re: redundant imports

2005-03-31 Thread Steve Holden
Peter Hansen wrote: max(01)* wrote: this leads me to another question. since *.pyc files are automatically created the first time an import statement in executed on a given module, i guess that if i ship a program with modules for use in a directory where the user has no write privileges then i

Re: Problem with national characters

2005-03-31 Thread Leif B. Kristensen
[EMAIL PROTECTED] wrote: put import sys sys.setdefaultencoding('UTF-8') into sitecustomize.py in the top level of your PYTHONPATH . Uh ... it doesn't seem like I've got PYTHONPATH defined on my system in the first place: [EMAIL PROTECTED] leif $ env |grep -i python

Re: Stylistic question about inheritance

2005-03-31 Thread Lonnie Princehouse
Well, that's true, but I meant to convey that no grammatical entity is the base class of another entity, so it's a flat inheritance tree in that respect. ASTNode would not be something that the parser would know anything about. I guess that's sort of moot if your expression trees are just a

mod_python and zope

2005-03-31 Thread David Bear
I will be running zope, and I would also like to run mod_python. The problem arised when zope wants a threaded version of python and mod_python wants no_threads. I've been searching the mod_python site for pointers on how to install two instances of python, then configuring mod_python to use the

Re: split an iteration

2005-03-31 Thread Robin Becker
Peter Otten wrote: Robin Becker wrote: Is there a fast way to get enumerate to operate over a slice of an iterable? I think you don't need that here: e = enumerate(active_nodes) for insert_index, a in e: # ... for index, a in e: # ... Peter I tried your solution, but I think we miss the

Re: Problem with national characters

2005-03-31 Thread Leif B. Kristensen
[EMAIL PROTECTED] wrote: put import sys sys.setdefaultencoding('UTF-8') into sitecustomize.py in the top level of your PYTHONPATH . I found out of it, sort of. Now I've got a PYTHONPATH that points to my home directory, and followed your instructions. The first time I got an error

Re: Change between Python 2.3 and 2.4 under WinXP

2005-03-31 Thread Cappy2112
Do you really think this is a safe solution? How do you deal with features that are in new 2.4, but you invoke it with the exe from 2.3? The imports have to be handled as well, and the dlls, and the libs too -- http://mail.python.org/mailman/listinfo/python-list

Re: Numarray newbie question

2005-03-31 Thread Colin J. Williams
ChinStrap wrote: I know there are probably alternatives for this with the standard library, but I think that would kill the speed I get with numarray: Say I have two 2-dimensional numarrays (x_mat and y_mat, say), and a function f(x,y) that I would like to evaluate at every index. Basically I want

Re: split an iteration

2005-03-31 Thread Robin Becker
Raymond Hettinger wrote: [Robin Becker] This function from texlib in oedipus.sf.net is a real cpu hog and I determined to see if it could be optimized. def add_active_node(self, active_nodes, node): Add a node to the active node list. The node is added so that the list of active nodes is

assignments - want a PEP

2005-03-31 Thread Kay Schluehr
From time to time I still use my old Mathematica system. The Mathematica language has some nice properties. The one I like best is the possibility to create symbols from nothing. Translated into the Python realm following creations are possible: a a That's it. Just make an 'a' as a pure symbol.

Re: assignments - want a PEP

2005-03-31 Thread Paul Rubin
Kay Schluehr [EMAIL PROTECTED] writes: a = Symbol() a a Use a = Symbol('a') instead and it should solve most of the problems you mention. What's supposed to happen anyway, in your proposal, after a = Symbol() b = a print b ? --

System bell

2005-03-31 Thread Baza
Am I right in thinking that print \a should sound the system, 'bell'? B -- Computer says, 'no' -- http://mail.python.org/mailman/listinfo/python-list

Re: Problem with national characters

2005-03-31 Thread Leif B. Kristensen
Leif B. Kristensen skrev: Is there something else I have to do? Please forgive me for talking with myself here :-) I should have looked up Unicode in Learning Python before I asked. This seems to work: u'før'.upper() u'F\xd8R' u'FØR' u'F\xd8R' 'FØR' 'F\xd8R' So far, so good. Note that the

assignments - want a PEP

2005-03-31 Thread Kay Schluehr
From time to time I still use my old Mathematica system. The Mathematica language has some nice properties. The one I like best is the possibility to create symbols from nothing. Translated into the Python realm following creations are possible: a a That's it. Just make an 'a' as a pure symbol.

Re: Problem with national characters

2005-03-31 Thread Max M
Leif B. Kristensen wrote: Is there a way around this problem? My character set in Linux is ISO-8859-1. In Windows 2000 it should be the equivavent Latin-1, though I'm not sure about which character set the command shell is using. The unicode methods seems to do it correctly. So you can decode your

Re: Newbie Shell Editor Question

2005-03-31 Thread Scott David Daniels
Tim Roberts wrote: Kash [EMAIL PROTECTED] wrote: ...However when I start idle and run a program from it; I get the following types of errors Idle is already running the python interpreter. You don't need to start another copy. It is just like you had typed python at a command line. If you

Re: Making a DLL with python?

2005-03-31 Thread alex23
Larry Bates wrote: Almost all languages can dispatch a COM object easily. Being stuck using VBScript at work, I kind of poked around COM creation one day and was surprised to find that it's possible to just drop python script directly into COM objects. Five minutes later and I was finally using

  1   2   >