Re: Help beautify ugly heuristic code

2004-12-09 Thread Lonnie Princehouse
Doh! I misread "a" as host instead of ip in your first post. I'm sorry about that; I really must slow down. Anyhow, I believe you can still do this with only compiling a regex once and then performing a few substitutions on the hostname. Substitutions: 1st byte of IP => (0) 2nd byte of IP =>

Re: How do I do this? (eval() on the left hand side)

2004-12-09 Thread Peter Otten
Caleb Hattingh wrote: > I am convinced now that locals() doesn't work as (I) expected. Steven > says there was some or other reason why locals() as used in this context > is not writable - Do you know why this is? I really do not like > guidelines like "may not work", "is unreliable" and so on.

newbie question: starting external application(win)?

2004-12-09 Thread Frank Esselbach
Hello, I'am new in python. I need informations, how its possible run another (non-python) exe file from python without terminate the python system. I have googeled, but could not find informations that I can understand. The most informations comes from unix/linux butIneed this for win32. Thanks

Re: How do I do this? (eval() on the left hand side)

2004-12-09 Thread Nick Coghlan
Peter Hansen wrote: Nick Coghlan wrote: Generally, altering the contents of the dicts returned by locals() and globals() is unreliable at best. Nick, could you please comment on why you say this about globals()? I've never heard of any possibility of "unreliability" in updating globals() and, as

Re: ElementTree and XPATH

2004-12-09 Thread Fredrik Lundh
<[EMAIL PROTECTED]> wrote: > I'm using ElementTree from effbot (http://effbot.org/zone/element.htm) > and I'm having some problems finding nodes that have the same name. I > know in XPATH, we can use an index to identify which node we need, but > it seems to be invalid syntax if I give "/a/b[0]" t

Re: new comp.lang.python mirror at lampfroums.org--any Linux, Apache, MYSQL, Python Apps?

2004-12-09 Thread Fredrik Lundh
Terry Reedy wrote: > Whereas this is my second or third exposure, with the first that made an > impression coming earlier > this year. A list of those books might help some people, and would establish > that LAMP is an > established concept. the LAMP concept has been pushed by O'Reilly and o

Re: a newbie question

2004-12-09 Thread Nick Coghlan
Peter Hansen wrote: If that's not what you wanted, try specifying what you mean by "preinstalled python libraries". I can think of at least two things that this phrase might refer to... For the "where's the standard library" interpretation, the following works on any platform: python -c "import

Re: deferred decorator

2004-12-09 Thread Nick Coghlan
Bryan wrote: Nick Coghlan wrote: Bryan wrote: i'm also curious if it's possible to write this recipe using the new class style for the Deffered class.it appears you can nolonger delegate all attributes including special methods to the contained object by using the __getattr__ or the new __ge

Re: Parse XML using Python

2004-12-09 Thread Thomas Guettler
Am Wed, 08 Dec 2004 23:25:49 -0800 schrieb anilby: > Hi, > > I wanted to write a script that will read the below file: Hi, Here is an example how to use sax: http://pyxml.sourceforge.net/topics/howto/node12.html Thomas -- Thomas Güttler, http://www.thomas-guettler.de/ -- http://mail.pyt

Re: wxPython bug

2004-12-09 Thread Dennis Benzinger
Jive wrote: > [...] > What to do? Ask in comp.soft-sys.wxwindows -- http://mail.python.org/mailman/listinfo/python-list

Psycopg 1.1.17 compiled binaries for windows, postgre 8.0.0-beta4 and python 2.3

2004-12-09 Thread Eino Mäkitalo
I had Visual C++ 6.0, so I compiled those libpq.dll and psycopg.pyd. if there are anyone to play with Windows, Python 2.3 and Postgre-8.0.0-beta4 for windows like me. You cat get those from: http://eino.net/html/python.html Original psycopg source code is available in: http://initd.org/projects/ps

Re: os.path.islink()

2004-12-09 Thread Peter Maas
JanC schrieb: There are no ntfs links. You're wrong, NTFS supports symlinks for directories and hard links for files: Thanks for the update and my apologies to Egor. I was using Win2k for

Re: Ideas for projects

2004-12-09 Thread Fuzzyman
Phillip Bowden wrote: > I feel that I've learned the language pretty well, but I'm having > trouble thinking of a medium to large project to start. What are some > projects that you have written in the past with Python? I'm the maintainer of several python projects. Most of them have their curre

Re: PIL for Windows for Python 2.4

2004-12-09 Thread Fuzzyman
So you've built PIL for windows, Python 2.4 ? Any chance of sharing it ? What compiler have you configured distutils to use ? Regards, Fuzzyman -- http://mail.python.org/mailman/listinfo/python-list

Re: ANNOUNCE: Ice 2.0 released

2004-12-09 Thread Duncan Grisby
In article <[EMAIL PROTECTED]>, Michi Henning <[EMAIL PROTECTED]> wrote: [...] >Instead of compiling the definition, you can write: > >Ice.loadSlice("Color.ice") >import M > >print "My favourite color is ", M.Color.blue Just like this then? omniORB.importIDL("Color.idl") imp

Re: Upgrading Python Article

2004-12-09 Thread Fuzzyman
Sure - I don't really *blame* windoze for the problem. It's just more of a pain upgrading python version on windows. As I said it's given me an opportunity to work out which extension modules I'm really using ! In actual fact I admire windows, there's an awful lot that goes on beneath the hood. Mi

Re: Sorting in huge files

2004-12-09 Thread Paul
The reason I am not telling you much about the data is not because I am afraid anyone would steal my ideas, or because I have a non-disclosure agreement or that I don't want to end up pumping gas. It is just that it is pretty freaking damn hard to even explain what is going on. Probably a bit harde

Re: Psycopg 1.1.17 compiled binaries for windows, postgre 8.0.0-beta4 and python 2.3

2004-12-09 Thread Max M
Eino Mäkitalo wrote: I had Visual C++ 6.0, so I compiled those libpq.dll and psycopg.pyd. if there are anyone to play with Windows, Python 2.3 and Postgre-8.0.0-beta4 for windows like me. You cat get those from: http://eino.net/html/python.html Original psycopg source code is available in: http://

Re: Python Docs. Hardcopy 2.4 Library Reference, interested?

2004-12-09 Thread Richie Hindle
[Brad] > Is anyone interested in purchasing a hardcopy version of the Python 2.4 > Library reference? Have you seen http://www.network-theory.co.uk/python/ ? (I don't know anything about it beyond what's on that page.) For what it's worth, I wouldn't want a hardcopy manual - I find the electron

Re: Ideas for projects

2004-12-09 Thread Paul Rubin
Phillip Bowden <[EMAIL PROTECTED]> writes: > I feel that I've learned the language pretty well, but I'm having > trouble thinking of a medium to large project to start. What are some > projects that you have written in the past with Python? Why don't you say what areas interest you, and how much

Re: Sorting in huge files

2004-12-09 Thread Paul Rubin
"Paul" <[EMAIL PROTECTED]> writes: > If you really want to know, my entries are elliptic curves and my > hashing function is an attempt at mapping them to their Serre resdual > representation modulo a given prime p. > > Now, for you to tell me something relevant about the data that I don't > alrea

High level SNMP

2004-12-09 Thread Jeremy Sanders
Hi - I'd like to write a program which basically does a few snmpgets. I haven't been able to find a python package which gives you a nice high-level and simple way of doing this (like PHP has). Everything appears to be extremely low level. All I need is SNMPv1. Does anyone know of a simple python

Re: Help beautify ugly heuristic code

2004-12-09 Thread Mitja
On Wed, 08 Dec 2004 16:09:43 -0500, Stuart D. Gathman <[EMAIL PROTECTED]> wrote: I have a function that recognizes PTR records for dynamic IPs. There is no hard and fast rule for this - every ISP does it differently, and may change their policy at any time, and use different conventions in diff

Re: Python 2.3.5 ?

2004-12-09 Thread Fuzzyman
Fuzzy Regards, What's that phrase that includes 'hobgoblin of little minds' ? -- http://mail.python.org/mailman/listinfo/python-list

Re: cookie lib policy how-tp?

2004-12-09 Thread Fuzzyman
I think your question has already been answered - but just to clarify a couple of issues. Setting a cookie policy will only *restrict* the situations in which cookies are returned. The default is to *always* return them. Also using an MSIE instance is useful for creating a CookieJar instance with

Re: ANN: GallerPy 0.5.0

2004-12-09 Thread Fuzzyman
It's very nice looking and emminently 'hackable'. Nice one. Regards, Fuzzy http://www.voidspace.org.uk/atlantibots/pythonutils.html -- http://mail.python.org/mailman/listinfo/python-list

Python 2.4 Tix failing on Windows XP

2004-12-09 Thread j vickroy
Hello, I've just installed (accepted all installation defaults) Python 2.4 (final) on my Microsoft Windows XP (home edition - service pack 2) computer, and I am experiencing the following behavior regarding Tix: >>> import sys >>> sys.version '2.4 (#60, Nov 30 2004, 11:49:19) [MSC v.1310 32 bit

Re: newbie question: starting external application(win)?

2004-12-09 Thread Diez B. Roggisch
> I have googeled, but could not find informations that I can understand. > The most informations comes from unix/linux butIneed this for win32. The module popen2 is your friend. Or the os.spawn* methods in module os. -- Regards, Diez B. Roggisch -- http://mail.python.org/mailman/listinfo/pyth

Re: Python Docs. Hardcopy 2.4 Library Reference, interested?

2004-12-09 Thread Jacek Generowicz
"Brad Clements" <[EMAIL PROTECTED]> writes: > Is anyone interested in purchasing a hardcopy version of the Python 2.4 > Library reference? > > That is, assuming it was NOT a direct print of current html/pdf versions. > > So, nicely formatted for a printed book (spiral bound probably), with > se

Re: How do I do this? (eval() on the left hand side)

2004-12-09 Thread caleb . hattingh
Both Peters :) Sure, I must concede that the problem here was my expectation of how things should work. Thanks for the explanations. I still don't really know whether this behaviour of locals() is the result of a design decision, or an implementation artifact of CPython, but at least I have a cl

Re: dictionary initialization

2004-12-09 Thread caleb . hattingh
Hi Dan I must confess that upon rereading my words, there is some irony there (but not really sarcasm, is there?). However, I *really* tried to keep my tone, well, professional. I realise I didn't do a good job and apologise. I hope that's ok. Keep well Caleb -- http://mail.python.org/mailma

Re: Pictograms and Python

2004-12-09 Thread caleb . hattingh
Diez Ya got me there! """ I have a sript that downloads a webpage. According to the picture on this webpage I need to pass a parameter to this , running script a few lines later. """ Err, ya, I guess I would be suspicious too.Sorry about that! Keep well Caleb -- http://mail.python.org/mai

Questions about file object and close()

2004-12-09 Thread John Marshall
Hi, Does anyone see a problem with doing: data = file("tata").read() Each time this is done, I see a new file descriptor allocated (Linux) but not released. 1) Will there ever be a point where I will have a problem with file descriptors because the garbage collector has _not_ yet co

Re: wxPython bug

2004-12-09 Thread Johan Lindberg
> [...] > What to do? Open up wxProject.py and fix the problem. The traceback is pretty clear: On line 137 in wxProject.py, the method GetFirstChild expects 2 arguments, but was given 3. Unfortunately the wx documentation is not very clear about the GetFirstChild method. It only says: wxPython no

Re: os.path.islink()

2004-12-09 Thread JanC
Peter Maas schreef: > Thanks for the update and my apologies to Egor. I was using Win2k for > two years and never saw a link, neither at system nor at application > locations. How nasty of Microsoft to add this feature so silently :) IIRC this is something they had to add for the US government (p

Re: Questions about file object and close()

2004-12-09 Thread Peter Hansen
John Marshall wrote: Hi, Does anyone see a problem with doing: data = file("tata").read() Each time this is done, I see a new file descriptor allocated (Linux) but not released. 1) Will there ever be a point where I will have a problem with file descriptors because the garbage collecto

Re: Python 2.3.5 ?

2004-12-09 Thread Peter Hansen
Fuzzyman wrote: What's that phrase that includes 'hobgoblin of little minds' ? It's about "foolish consistency", but I don't see the relevance to the current thread. Are you suggesting that back-porting bug fixes to older versions of Python is foolish? -Peter -- http://mail.python.org/mailman/listi

Re: High level SNMP

2004-12-09 Thread Petri Laakso
On Thu, 09 Dec 2004 11:15:27 +, Jeremy Sanders wrote: > Hi - > > I'd like to write a program which basically does a few snmpgets. I haven't > been able to find a python package which gives you a nice high-level and > simple way of doing this (like PHP has). Everything appears to be > extremel

Re: newbie question: starting external application(win)?

2004-12-09 Thread Peter Hansen
Frank Esselbach wrote: Hello, I'am new in python. I need informations, how its possible run another (non-python) exe file from python without terminate the python system. I have googeled, but could not find informations that I can understand. The most informations comes from unix/linux butIneed thi

Re: newbie question: starting external application(win)?

2004-12-09 Thread Johan Lindberg
>The module popen2 is your friend. Or the os.spawn* methods in module os. Another (simpler IMO) way to do it is to use os.startfile. To start Notepad: >>> import os >>> os.startfile("notepad.exe") also, you can start an application from an associated file. Start MS Word with: >>> os.startfile("

Re: Parse XML using Python

2004-12-09 Thread Anil
Thomas Guettler wrote: > Am Wed, 08 Dec 2004 23:25:49 -0800 schrieb anilby: > > > Hi, > > > > I wanted to write a script that will read the below file: > > Hi, > > Here is an example how to use sax: > > http://pyxml.sourceforge.net/topics/howto/node12.html > > Thomas > > -- > Thomas Güttler, http

Re: PIL for Windows for Python 2.4

2004-12-09 Thread Scott F
"Fuzzyman" <[EMAIL PROTECTED]> wrote in news:[EMAIL PROTECTED]: > So you've built PIL for windows, Python 2.4 ? > > Any chance of sharing it ? What compiler have you configured > distutils to use ? I'm very sorry I spoke too soon. After making the initial change, the setup.py took off on a r

Wrapper objects

2004-12-09 Thread Egil M?ller
Is there any way to create transparent wrapper objects in Python? I thought implementing __getattribute__ on either the wrapper class or its metaclass would do the trick, but it does not work for the built in operators: class Foo(object): class __metaclass__(type): def __getattribute_

Re: installing wxPython on Linux and Windows

2004-12-09 Thread Ed Leafe
On Dec 2, 2004, at 4:19 AM, Peter Maas wrote: Recently I replaced Win2k with Linux on my desktop computer. Using mostly multi-platform software I thought this would be easy. It was not as easy as expected getting wxPython to work. There seemed to be no SuSE RPM so I installed from source. Here ar

Re: Questions about file object and close()

2004-12-09 Thread John Marshall
On Thu, 2004-12-09 at 08:41 -0500, Peter Hansen wrote: > John Marshall wrote: > > Hi, > > > > Does anyone see a problem with doing: > > data = file("tata").read() > > > > Each time this is done, I see a new file > > descriptor allocated (Linux) but not > > released. > > > > 1) Will there ev

Re: Python Docs. Hardcopy 2.4 Library Reference, interested?

2004-12-09 Thread Brian Gough
"Brad Clements" <[EMAIL PROTECTED]> writes: > Is anyone interested in purchasing a hardcopy version of the Python 2.4 > Library reference? I have one in the pipeline but I'm waiting for sales of the Python Tutorial and Python Language Reference to justify bringing it out. The amount of text in t

Re: Parse XML using Python

2004-12-09 Thread Diez B. Roggisch
Anil wrote: > Could you please tell me how to achieve the below. > I am interested in getting the output like: > > ABC > EFGA --> child of ABC > ABDG --> child of AEFGA > MON --> child of ABC > A1 > FGA --> child of A1 > BG--> child of FGA print """ ABC EFGA --> child of

MDaemon Warning - virus found: Returned mail: see transcript for details

2004-12-09 Thread MAILER-DAEMON
*** WARNING ** Este mensaje ha sido analizado por MDaemon AntiVirus y ha encontrado un fichero anexo(s) infectado(s). Por favor revise el reporte de abajo. AttachmentVirus name Action taken ---

Re: dictionary initialization

2004-12-09 Thread Dan Perl
<[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hi Dan > > I must confess that upon rereading my words, there is some irony there > (but not really sarcasm, is there?). However, I *really* tried to keep > my tone, well, professional. I realise I didn't do a good job and > apologise

results of division

2004-12-09 Thread Brad Tilley
Hello, What is the proper way to limit the results of division to only a few spaces after the decimal? I don't need rocket-science like precision. Here's an example: 1.775 is as exact as I need to be and normally, 1.70 will do. Thank you, Brad -- http://mail.python.org/mailman/listinfo/python-li

Re: High level SNMP

2004-12-09 Thread Jeremy Sanders
On Thu, 09 Dec 2004 15:34:14 +0200, Petri Laakso wrote: >> have you tested twistedsnmp? > http://twistedsnmp.sourceforge.net/ I looked at it, but it needs Twisted compiled and installed, which is a pain. The old versions of PySNMP (version 2.XX), seem to be a lot simpler to use than later ones,

Re: new comp.lang.python mirror at lampfroums.org--any Linux, Apache, MYSQL, Python Apps?

2004-12-09 Thread astro
Thanks for the feedback. I linked to Oreilly's onlamp.com article at: http://lampforums.org/forumdisplay.php?f=36 What is LAMP? LAMP is an acronym for Linux, Apache, MYSQL/Postgres, and PHP/Perl/Python/Ruby. These open-source efforts offer ever-increasing power and versatility. In 2001, Dal

Re: Wrapper objects

2004-12-09 Thread Simon Brunning
On 9 Dec 2004 06:11:41 -0800, Egil M?ller <[EMAIL PROTECTED]> wrote: > Is there any way to create transparent wrapper objects in Python? This work - ? -- Cheers, Simon B, [EMAIL PROTECTED], http://www.brunningonline.net/simon/blog/ -

samba/windows shares

2004-12-09 Thread I.V. Aprameya Rao
hi does anybody know how to access samba/windows shares on a network? is there any module that does this? i am running linux and i thought of using the mount command to mount that remote share and then access it, but i was wondering whether that is the right way? Aprameya -- http://mail.pyt

Re: results of division

2004-12-09 Thread Simon Brunning
On Thu, 09 Dec 2004 09:38:55 -0500, Brad Tilley <[EMAIL PROTECTED]> wrote: > What is the proper way to limit the results of division to only a few > spaces after the decimal? I don't need rocket-science like precision. > Here's an example: > > 1.775 is as exact as I need to be and normally, 1.70 w

Re: results of division

2004-12-09 Thread Paul Rubin
Brad Tilley <[EMAIL PROTECTED]> writes: > What is the proper way to limit the results of division to only a few > spaces after the decimal? I don't need rocket-science like > precision. Here's an example: > > 1.775 is as exact as I need to be and normally, 1.70 will do. "%.2f"% 1.775 -- http://m

Re: results of division

2004-12-09 Thread Aahz
In article <[EMAIL PROTECTED]>, Brad Tilley <[EMAIL PROTECTED]> wrote: > >What is the proper way to limit the results of division to only a few >spaces after the decimal? I don't need rocket-science like precision. >Here's an example: > >1.775 is as exact as I need to be and normally, 1.70 will

Re: PIL for Windows for Python 2.4

2004-12-09 Thread Fuzzyman
If you're determined enough there are instructions here : http://www.vrplumber.com/programming/mstoolkit/ These will get you the Visual Studio 7 tools (free releases of) and tell you how to configure distutils to use it. Hefty downloads though, do not attempt this without broadband ! Regards, F

Re: Help beautify ugly heuristic code

2004-12-09 Thread Jeremy Sanders
On Wed, 08 Dec 2004 18:38:14 -0500, Stuart D. Gathman wrote: >> Here are the last 20 (which my subjective judgement says are correct): > > 65.112.76.15usfshlxmx01.myreg.net 201.128.108.41 [snip] > 80.143.79.97p508F4F61.dip0.t-ipconnect.de DYN Looks like you could do something like look

How to install tile (or any other tcl module)

2004-12-09 Thread Stephen Kennedy
I've been trying to get Tile to work with python. It can make your tkinter apps look like http://tktable.sourceforge.net/tile/screenshots/demo-alt-unix.png See http://tktable.sourceforge.net/tile/ Under linux I built tile from source, installed and it just works. import Tkinter root = Tkinter.Tk

Re: PIL for Windows for Python 2.4

2004-12-09 Thread Simon Brunning
On 9 Dec 2004 06:58:05 -0800, Fuzzyman <[EMAIL PROTECTED]> wrote: > If you're determined enough there are instructions here : > http://www.vrplumber.com/programming/mstoolkit/ > > These will get you the Visual Studio 7 tools (free releases of) and > tell you how to configure distutils to use it.

Re: Questions about file object and close()

2004-12-09 Thread Peter Hansen
John Marshall wrote: It seems to me that a file.__del__() _should_ call a file.close() to make sure that the file is closed as a clean up procedure before releasing the object. I believe it does, but I tried your experiment with subclassing file and didn't ever see a call to close, so I can only a

Re: Python Docs. Hardcopy 2.4 Library Reference, interested?

2004-12-09 Thread Richie Hindle
[Brian] > I have one in the pipeline but I'm waiting for sales of the Python > Tutorial and Python Language Reference to justify bringing it out. I'd be interested to know how many of these manuals you sell...? This is only idle curiosity, and if you don't want to say then that's no problem. (I'

Re: results of division

2004-12-09 Thread Peter Hansen
Brad Tilley wrote: What is the proper way to limit the results of division to only a few spaces after the decimal? I don't need rocket-science like precision. Here's an example: 1.775 is as exact as I need to be and normally, 1.70 will do. The answer is "what are you trying to do?". The others

Re: Directory structure inside a ZipFile object

2004-12-09 Thread Scott David Daniels
Bulba! wrote: tried to read file, zip it, and put in the target directory It works nice, except the zipfile created contains the directory path of the source file -- which I do NOT want to recreate. Look into the two-argument form of the write command: import zipfile archive = zipfile

Re: results of division

2004-12-09 Thread Paul McGuire
"Paul Rubin" wrote in message news:[EMAIL PROTECTED] > Brad Tilley <[EMAIL PROTECTED]> writes: > > What is the proper way to limit the results of division to only a few > > spaces after the decimal? I don't need rocket-science like > > precision. Here's an example: > > >

Re: results of division

2004-12-09 Thread Brad Tilley
Simon Brunning wrote: On Thu, 09 Dec 2004 09:38:55 -0500, Brad Tilley <[EMAIL PROTECTED]> wrote: What is the proper way to limit the results of division to only a few spaces after the decimal? I don't need rocket-science like precision. Here's an example: 1.775 is as exact as I need to be and norma

Re: Class Variable Inheritance

2004-12-09 Thread Scott David Daniels
Brian Jones wrote: class a(object): mastervar = [] def __init__(self): print 'called a' class b(a): def __init__(self): print 'called b' self.mapvar() def mapvar(self): self.mastervar.append(['b']) class c(b): mastervar = [] # Adding this shou

Re: jython and swing

2004-12-09 Thread Rick Holbert
Could it have something to do with your PATH or CLASSPATH settings? Here's a test script that works for me: #!/usr/bin/env jython from java import lang from javax import swing print "lang attributes: " for attr in dir(lang): print "\t%s" % attr print print "swing attributes: " for attr i

Re: results of division

2004-12-09 Thread Brad Tilley
Peter Hansen wrote: Brad Tilley wrote: What is the proper way to limit the results of division to only a few spaces after the decimal? I don't need rocket-science like precision. Here's an example: 1.775 is as exact as I need to be and normally, 1.70 will do. The answer is "what are you trying

How can I change the timestamps of directories? (os.utime(), WinXP)

2004-12-09 Thread Martin Bless
I'm working on a backup scheme that looks at modification times. To run some tests I'd like to be able to set the modification time of directories (WinXPsp2, Python-2.3.4) os.utime() works well with files but throws a permission error with directories. See code below. Q: Can this be done via the

Re: Questions about file object and close()

2004-12-09 Thread Scott David Daniels
John Marshall wrote: On Thu, 2004-12-09 at 08:41 -0500, Peter Hansen wrote: John Marshall wrote: Does anyone see a problem with doing: data = file("tata").read() ... a perfectly good explanation It seems to me that a file.__del__() _should_ > how he wishes it were designed Isn't

Re: results of division

2004-12-09 Thread Tim Peters
[Paul McGuire] ... > >>> print "%.2f" % 1.775 > 1.77 > > Hmmm, if we rounded, I would have expected 1.775 to round up > to 1.78. Platform-dependent. 1.775 isn't exactly representable regardless, but whether exactly-half-way numbers that are exactly representable round up or truncate varies across

OT: Re: PDF count pages

2004-12-09 Thread Andreas Lobinger
Aloha, [EMAIL PROTECTED] wrote: Andreas Lobinger wrote: >>> import pdffile I browsed the code in CVS and it looks like a pretty comprehensive implementation. Maybe we should join forces. I have problems contacting you via the given e-mail adress. Wishing a happy day LOBI -- http://mail.pyth

Re: results of division

2004-12-09 Thread Peter Hansen
Brad Tilley wrote: Peter Hansen wrote: The answer is "what are you trying to do?". The others have given options and good advice, but the "right" approach depends on what exactly you are doing. Is this just for display purposes, or is there more significant (though perhaps not "precision-critical

Re: Parse XML using Python

2004-12-09 Thread Jeremy Bowers
On Thu, 09 Dec 2004 06:00:27 -0800, Anil wrote: > > Thomas Guettler wrote: >> Hi, >> >> Here is an example how to use sax: >> >> http://pyxml.sourceforge.net/topics/howto/node12.html >> >> Thomas >> >> -- >> Thomas GÃttler, http://www.thomas-guettler.de/ > > > Could you please tell me how to a

Re: Loading a file only once into an object and being able to access it from other modules - still have a problem

2004-12-09 Thread Philippe C. Martin
Hi, After all of you answers, I though I had it straight, yet . This is what I am doing: class SC_ISO_7816: __m_loaded = None .. def __init__(self): """ """ if SC_ISO_7816.__m_loaded == None: SC_ISO_7816.__m_loaded = True print 'LOAD

mapping function to vars

2004-12-09 Thread jahurt
I need to map a function to several variables. I'm trying to use map and lambda to do this. Here's my attempt... #!/usr/bin/env python from random import * [fee, fye, foe, fum] = map(lambda n: random(), range(4)) print fee print fye print foe print fum ...I'm essentially trying to map a funct

Re: Sorting in huge files

2004-12-09 Thread Paul
Thanks! I definitely didn't want to go into any elaborate programming for this, and the Unix sort is perfect for this. It sorted a tenth of my data in about 8 min, which is entirely satisfactory to me (assuming it will take ~ 20 times more to do the whole thing). Your answer greatly helped! Paul -

Re: Upgrading Python Article

2004-12-09 Thread JanC
Fuzzyman schreef: > On the other hand the microsoft > compiler is *better* than gcc anyway :-) It's better at optimising, but it doesn't support standard C & C++. ;-) -- JanC "Be strict when sending and tolerant when receiving." RFC 1958 - Architectural Principles of the Internet - section 3.

Re: How do I do this? (eval() on the left hand side)

2004-12-09 Thread Bengt Richter
On Tue, 07 Dec 2004 21:12:24 GMT, "It's me" <[EMAIL PROTECTED]> wrote: > >"Caleb Hattingh" <[EMAIL PROTECTED]> wrote in message >news:[EMAIL PROTECTED] >> Hi It's me >> >> > >> > a = 3 >> > y = "a" >> > print eval(y) >> > >> >> To get 'a' to be 4 here, you would say >> >> a = 4 >> > >O

Re: mapping function to vars

2004-12-09 Thread Brian Quinlan
[EMAIL PROTECTED] wrote: I need to map a function to several variables. I'm trying to use map and lambda to do this. Here's my attempt... #!/usr/bin/env python from random import * [fee, fye, foe, fum] = map(lambda n: random(), range(4)) from random import random fee = random() fye = random() foe

Re: mapping function to vars

2004-12-09 Thread Steven Bethard
[EMAIL PROTECTED] wrote: I need to map a function to several variables. I'm trying to use map and lambda to do this. Here's my attempt... #!/usr/bin/env python from random import * [fee, fye, foe, fum] = map(lambda n: random(), range(4)) print fee print fye print foe print fum ...I'm essentially

Re: Loading a file only once into an object and being able to access it from other modules - still have a problem

2004-12-09 Thread Peter Hansen
Philippe C. Martin wrote: class SC_ISO_7816: __m_loaded = None Please don't use tabs in code you post here. Many newsreaders have trouble displaying them, and make the code look like it does above (i.e. no indentation at all) which makes it hard to understand. .. def __init__(self):

Re: How do I do this? (eval() on the left hand side)

2004-12-09 Thread Jeff Shannon
Nick Coghlan wrote: Peter Hansen wrote: Nick, could you please comment on why you say this about globals()? I've never heard of any possibility of "unreliability" in updating globals() and, as far as I know, a large body of code exists which does in fact rely on this -- much of mine included. ;-)

Re: Parse XML using Python

2004-12-09 Thread Fredrik Lundh
<[EMAIL PROTECTED]> wrote: > > > . > . > > > > .. > and so on an XML document can only have a single root element, but your example has at least two top-level elements (abcd and xyz). here is some elementtree code that handles this by wrapping your data in a "root" element. from elementtr

Re: mapping function to vars

2004-12-09 Thread jahurt
Steven Bethard wrote: > [EMAIL PROTECTED] wrote: > > I need to map a function to several variables. I'm trying to use map > > and lambda to do this. Here's my attempt... > > > > #!/usr/bin/env python > > from random import * > > > > [fee, fye, foe, fum] = map(lambda n: random(), range(4)) > > >

Re: results of division

2004-12-09 Thread Christopher A. Craig
"Paul McGuire" <[EMAIL PROTECTED]> writes: > Errr? How come round() is able to understand 1.775 correctly, whereas > string interp is not? I'm guessing that round() adds some small epsilon to > the value to be rounded, or perhaps even does the brute force rounding I > learned in FORTRAN back in

Re: Creating Fixed Length Records

2004-12-09 Thread Andrew James
Greg, Absolutely *perfect* case for a dose of Python string concatenation performance theory or, How To Join Strings Together Fast: http://www.skymind.com/~ocrow/python_string/ HTH, Andrew On Wed, 2004-12-08 at 17:29 -0600, Greg Lindstrom wrote: > Hello- > > I'm creating fixed-length record lay

Calling a C program from a Python Script

2004-12-09 Thread Brad Tilley
Is it possible to write a file open, then read program in C and then call the C program from a Python script like this: for root, files, dirs in os.walk(path) for f in files: try: EXECUTE_C_PROGRAM If possible, how much faster would this be over a pure Python solution? Tha

Re: Loading a file only once into an object and being able to access it from other modules - still have a problem

2004-12-09 Thread Philippe C. Martin
>Well, from the looks of things, you don't seem to understand the >basic idea of instances and instance attributes.  There is a key >difference between SC_ISO_67816.__m_loaded and self.SW1_DICT, >and that is that the former one is seen by *all instances*, while >the latter is an attribute in *only

Users

2004-12-09 Thread python1
Do you know of a way to list the users on a Win2K machine? I can't seem to find a module for this. Thanks. -- http://mail.python.org/mailman/listinfo/python-list

Re: ElementTree and XPATH

2004-12-09 Thread Istvan Albert
[EMAIL PROTECTED] wrote: it seems to be invalid syntax if I give "/a/b[0]" to the findall() method. Does anyone know the correct syntax? I think the proper mindset going in should be that elementtree does not support xpath but that there are some handy constructs that resemble the location steps of

Re: Calling a C program from a Python Script

2004-12-09 Thread Grant Edwards
On 2004-12-09, Brad Tilley <[EMAIL PROTECTED]> wrote: > Is it possible to write a file open, then read program in C and then > call the C program from a Python script like this: Huh? What do you mean "write a file open"? You want to read a C source file and execute the C source? If you have a

RE: Users

2004-12-09 Thread Tim Golden
[python1] | Do you know of a way to list the users on a Win2K machine? I | can't seem to find a module for this. Interpretation 1: who is in the user database of a given machine? Investigate the win32net module. Something like this: import win32net import win32netcon MACHINE_NAME = 'VOGBP200'

Re: Calling a C program from a Python Script

2004-12-09 Thread Istvan Albert
Brad Tilley wrote: If possible, how much faster would this be over a pure Python solution? It is like the difference between Batman and Ever. batman is faster than ever -- http://mail.python.org/mailman/listinfo/python-list

Re: Calling a C program from a Python Script

2004-12-09 Thread Brad Tilley
Grant Edwards wrote: Huh? What do you mean "write a file open"? You want to read a C source file and execute the C source? If you have access to a C interpreter, I guess you could invoke the interpreter from python using popen, and feed the C source to it. Alternatively you could invoke a compi

Re: Calling a C program from a Python Script

2004-12-09 Thread It's me
I would expect C to run circles around the same operation under Python. As a general rule of thumb, you should use C for time cirtical operations (computer time, that is), and use Python for human time critical situations (you can get a program developed much faster). I just discovered a magical

Re: Calling a C program from a Python Script

2004-12-09 Thread Fredrik Lundh
Brad Tilley wrote: > for root, files, dirs in os.walk(path) > for f in files: > try: > EXECUTE_C_PROGRAM http://docs.python.org/lib/module-subprocess.html this module in new in 2.4; for older version, os.system() or the os.popen() family might be what you're looking fo

Re: Calling a C program from a Python Script

2004-12-09 Thread Steven Bethard
It's me wrote: I would expect C to run circles around the same operation under Python. You should probably only expect C to run circles around the same operations when those operations implemented entirely in Python. In the specific (trivial) example given, I wouldn't expect Python to be much s

  1   2   >