Febrl-0.3 released

2005-04-08 Thread Peter Christen
Canberra, 7 April 2005 The ANU Data Mining Group is pleased to announce the release of Febrl 0.3, a prototype open source record linkage, deduplication and geocoding system intended to make probabilistic record linkage easier, faster and more accurate for biomedical and other researchers. The

[ANN] Voidspace Pythonutils Updates

2005-04-08 Thread Fuzzyman
Lots of updates to the Voidspace modules and recipes. Update to the Firedrop plugins see : http://www.voidspace.org.uk/python/programs.shtml#firedrop New version of FireSpell the spell checker (based on PyEnchant by Ryan Kelly) New plugin called FireMail which lets you send blog entries (or

Epigrass-1.3.36 is available!

2005-04-08 Thread [EMAIL PROTECTED]
EpiGrass (epigrass.sourceforge.net) is a platform for network epidemiological simulation and analysis. It enables researchers to perform comprehensive spatio-temporal simulations incorporating epidemiological data and models for disease transmission and control in order to create sophisticated

BayPIGgies: April 14, 7:30pm (FIRST meeting at IronPort)

2005-04-08 Thread Aahz
NOTE: we are no longer meeting at Stanford; the April meeting is at IronPort in San Bruno The next meeting of BayPIGgies will be Thurs, April 14 at 7:30pm. Guido van Rossum (and any other BayPIGgies who wish to contribute) will review the activities at PyCon 2005. BayPIGgies meetings alternate

Re: curious problem with large numbers

2005-04-08 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

Re: Sockets

2005-04-08 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: Multiple inheritance: Interface problem workaround, please comment this

2005-04-08 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

Re: change extensions

2005-04-08 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. --

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

2005-04-08 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

Re: Problems extracting attachment from email

2005-04-08 Thread foten
Lee Harr [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED]... 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

Re: Problems extracting attachment from email

2005-04-08 Thread Max M
foten 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 f.write(msg.get_payload()) I see that the last 255

Re: logging as root using python script

2005-04-08 Thread Paul Casteels
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 should login as root and execute my command and logout from root to my existing account. IS is possible? Thanx in advance. Hi, You can compile the small .c program and

Problems On Path

2005-04-08 Thread andrea . gavana
Hello NG, yesterday I installed Python 2.4.1 (together with all the site-packages I need for it, including Pythonwin, wxPython, py2exe, etc...), but then I found that for some of my py2exe generated application there were some problems. So, I came back and I re-installed Python 2.3.4 as

__builtins__ wreidness

2005-04-08 Thread Laszlo Zsolt Nagy
Given this module test.py: print type(__builtins__) I ran into a wreid thing. 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. __builtins__ module '__builtin__' (built-in) type(__builtins__) type

Re: Grouping code by indentation - feature or ******?

2005-04-08 Thread Tim Tyler
I, Tim Tyler [EMAIL PROTECTED] wrote or quoted: What do you guys think about Python's grouping of code via indentation? Some relevant resources: http://c2.com/cgi/wiki?PythonWhiteSpaceDiscussion http://c2.com/cgi/wiki?IndentationEqualsGrouping

doubt regarding Conversion of date into timestamp

2005-04-08 Thread praba kar
Dear All, I am new to Python I want to know how to change a time into timestamp eg Fri, 8 Apr 2005 09:22:14 +0900 like format date I want to change as a timestamp. I have used below code to get timestamp import time time.strptime(v,'%a, %d %b %Y %X +0900') function. This function will

changing from python2.3 to python2.4

2005-04-08 Thread Uwe Mayer
I've written a little application which uses the bang-line #!/usr/bin/python to call the interpreter. As python 2.4 comes distributed with other distroes this breaks my application as its modules are installed in /usr/local/lib/python2.3/site-packages/... and python2.4 does not look there. How

Re: curious problem with large numbers

2005-04-08 Thread Dan Bishop
Chris Fonnesbeck wrote: 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 Don't forget that you can write your own Infinity. (Warning: Buggy

Re: doubt regarding Conversion of date into timestamp

2005-04-08 Thread Max M
praba kar wrote: Dear All, I am new to Python I want to know how to change a time into timestamp Is there any specific reason for not using datetime instead of time ? -- hilsen/regards Max M, Denmark http://www.mxm.dk/ IT's Mad Science -- http://mail.python.org/mailman/listinfo/python-list

Thoughts on some stdlib modules

2005-04-08 Thread vegetax
I was messing around in google looking for the available python form validation modules when i found this: http://www.jorendorff.com/articles/python/path/, and i realized that is very similar to my python fileutils module,which encapsulate,path operations,file operations,etc. And those thoughts

Re: __builtins__ wreidness

2005-04-08 Thread Fredrik Lundh
Laszlo Zsolt Nagy wrote: Given this module test.py: print type(__builtins__) I ran into a wreid thing. 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. __builtins__ module '__builtin__'

args attribute of Exception objects

2005-04-08 Thread Sébastien de Menten
Hi, When I need to make sense of a python exception, I often need to parse the string exception in order to retrieve the data. Example: try: print foo except NameError, e: print e.args symbol = e.args[0][17:-16] == (NameError: name 'foo' is not defined, ) or try: (4).foo except

Re: 'Address already in use' when using socket

2005-04-08 Thread J Berends
Peter Hansen wrote: 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 I agree

decorating functions with generic signatures (not for the faint of heart)

2005-04-08 Thread Michele Simionato
I have realized today that defining decorators for functions with generic signatures is pretty non-trivial. Consider for instance this typical code: #traced_function.py def traced_function(f): def newf(*args, **kw): print calling %s with args %s, %s % (f.__name__, args, kw)

Re: Problem with access to shared memory(W2K) SOLVED

2005-04-08 Thread Claudio Grondi
I have got a solution to my problem from Thomas Heller by email. The problem was solved by using .from_address() instead of causing trouble cast() - here the solution as a generalized example of code for reading access to shared memory area with given 'appropriateName': from ctypes import *

Re: curious problem with large numbers

2005-04-08 Thread Sion Arrowsmith
Michael Spencer [EMAIL PROTECTED] wrote: Terry Reedy wrote: Chris Fonnesbeck [EMAIL PROTECTED] wrote However, on Windows (have tried on Mac, Linux) I get the following behaviour: inf = 1e1 inf 1.0 On my Windows machine with 2.2.1, I get exactly what you expected: 1e1 1.#INF On my

Re: Best editor?

2005-04-08 Thread [EMAIL PROTECTED]
Howdy, I'm sold on out Leo, http://leo.sf.net, pure Python amazingly easy to learn and powerful. Based on outlining, it provides a powerful and flexible way to manage content. Lots of built in Python code awareness. Extensible with plugins, a very active community is making I wish my editor

Re: decorating functions with generic signatures (not for the faint of heart)

2005-04-08 Thread Michele Simionato
I said it was very little tested! ;) This should work better: #decorate.py def _signature_gen(varnames, n_default_args, n_args, rm_defaults=False): n_non_default_args = n_args - n_default_args non_default_names = varnames[:n_non_default_args] default_names =

Re: Thoughts on some stdlib modules

2005-04-08 Thread Nick Efford
vegetax [EMAIL PROTECTED] wrote: And those thoughts comes to mind again, if python is such a great language why does the stdlib is so bloated with duplication,bad bad library design,clumsy to use modules,etc. I mean is this normal? i dont think so.I havent seen such a messy stdlib in any

Re: decorating functions with generic signatures (not for the faint of heart)

2005-04-08 Thread Thomas Heller
Michele Simionato [EMAIL PROTECTED] writes: I have realized today that defining decorators for functions with generic signatures is pretty non-trivial. I've not completely read your post ;-), but I assume you're trying to do something that I've also done some time ago. Maybe the following code

Re: decorating functions with generic signatures (not for the faint of heart)

2005-04-08 Thread Michele Simionato
Yes, this is essentially the same idea. You compile the codestring to bytecode, whereas I just evalue the codestring to a lambda function. We are essentially implementing a runtime macro by hand. I wonder if there is any alternative approach to get the same result, without manipulation of the

compound strip() string problem

2005-04-08 Thread Dylan Wilson
Hi, I'm new to python and i have a string problem. My problem is this -- import time time = time.asctime() time 'Fri Apr 08 22:14:14 2005' ti = time[0:13] me = time[14:16] time = ti + me time 'Fri Apr 08 2214'

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

2005-04-08 Thread Michele Simionato
Axel: So, if there are ready class-modules, and I want to use them for multiple inheritance, I've to rewrite the init's of classes in the module! Or you use a metaclass that rewrites the __init___ method for you. This is a start (warning: written in 5 minutes and not tested more than you

Re: compound strip() string problem

2005-04-08 Thread Sidharth Kuruvila
The time module has a function called 'strftime' which can retyrn the time in the the format you want to. So you really don't need to parse the string returned by asctime the way you are doing. On Apr 8, 2005 6:01 PM, Dylan Wilson [EMAIL PROTECTED] wrote: Hi, I'm new to python and i have a

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

2005-04-08 Thread Jim Hargrave
oops - Sorry for the posting. This wasn't meant for the newsgroup :-) J Steve Holden wrote: 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

Re: curious problem with large numbers

2005-04-08 Thread Ivan Van Laningham
Hi All-- Windows XP, uwin running on Athlon XP 3000+: 0 [/c/users/ivanlan][1] python Python 2.4 (#60, Nov 30 2004, 11:49:19) [MSC v.1310 32 bit (Intel)] on win32 Type help, copyright, credits or license for more information. 1e1 1.#INF Metta, Ivan Michael Spencer wrote: A further

Interpreter problem

2005-04-08 Thread Greg Lindstrom
I am using python 2.3.5 on a Linux system and have an odd problem dealing with the 'sha-bang' line. I have a file, driver.py which starts with #!/usr/bin/python and works fine (that is, when I type in ./driver.py at the command prompt the file runs as expected). I have another file,

Re: Sockets

2005-04-08 Thread Dave Brueck
Dan 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's not really a Python string. Is there an easy

Positions of regexp groups

2005-04-08 Thread Magnus Lie Hetland
Just a quick question: Does anyone have a simple way of finding the positions (start, end) of the groups in a regexp match? AFAICS, the re API can only return the contents...? -- Magnus Lie HetlandFall seven times, stand up eight http://hetland.org

Re: Positions of regexp groups

2005-04-08 Thread Tim Peters
[Magnus Lie Hetland] Just a quick question: Does anyone have a simple way of finding the positions (start, end) of the groups in a regexp match? AFAICS, the re API can only return the contents...? Read the docs for match objects, esp. the start(), end(), and span() methods. --

unknown encoding problem

2005-04-08 Thread Uwe Mayer
Hi, I need to read in a text file which seems to be stored in some unknown encoding. Opening and reading the files content returns: f.read() '\x00 \x00 \x00\x00l\x00o\x00g\x00E\x00n\x00t\x00r\x00y\x00... Each character has a \x00 prepended to it. I suspect its some kind of unicode - how do I

[ANN] Voidspace Pythonutils Updates

2005-04-08 Thread Fuzzyman
Lots of updates to the Voidspace modules and recipes. Update to the Firedrop plugins see : http://www.voidspace.org.uk/python/programs.shtml#firedrop New version of FireSpell the spell checker (based on PyEnchant by Ryan Kelly) New plugin called FireMail which lets you send blog entries (or

Re: Positions of regexp groups

2005-04-08 Thread John Machin
On Fri, 8 Apr 2005 13:18:27 + (UTC), [EMAIL PROTECTED] (Magnus Lie Hetland) wrote: Just a quick question: Does anyone have a simple way of finding the positions (start, end) of the groups in a regexp match? AFAICS, the re API can only return the contents...? These documented methods of the

Re: Parent module idea dropped? [Python import parent package]

2005-04-08 Thread Laszlo Zsolt Nagy
So finally I got the answer: there was a parent package feature in the ni module but it was dropped of its awkwardness. This is not a big loss but this is exatly the feature that I need. Is there a person on this list who was against the parent package idea? He must know the answer or a

Re: Matplotlib question-- Numeric or numarray?

2005-04-08 Thread John Hunter
Matt == Matt Feinstein [EMAIL PROTECTED] writes: Matt I'm working my way through the matplotlib documentation Matt there's a point that's ambiguous-- the pdf file (dated Matt Mar. 1, 2005) warns of dire consequences if I use the Matt 'wrong' array package-- e.g., put numarray in

Re: Interpreter problem

2005-04-08 Thread Steve Holden
Greg Lindstrom wrote: I am using python 2.3.5 on a Linux system and have an odd problem dealing with the 'sha-bang' line. I have a file, driver.py which starts with #!/usr/bin/python and works fine (that is, when I type in ./driver.py at the command prompt the file runs as expected). I have

Re: Interpreter problem

2005-04-08 Thread Ruud de Jong
Greg Lindstrom schreef: I am using python 2.3.5 on a Linux system and have an odd problem dealing with the 'sha-bang' line. I have a file, driver.py which starts with #!/usr/bin/python and works fine (that is, when I type in ./driver.py at the command prompt the file runs as expected). I

Rotating arbitrary sets of elements within a list

2005-04-08 Thread phil_nospam_schmidt
I'm trying to come up with a good algorithm to do the following: Given a list 'A' to be operated on, and a list 'I' of indices into 'A', rotate the i'th elements of 'A' left or right by one position. Here's are some examples: A = [a, b, c, d, e, f] I = [0, 3, 4] rotate(A, I, 'left') -- [b, c,

Re: compound strip() string problem

2005-04-08 Thread Jeffrey Froman
Dylan Wilson wrote: Now i need to compond that string remove the whitespace if you will.Well i read up on strip(), lstrip() and rstrip() and all i could deduce was that they striped the whitespace from the start and/or end of the string.But I tried that anyway and failed.Is there an easier

Re: Interpreter problem

2005-04-08 Thread rbt
Steve Holden wrote: Greg Lindstrom wrote: I am using python 2.3.5 on a Linux system and have an odd problem dealing with the 'sha-bang' line. I have a file, driver.py which starts with #!/usr/bin/python and works fine (that is, when I type in ./driver.py at the command prompt the file runs as

Re: unknown encoding problem

2005-04-08 Thread Peter Otten
Uwe Mayer wrote: I need to read in a text file which seems to be stored in some unknown encoding. Opening and reading the files content returns: f.read() '\x00 \x00 \x00\x00l\x00o\x00g\x00E\x00n\x00t\x00r\x00y\x00... Each character has a \x00 prepended to it. I suspect its some kind of

Re: Rotating arbitrary sets of elements within a list

2005-04-08 Thread wes weston
[EMAIL PROTECTED] wrote: I'm trying to come up with a good algorithm to do the following: Given a list 'A' to be operated on, and a list 'I' of indices into 'A', rotate the i'th elements of 'A' left or right by one position. Here's are some examples: A = [a, b, c, d, e, f] I = [0, 3, 4] rotate(A,

__iadd__ and __isub__ map to += and -= but don't return result

2005-04-08 Thread Anthra Norell
Hi! If I am missing a point here, what could it be? Watch the hot spots (***) Frederic # # Python 2.4, Windows ME X = 0, Y = 1 class Vertex (list): def __init__ (self, *coordinates): self [:] = list

Re: import statement - package visibility problem

2005-04-08 Thread Paul Clinch
Laszlo, ... Importing from a not package related source code is not a problem, really. My problem is about importing inside a package. Lib/Server/Db/__init__.py __can__ import Lib/Server/Db/Adapters usign relative paths, but Lib/Server/Db/Adapters/PostgreSQLConnection.py __cannot__

Re: Interpreter problem

2005-04-08 Thread Steve Holden
rbt wrote: Steve Holden wrote: Greg Lindstrom wrote: I am using python 2.3.5 on a Linux system and have an odd problem dealing with the 'sha-bang' line. I have a file, driver.py which starts with #!/usr/bin/python and works fine (that is, when I type in ./driver.py at the command prompt the

Re: Interpreter problem

2005-04-08 Thread tuba_ranger
Yes! I moved the file (which I had created on a windows box using a mounted drive), created a new one on the Linux box, typed in the shabang in Linux, then copied the old file (sans shabang) to the new file. It runs like a champ. My sysadmin suggests we run all of our files through dos2unix

Can dictionary values access their keys?

2005-04-08 Thread Matthew Thorley
This may be a very rudimentary question, but here goes: If I have a simple dictionary, where the value is a class or function, is there an interface through which it can discover what its key is? Similar to index() for list. For a list, assuming I new what the parent list was I could do

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

2005-04-08 Thread Paul Clinch
Dear 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

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

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

Re: Interpreter problem

2005-04-08 Thread rbt
Steve Holden wrote: rbt wrote: Steve Holden wrote: Greg Lindstrom wrote: I am using python 2.3.5 on a Linux system and have an odd problem dealing with the 'sha-bang' line. I have a file, driver.py which starts with #!/usr/bin/python and works fine (that is, when I type in ./driver.py at the

Testing that a value is set.

2005-04-08 Thread erinhouston
I am using winGuiAuto to test a program. I want to check that a varible is set. In the following code I am doing if(len(str(hwnd)) 0) What is the python way? def clickNdSyncStopButton(hwnd=None): if(hwnd == None): hwnd = winGuiAuto.findTopWindow(NDSync) if(len(str(hwnd)) 0):

Re: How to name Exceptions that aren't Errors

2005-04-08 Thread Leif K-Brooks
Steve Holden wrote: I've even used an exception called Continue to overcome an irksome restriction in the language (you used not to be able to continue a loop from an except clause). Out of curiosity, how could you use an exception to do that? I would think you would need to catch it and then use

Re: Rotating arbitrary sets of elements within a list

2005-04-08 Thread phil_nospam_schmidt
[EMAIL PROTECTED] wrote: I'm trying to come up with a good algorithm to do the following: Given a list 'A' to be operated on, and a list 'I' of indices into 'A', rotate the i'th elements of 'A' left or right by one position. Ok, here's what I've got. It seems to work right, but can it be

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

2005-04-08 Thread Tom Reese
Joe Spammer wrote: snip bah! I thought maybe they found a huge forest of rosewood trees in Brazil. Tom (disappointed) Reese -- http://mail.python.org/mailman/listinfo/python-list

Tutorial at Python-UK, Oxford, 19 May - handful of places left

2005-04-08 Thread Andy Robinson
Michele Simionato is giving a full day tutorial titled The Wonders of Python at the UK Python Conference, Randolph Hotel, Oxford on 19 May. (This replaces Alex Martelli, who is now working for Google in California). The program is here: https://www.accu.org/conference/python_tutorial.html This

Re: text processing problem

2005-04-08 Thread Matt
Maurice LING wrote: Matt wrote: I'd HIGHLY suggest purchasing the excellent a href=http://www.oreilly.com/catalog/regex2/index.html;Mastering Regular Expressions/a by Jeff Friedl. Although it's mostly geared towards Perl, it will answer all your questions about regular expressions.

Re: Can dictionary values access their keys?

2005-04-08 Thread Diez B. Roggisch
Is there a way to do something like that with dicts? Not without searching the dict's items through, or keeping a additional mapping between values and keys. On a similar note, if one object is part of another, is there a way for the 'child' obj to discover what/who the 'parent' object

Re: Can dictionary values access their keys?

2005-04-08 Thread Matthew Thorley
Can you please elaborate on this? -Matthew Diez B. Roggisch wrote: keeping a additional mapping between values and keys. -- http://mail.python.org/mailman/listinfo/python-list

Re: curious problem with large numbers

2005-04-08 Thread Scott David Daniels
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

Re: args attribute of Exception objects

2005-04-08 Thread Jeremy Bowers
On Fri, 08 Apr 2005 09:32:37 +, Sbastien de Menten wrote: Hi, When I need to make sense of a python exception, I often need to parse the string exception in order to retrieve the data. What exactly are you doing with this info? (Every time I started to do this, I found a better way.

Re: How to name Exceptions that aren't Errors

2005-04-08 Thread Scott David Daniels
Leif K-Brooks wrote: Steve Holden wrote: I've even used an exception called Continue to overcome an irksome restriction in the language (you used not to be able to continue a loop from an except clause). Out of curiosity, how could you use an exception to do that? I would think you would need to

Re: Can dictionary values access their keys?

2005-04-08 Thread Axel Straschil
Hello! If I have a simple dictionary, where the value is a class or function, is there an interface through which it can discover what its key is? The key of a value may not be unique, so you can also get a tupe of keys, like dict(a=1, b=1), the key's of 1 are a and b. For unique values, I

Re: How to name Exceptions that aren't Errors

2005-04-08 Thread Steve Holden
Leif K-Brooks wrote: Steve Holden wrote: I've even used an exception called Continue to overcome an irksome restriction in the language (you used not to be able to continue a loop from an except clause). Out of curiosity, how could you use an exception to do that? I would think you would need to

Re: Can dictionary values access their keys?

2005-04-08 Thread Diez B. Roggisch
Matthew Thorley wrote: Can you please elaborate on this? Eh, just have two dicts that are the inverse of each other. You could do that by subclassinc dict: class mydict(dict): def __init__(self): self.__inverse_mapping = {} def __setitem__(self, key, value):

Re: Interpreter problem

2005-04-08 Thread Steve Holden
rbt wrote: Steve Holden wrote: rbt wrote: Steve Holden wrote: Greg Lindstrom wrote: I am using python 2.3.5 on a Linux system and have an odd problem dealing with the 'sha-bang' line. I have a file, driver.py which starts with #!/usr/bin/python and works fine (that is, when I type in

Re: Interpreter problem

2005-04-08 Thread Steve Holden
tuba_ranger wrote: Yes! I moved the file (which I had created on a windows box using a mounted drive), created a new one on the Linux box, typed in the shabang in Linux, then copied the old file (sans shabang) to the new file. It runs like a champ. My sysadmin suggests we run all of our files

Re: Can dictionary values access their keys?

2005-04-08 Thread Matthew Thorley
Axel Straschil wrote: For unique values, I did something like that couple of weeks ago, the thing you would need is the getKey thing, it's fast, but needs much memory for big structures becouse I use two dicts. Thanks for the tip, I may give that a try. I'll be interested to see what kind of

Re: Installing Python 2.4 on Linux

2005-04-08 Thread Edward Diener
David Fraser wrote: Edward Diener wrote: I can install Python 2.4 on the Fedora 3 Linux system, but after I do a number of Linux utilities and commands, like yum, stop working because they were dependent on the Python 2.3 installation. What happens is that Python 2.4 replaces the

Re: Installing Python 2.4 on Linux

2005-04-08 Thread Edward Diener
John Ridley wrote: --- Edward Diener [EMAIL PROTECTED] wrote: [snip] I do not know whether this is a Python problem or a Fedora 3 problem but I thought I would ask here first and see if anybody else had the same problem. I imagine the problem might exist on other Linux systems. On my Mandrake

Re: Can dictionary values access their keys?

2005-04-08 Thread Steve Holden
Matthew Thorley wrote: This may be a very rudimentary question, but here goes: If I have a simple dictionary, where the value is a class or function, is there an interface through which it can discover what its key is? Similar to index() for list. No, because mapping types (of which dict is the

Re: Installing Python 2.4 on Linux

2005-04-08 Thread Joseph Garvin
Another solution is to just install 2.4 and then make an alias for yum='/usr/bin/python2.3 yum' or whatever the path is :) Edward Diener wrote: I can install Python 2.4 on the Fedora 3 Linux system, but after I do a number of Linux utilities and commands, like yum, stop working because they

redirect stdout

2005-04-08 Thread Neal Becker
I'd like to build a module that would redirect stdout to send it to a logging module. I want to be able to use a python module that expects to print results using print or sys.stdout.write() and without modifying that module, be able to redirect it's stdout to a logger which will send the

PPC OSX vs. x86 Linux

2005-04-08 Thread Joshua Ginsberg
Hello -- I writing some python code to do some analysis of my mail logs. I took a 10,000 line snippet from them (the files are about 5-6 million usually) to test my code with. I'm developing it on a Powerbook G4 1.2GHz with 1.25GB of RAM and the Apple distributed Python* and I tested my code

Re: redirect stdout

2005-04-08 Thread Joshua Ginsberg
Use *NIX magic. Make a named pipe to a python program that pushes stdin to syslog and when you execute your program, redirect stdout to the named pipe. -jag inline: Pasted Graphic.tiffJoshua Ginsberg -- [EMAIL PROTECTED] Brainstorm Internet Network Operations 970-247-1442 x131 On Apr 8, 2005,

Re: Can dictionary values access their keys?

2005-04-08 Thread Scott David Daniels
Matthew Thorley wrote: This may be a very rudimentary question, but here goes: From your questions, I believe you are not thinking of values as being distinct from the names and data structures that refer to them. What is the parent of 23 in the following expression? 1 + 11 * 2 If you know

Re: Testing that a value is set.

2005-04-08 Thread Fredrik Lundh
[EMAIL PROTECTED] wrote: I am using winGuiAuto to test a program. I want to check that a varible is set. In the following code I am doing if(len(str(hwnd)) 0) What is the python way? you're expecting a string with negative length? that's pretty weird. what language uses that mechanism

Re: curious problem with large numbers

2005-04-08 Thread Bengt Richter
On Fri, 08 Apr 2005 09:05:39 -0700, Scott David Daniels [EMAIL PROTECTED] wrote: 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

Re: THE GREATEST NEWS EVER ! °º¤ø,¸¸,ø¤º°`°º¤ø°º¤ø,¸¸,ø¤º°`°º¤ø°º¤ø,¸¸,ø¤º°`°º¤ø°º¤ø,¸¸,ø¤º°`°º¤ø°º¤ø,¸¸,ø¤º°`°º¤ø°º¤ø,¸¸,ø¤º°`°º¤ø°º¤ø,¸¸,ø¤º°`°º¤ø°º¤ø,¸¸,ø¤º°`°º¤ø°º¤ø,¸¸,ø¤º°`°º¤ø°º¤ø,¸¸,ø¤º°`°º¤ø°º¤ø,¸¸,ø¤º°`°º¤ø

2005-04-08 Thread Scott M.
From your site: The reason some people don't know for sure if they are going to Heaven when they die is because they just don't know. Isn't that like saying the reason I'm not a rocket scientist is because I'm not a rocket scientist? [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED]

Re: Can dictionary values access their keys?

2005-04-08 Thread Axel Straschil
Hello! thousands more entries. So we're talking about maybe a million+ total nested key:values. I don't know if that counts as large or not. I can't even guess how much k memory that is. Mhh, maybe you should use a SQL-Database ;-) Lg, AXEL. -- Aber naja, ich bin eher der Forentyp.

Re: __iadd__ and __isub__ map to += and -= but don't return result

2005-04-08 Thread Fredrik Lundh
Anthra Norell wrote: If I am missing a point here, what could it be? the documentation? class Vertex (list): def __init__ (self, *coordinates): self [:] = list (coordinates [0:2]) def __add__ (self, V): return Vertex (self [X] + V [X], self [Y] + V [Y]) def __iadd__ (self, V):

Re: redirect stdout

2005-04-08 Thread Fredrik Lundh
Neal Becker wrote: I'd like to build a module that would redirect stdout to send it to a logging module. I want to be able to use a python module that expects to print results using print or sys.stdout.write() and without modifying that module, be able to redirect it's stdout to a logger

Re: curious problem with large numbers

2005-04-08 Thread Scott David Daniels
Bengt Richter wrote: Aha! Same version (2.3.4): Idle: 1e1 1.0 import struct; struct.pack('d', 1e1) '\x00\x00\x00\x00\x00\x00\xf0?' (which is actually 1.0) python via command line (readline support): 1e1 1.#INF import struct; struct.pack('d', 1e1)

Re: Ply(LALR) and Yacc behaving differently

2005-04-08 Thread Carsten Haese
On Thu, 2005-04-07 at 14:51, Åsmund Grammeltvedt wrote: 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

Re: Installing Python 2.4 on Linux

2005-04-08 Thread Edward Diener
Joseph Garvin wrote: Another solution is to just install 2.4 and then make an alias for yum='/usr/bin/python2.3 yum' or whatever the path is :) If it were just 'yum' under Fedora 3, I could probably do that but looking at the dependencies on the python2.3 package in Synaptic there must be about

Re: Interpreter problem

2005-04-08 Thread Ivan Van Laningham
Hi All-- Steve Holden wrote: It's odd that deleting the line and reentering it on the Linux box did not correct the problem. Perhaps vim recognized the format as having cr-lf and inserted it even though I was editing on Linux. Anyhow, it would have been a long time before I got this

Re: Can dictionary values access their keys?

2005-04-08 Thread Matthew Thorley
Steve Holden wrote: while not impossible (using Python's excellent introspection facilities) is way beyond what most people would consider practical. Obviously the garbage collector has to solve this problem, but you *really* don't want to be doing this stuff in Python unless you absolutely

Re: curious problem with large numbers

2005-04-08 Thread Michael Spencer
Scott David Daniels wrote: 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

Re: Can dictionary values access their keys?

2005-04-08 Thread Matthew Thorley
Scott David Daniels wrote: Matthew Thorley wrote: This may be a very rudimentary question, but here goes: From your questions, I believe you are not thinking of values as being distinct from the names and data structures that refer to them. What is the parent of 23 in the following

Re: Can dictionary values access their keys?

2005-04-08 Thread Steve Holden
Matthew Thorley wrote: Steve Holden wrote: while not impossible (using Python's excellent introspection facilities) is way beyond what most people would consider practical. Obviously the garbage collector has to solve this problem, but you *really* don't want to be doing this stuff in Python

Re: Can dictionary values access their keys?

2005-04-08 Thread Max M
Matthew Thorley wrote: I am creating an object database to store information about network devices, e.g. switches and routers. Possible usefull pages? http://www.python.org/doc/essays/graphs.html more at: http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/119466 -- hilsen/regards Max M,

  1   2   >