OT: Re: Looking For Geodetic Python Software

2005-06-23 Thread Tim Daneliuk
Diez B. Roggisch wrote: > Tim Daneliuk wrote: > >> Casey Hawthorne wrote: >> >>> >>> Do your planes fly over the earth's surface or through the ground? >> >> >> >> Why do you presume this has anything to do with airplanes? >> > > That was supposed to be a funny remark regarding that your > "str

Re: User interfaces in console (dialog like)

2005-06-23 Thread James Carroll
Wow, I was just reminiscing about my old TurboVision days... I second the recommendation. On 6/23/05, Jeremy Sanders <[EMAIL PROTECTED]> wrote: > Negroup wrote: > > > Do you guys know an alternative that fits my needings without moving > > from Python? > > Turbo Vision in dos used to be really

Re: Reraise exception with modified stack

2005-06-23 Thread Scott David Daniels
Nicolas Fleury wrote: > Scott David Daniels wrote: > >> How about dropping reraise and changing: >> reraise(...) >> to: >> addinfo(...) >> raise > > > It doesn't work, or at least it doesn't do what I want. I want to keep > the same exception stack to be able to i

Re: don't understand MRO

2005-06-23 Thread Uwe Mayer
Thursday 23 June 2005 19:22 pm Terry Reedy wrote: [...] > In the absence of other information, I would presume that none of the > other classes have a move() method. move() is implemented in the class qtcanvas.QCanvasItem I checked the pyqt sources and it is linked via sip to the C++ object file.

Re: Avoiding deadlocks in concurrent programming

2005-06-23 Thread Terry Hancock
On Wednesday 22 June 2005 04:09 pm, Eloff wrote: > Hi Paul, > >You're doing what every serious database implementation needs to do ... > >Are you sure you don't want to just use an RDBMS? > > It was considered, but we decided that abstracting the data into tables > to be manipulated with SQL queri

Re: os.system(cmd) isn't working

2005-06-23 Thread Gregory Piñero
Thanks to everyone for all the help! After careful consideration I decided to go with os.startfile(url) It works just great! Here's my program in case anyone's interested. 5 points if you can guess what it does ;-) """Take a filepath from stdin and translate to the corresponding url and open

Re: Reraise exception with modified stack

2005-06-23 Thread Nicolas Fleury
Scott David Daniels wrote: > Have you tried it? Looked to do what you described to me when I run a > sample. Note that is an unadorned raise with no args. The idea is to > simply modify the exception object and then use raise to carry the > whole original exception along as if not intercepted.

Re: suggestions invited

2005-06-23 Thread Peter Herndon
As Konstantin alludes, your request is not specified clearly enough. In all-caps you write "APPLICATION MONITORING SYSTEM", yet your only use-case is "it lets the it employee enter the name of the application and gives him all the details about it", where "the details are ... " a bunch of fields th

trouble subclassing str

2005-06-23 Thread Brent
I'd like to subclass the built-in str type. For example: -- class MyString(str): def __init__(self, txt, data): super(MyString,self).__init__(txt) self.data = data if __name__ == '__main__': s1 = MyString("some text", 100) -- but I get the error: Traceback (most rec

Re: how to use more than 1 __init__ constructor in a class ?

2005-06-23 Thread Terry Hancock
On Thursday 23 June 2005 10:31 am, Singletoned wrote: > Rocco Moretti wrote: > > Steven D'Aprano wrote: > > > > That's the joys of a mostly self-taught programming knowledge: you miss > > > out on all the buzzwords. > > > > Being mostly self taught myself, I have a tendancy to use infrequently > >

Re: Avoiding deadlocks in concurrent programming

2005-06-23 Thread Tim Peters
[Terry Hancock] > ... > I realize you've probably already made a decision on this, but this sounds > like a classic argument for using an *object DBMS*, such as ZODB: It > certainly does support transactions, and "abstracting the data into tables" > is a non-issue as ZODB stores Python objects more

Re: List of all installed applications (XP)?

2005-06-23 Thread guy lateur
| [TJG] | Hmmm. While I understand your requirement, it's not as | thought there's some easily-discernible charactersistics | of "commercial software packages which should have licenses | but which don't" No? Really? How disappointing.. ;) | [TJG] | By the sound of it, you're almost better off c

Re: Annoying behaviour of the != operator

2005-06-23 Thread Max
Jordan Rastrick wrote: > I don't want to order the objects. I just want to be able to say if one > is equal to the other. > > Here's the justification given: > > The == and != operators are not assumed to be each other's > complement (e.g. IEEE 754 floating point numbers do not satisf

Re: os.system(cmd) isn't working

2005-06-23 Thread Terry Hancock
On Thursday 23 June 2005 01:19 am, Paul Watson wrote: > "Gregory Piñero" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > os.system(r'"C:\Program Files\Mozilla Firefox\firefox.exe"' + ' > "www.blendedtechnologies.com"') > > The goal is to have firefox open to that website. You don

Re: Loop until condition is true

2005-06-23 Thread Mike Meyer
Michael Hoffman <[EMAIL PROTECTED]> writes: > Mike Meyer wrote: > >> Making None a constant broke existing code (and I just saw old code >> that assigned to None). Are True and False that much more common as >> variable names than None? > > Yes. In fact, I count at least 4 different modules in the

Re: trouble subclassing str

2005-06-23 Thread Paul McGuire
My first thought is "make sure that subclassing str is really what you want to do." Here is a place where I have a subclass of str that really is a special kind of str: class PaddedStr(str): def __new__(cls,s,l,padc=' '): if l > len(s): s2 = "%s%s" % (s,padc*(l-len(s)))

formatted xml output from ElementTree inconsistency

2005-06-23 Thread Matthew Thorley
Greetings, perhaps someone can explain this. I get to different styles of formatting for xmla and xmlb when I do the following: from elementtree import ElementTree as et xmla = et.ElementTree('some_file.xml') xmlb = et.Element('parent') et.SubElement(xmlb, 'child1') et.SubElement(xmlb, 'child2')

Re: suggestions invited

2005-06-23 Thread Aditi
Thanks for ur effort... And I apologise for being sloppy in writing. Well I agree the whole project sounds fictitious because it has been assigned to me in that spirit. The project was explained to me in just 5 minutes and so these are the only details I have and the only documentation I have is a

Re: formatted xml output from ElementTree inconsistency

2005-06-23 Thread Jarek Zgoda
Matthew Thorley napisał(a): > The output I get shows xmla as nicely formatted text, with elements on > different lines and everything all tabbed and pretty. Inverly, xmlb is > one long string on one line. > > Is that because the some_file.xml is already nicely formatted? I thought > that the f

key - key pairs

2005-06-23 Thread Florian Lindner
Hello, is there in python a kind of dictionary that supports key - key pairs? I need a dictionary in which I can access a certain element using two different keys, both unique. For example: I've a dictionary with strings and times. Sometimes I have the string and I want to have the time, other ti

Re: OT: Re: Looking For Geodetic Python Software

2005-06-23 Thread Rocco Moretti
Tim Daneliuk wrote: > Diez B. Roggisch wrote: > >> Tim Daneliuk wrote: >> >>> Casey Hawthorne wrote: >>> Do your planes fly over the earth's surface or through the ground? >>> >>> >>> >>> >>> Why do you presume this has anything to do with airplanes? >>> >> >> That was supposed to be a f

Re: suggestions invited

2005-06-23 Thread Mike Meyer
gry@ll.mit.edu writes: > Aditi wrote: >> hi all...i m a software engg. student completed my 2nd yr...i have been >> asked to make a project during these summer vacations...and hereby i >> would like to invite some ideas bout the design and implementation of >> an APPLICATION MONITORING SYSTEMi

Help wanted in piping in Windows

2005-06-23 Thread Apple Grew
I want to develope a Winboard like application which will support Winboard protocol. For that I require to know how to handle piping in Python. I seperated out module popen2, but when I use fileObject.readline() then it halts the program if the sub-process is waiting for user input; will execut

Help me to log-in

2005-06-23 Thread Apple Grew
Well can anyone tell me how do I login into newsgroup using Mozilla 1.7.7. What should be the username? (I tried with with my e-mail address I subscribed with but failed to log-in). The password asked during log-in is the one I subscribed with? -Apple -- http://mail.python.org/mailman/listinfo

Re: key - key pairs

2005-06-23 Thread Claudio Grondi
> is there in python a kind of dictionary that supports key - key pairs? > I need a dictionary in which I can access a certain element using two > different keys, both unique. > A Python dictionary needs a unique key, so a pair of keys is still one unique key, but probably it is some kind of misund

Hardening enviroment by overloading __import__?

2005-06-23 Thread Steve Juranich
If this is a FAQ, please let me know where the answer is. I have in some code an 'eval', which I hate, but it's the shortest path to where I need to get at this point. I thought that one way I could harden the enviroment against malicious code would be to temporarily disable the import statement

Re: Hardening enviroment by overloading __import__?

2005-06-23 Thread Jp Calderone
On Thu, 23 Jun 2005 13:12:12 -0700, Steve Juranich <[EMAIL PROTECTED]> wrote: >If this is a FAQ, please let me know where the answer is. > >I have in some code an 'eval', which I hate, but it's the shortest >path to where I need to get at this point. I thought that one way I >could harden the envi

Re: key - key pairs

2005-06-23 Thread Scott David Daniels
Florian Lindner wrote: > Hello, > is there in python a kind of dictionary that supports key - key pairs? > I need a dictionary in which I can access a certain element using two > different keys, both unique. > > For example: > > I've a dictionary with strings and times. Sometimes I have the strin

zipfile + symlink..

2005-06-23 Thread A. Murat Eren
Hi, I have a problem about zipfile. I'm trying to add files from local file system into a zip file via zipfile module of python.. I have a function in my class which recursively adds files or dirs into zip: ---8<---8<8<--8<-

Re: suggestions invited

2005-06-23 Thread Peter Herndon
Reasonable enough. As per Mike's suggestion below, building a few web pages to document the apps is a good start. To expand on that idea, you could write daemons/cron jobs, perhaps in Python if Python runs on OS/400, that monitor each app's status and log that information to the web server. You

Re: key - key pairs

2005-06-23 Thread sameer_deshpande
Just an example of dictionary object in python. PythonWin 2.4.1 (#65, Mar 30 2005, 09:33:37) [MSC v.1310 32 bit (Intel)] on win32. Portions Copyright 1994-2004 Mark Hammond ([EMAIL PROTECTED]) - see 'Help/About PythonWin' for further copyright information. >>> d = {} >>> d["key1"] = "value1" >>> d

Re: OT: Re: Looking For Geodetic Python Software

2005-06-23 Thread Paul Rubin
Tim Daneliuk <[EMAIL PROTECTED]> writes: > Huh? When traversing along the surface of the earth, it's curvature > is relevant in computing total distance. An airplane flies more-or-less > in a straight line above that curvature. For sufficiently long airplane > routes (where the ascent/descent d

Re: Hardening enviroment by overloading __import__?

2005-06-23 Thread Paul Rubin
Steve Juranich <[EMAIL PROTECTED]> writes: > Am I barking up the wrong tree with __import__?? Yes. > Where should I look for this answer? Don't. -- http://mail.python.org/mailman/listinfo/python-list

Re: key - key pairs

2005-06-23 Thread Terry Hancock
On Thursday 23 June 2005 02:40 pm, Florian Lindner wrote: > is there in python a kind of dictionary that supports key - key pairs? > I need a dictionary in which I can access a certain element using two > different keys, both unique. > > For example: > > I've a dictionary with strings and times.

Re: Allowing only one instance of a script?

2005-06-23 Thread Aahz
In article <[EMAIL PROTECTED]>, Grant Edwards <[EMAIL PROTECTED]> wrote: > >Both open() and link() are atomic operations, so there's no >race condition. ...unless you're running under NFS. -- Aahz ([EMAIL PROTECTED]) <*> http://www.pythoncraft.com/ f u cn rd ths, u cn gt a gd

Re: formatted xml output from ElementTree inconsistency

2005-06-23 Thread Matthew Thorley
Jarek Zgoda wrote: > Matthew Thorley napisał(a): > >> The output I get shows xmla as nicely formatted text, with elements on >> different lines and everything all tabbed and pretty. Inverly, xmlb is >> one long string on one line. >> >> Is that because the some_file.xml is already nicely formatt

Re: Looking For Geodetic Python Software

2005-06-23 Thread Cousin Stanley
| | 1) Given the latitude/longitude of two locations, compute the distance |between them. | | "Distance" in this case would be either the straight-line |flying distance, or the actual over-ground distance that accounts |for the earth's curvature. # ---

Re: key - key pairs

2005-06-23 Thread Ivan Van Laningham
Hi All-- Terry Hancock wrote: > > On Thursday 23 June 2005 02:40 pm, Florian Lindner wrote: > > is there in python a kind of dictionary that supports key - key pairs? > > I need a dictionary in which I can access a certain element using two > > different keys, both unique. > > > > For example: >

Re: Hardening enviroment by overloading __import__?

2005-06-23 Thread Steven Bethard
Steve Juranich wrote: > I have in some code an 'eval', which I hate, but it's the shortest > path to where I need to get at this point. What's this code trying to do? If you care about malicious code at all, you'll avoid 'eval' completely. A couple reasons why: With only a little trouble, I ca

Re: OT: Re: Looking For Geodetic Python Software

2005-06-23 Thread Tim Daneliuk
Paul Rubin wrote: > Tim Daneliuk <[EMAIL PROTECTED]> writes: > >>Huh? When traversing along the surface of the earth, it's curvature >>is relevant in computing total distance. An airplane flies more-or-less >>in a straight line above that curvature. For sufficiently long airplane >>routes (wh

Re: OT: Re: Looking For Geodetic Python Software

2005-06-23 Thread Tim Daneliuk
Rocco Moretti wrote: > Tim Daneliuk wrote: > >> Diez B. Roggisch wrote: >> >>> Tim Daneliuk wrote: >>> Casey Hawthorne wrote: > > Do your planes fly over the earth's surface or through the ground? Why do you presume this has anything to do with airp

Re: Help me to log-in

2005-06-23 Thread Terry Reedy
"Apple Grew" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Well can anyone tell me how do I login into newsgroup using Mozilla > 1.7.7. What should be the username? (I tried with with my e-mail address > I subscribed with but failed to log-in). The password asked during > log-in i

Re: Allowing only one instance of a script?

2005-06-23 Thread Grant Edwards
On 2005-06-23, Aahz <[EMAIL PROTECTED]> wrote: > In article <[EMAIL PROTECTED]>, > Grant Edwards <[EMAIL PROTECTED]> wrote: >> >>Both open() and link() are atomic operations, so there's no >>race condition. > > ...unless you're running under NFS. I think read somewhere than NFS 3 handles the open

Running Python interpreter in Emacs

2005-06-23 Thread Rex Eastbourne
Hi, I'm interested in running a Python interpreter in Emacs. I have Python extensions for Emacs, and my python menu lists "C-c !" as the command to run the interpreter. Yet when I run it I get the message "Spawning Child Process: invalid argument." What do I need to do/download to fix this? I rea

string capitalize sentence

2005-06-23 Thread dimitri pater
Hello! I want to capitalize every sentence in a string: harry is a strange guy. so is his sister, but at least she is not a guy. i am. to: Harry is a strange guy. So is his sister, but at least she is not a guy. I am. I came up with the following solution: a = 'harry is a strange guy. so is his s

Re: Running Python interpreter in Emacs

2005-06-23 Thread Skip Montanaro
Rex> I'm interested in running a Python interpreter in Emacs. I have Rex> Python extensions for Emacs, and my python menu lists "C-c !" as Rex> the command to run the interpreter. Yet when I run it I get the Rex> message "Spawning Child Process: invalid argument." What do I need

Re: PEP 304 - is anyone really interested?

2005-06-23 Thread Patrick Maupin
Thomas Heller wrote: > Although I was not interested originally, I think that's > a use case I also have. Optional config files, which > should not be compiled to .pyc or .pyo. Only removing > the .py file doesn't have the expected effect > if a .pyc and/or .pyo if is left. I also think that i

Re: string capitalize sentence

2005-06-23 Thread Skip Montanaro
dimitri> I came up with the following solution: dimitri> a = 'harry is a strange guy. so is his sister, but at least she is not a dimitri> guy. i am.' dimitri> b = a.replace('. ', '.') dimitri> splitlist = b.split('.') dimitri> newlist = [] dimitri> for i in range(le

Re: string capitalize sentence

2005-06-23 Thread Konstantin Veretennicov
On 6/24/05, dimitri pater <[EMAIL PROTECTED]> wrote: > a = 'harry is a strange guy. so is his sister, but at least she is not a > guy. i am.' > b = a.replace('. ', '.') > splitlist = b.split('.') > newlist = [] > for i in range(len(splitlist)): > i = ''.join(splitlist[i].capitalize() + '

Re: string capitalize sentence

2005-06-23 Thread dimitri pater
thanks, a lot it works! still learning something every day... DimitriOn 6/24/05, Skip Montanaro <[EMAIL PROTECTED]> wrote: dimitri> I came up with the following solution:dimitri> a = 'harry is a strange guy. so is his sister, but at least she is not adimitri> guy. i am.'dimitri> b =

Re: trouble subclassing str

2005-06-23 Thread Steven D'Aprano
On Thu, 23 Jun 2005 12:25:58 -0700, Paul McGuire wrote: > But if you are subclassing str just so that you can easily print your > objects, look at implementing the __str__ instance method on your > class. Reserve inheritance for true "is-a" relationships. Often, > inheritance is misapplied when

Re: suggestions invited

2005-06-23 Thread Konstantin Veretennicov
On 23 Jun 2005 12:30:27 -0700, Aditi <[EMAIL PROTECTED]> wrote: > Thanks for ur effort... And I apologise for being sloppy in writing. > Well I agree the whole project sounds fictitious because it has been > assigned to me in that spirit. The project was explained to me in > just 5 minutes and so t

Re: Package organization

2005-06-23 Thread Marc 'BlackJack' Rintsch
In <[EMAIL PROTECTED]>, Thomas Lotze wrote: > Assume I have a package called PDF. Should the classes then be called > simply File and Objects, as it is clear what they do as they are > imported from PDF? Or should they be called PDFFile and PDFObjects, as > the names would be too undescrip

Listening for a Keypress (Console, not GUI)

2005-06-23 Thread brettk
Hello All, I've written a small daemon that monitors a pop3 mailbox and downloads any new messages. It's run from the console in windows, and instead of having it print something each time it gets a message or writes a file, i'd like to store those values as internal variables and print them to t

Re: Listening for a Keypress (Console, not GUI)

2005-06-23 Thread brettk
Ok, I should really read my messages more carefully before posting, I apologize. This is what i'm envisioning "Python Mail Service is running..." Status is printed like: "Current Statistics" Messages retrieved : 12345 Errors: 123 Total Files Written: 12345 Like that - again, apologies for my

getting tracebacks from traceback objects

2005-06-23 Thread Michael P. Soulier
Hello, For a GUI app I've tried resetting sys.excepthook to my own exceptionhandler bound method, which accepts a type, value and traceback object. Now, the traceback module has print_exc and format_exc methods that are supposed to take a traceback object and return a formatted traceback like th

Re: Listening for a Keypress (Console, not GUI)

2005-06-23 Thread Michael Hoffman
[EMAIL PROTECTED] wrote: > So, my question is, using a regular console, is there a way I can get > python to listen for a specific keystroke? I'm using signal handling > to deal with ^C, could I also do something like that? This might help: http://www.python.org/doc/faq/windows.html#how-do-i-ch

Re: Running Python interpreter in Emacs

2005-06-23 Thread Philippe C. Martin
Hi, this is what I have: (autoload 'python-mode "python-mode" "Python mode." t) (setq auto-mode-alist (append '(("\\.\\(py\\)$" . python-mode)) auto-mode-alist)) Plus, you can always spawn a shell then call your script (if the point is to have access to the out

Re: trouble subclassing str

2005-06-23 Thread Donn Cave
In article <[EMAIL PROTECTED]>, Steven D'Aprano <[EMAIL PROTECTED]> wrote: > On Thu, 23 Jun 2005 12:25:58 -0700, Paul McGuire wrote: > > > But if you are subclassing str just so that you can easily print your > > objects, look at implementing the __str__ instance method on your > > class. Reser

Re: trouble subclassing str

2005-06-23 Thread John Machin
Brent wrote: > I'd like to subclass the built-in str type. For example: You'd like to build this weird-looking semi-mutable object as a perceived solution to what problem? Perhaps an alternative is a class of objects which have a "key" (your current string value) and some data attributes? Mayb

Re: Re: A World Beyond Capitalism 2005,

2005-06-23 Thread Jenta
Interesting. To anyone who didn't want to know about the conference, my apologies. To everyone who was supportive, thanks. It is appreciated, because like many activists, many python activists have skills which are able to network people worldwide. No matter who you are, thank you for working

Re: List of all installed applications (XP)?

2005-06-23 Thread Neil Hodgson
Not only is it difficult to tell which applications are installed, it is difficult to tell if an application is still installed as all too many applications do not remove all their registry keys upon uninstall. I was going to suggest using a commercial application due to the messiness o

Re: key - key pairs

2005-06-23 Thread Scott David Daniels
Ivan Van Laningham wrote: > Well, Florian said, "using two different keys, both unique"; if that is > true, then a single key maps to a single value & vice versa. Of course you are right. I got caught up in the problem I imagined (the pair being unique). > ... subclass dict and provide get/set

trouble with win32serviceutil

2005-06-23 Thread Erik Myllymaki
I am trying to start and stop a service with python. This used to work on an NT box but not on this 2003 server machine. (note- using "net stop myService" and net start myService" from the command line works just fine). The event viewer does tell me that a "Start command was sent to myService" b

Re: Running Python interpreter in Emacs

2005-06-23 Thread Rex Eastbourne
Hi Skip and Philippe. I added the path for Python to PATH, but I still get the same message (when I try executing the current buffer, I get the message: "The system cannot find the path specified." Philippe, I have the above lines of code in my .emacs file. As for my environment, I'm running Emac

Thanks for PIL (and other stuff)

2005-06-23 Thread jean-marc
I was just reading on daily-python that PIL is 10 years old... So I wish it and its author(s) a good day, week, month, year and more! Really! Jean-Marc PS If I knew that Python had a anniversary date, I'd also write to thanks our BDFL (and authors)! But no such luck, so I'm restaining myself! ;-)

Idle.pyw doesn't start in 2.4.1

2005-06-23 Thread Dave
Hi, I installed 2.4.1 on both my wife's & my computer. Her idle (pyw) starts fine, but mine doesn't. I have had previous versions on my computer as well as idlefork, but I removed them before installing 2.4.1. I tried uninstalling and reinstalling several times, and my idle.pyw file does not res

Re: os.system(cmd) isn't working

2005-06-23 Thread Peter Hansen
Terry Hancock wrote: > On Thursday 23 June 2005 01:19 am, Paul Watson wrote: > >>"Gregory Piñero" <[EMAIL PROTECTED]> wrote in message >>news:[EMAIL PROTECTED] >>os.system(r'"C:\Program Files\Mozilla Firefox\firefox.exe"' + ' >>"www.blendedtechnologies.com"') >> > You don't have any spaces betwee

Re: A World Beyond Capitalism 2005,

2005-06-23 Thread Ivan Van Laningham
Hi All-- Jenta wrote: > > Interesting. > > To anyone who didn't want to know about the conference, my apologies. > > To everyone who was supportive, thanks. It is appreciated, because like > many activists, many python activists have skills which are able to > network people worldwide. > So,

Re: pickle broken: can't handle NaN or Infinity under win32

2005-06-23 Thread Steven D'Aprano
Tim Peters wrote: > [Steven D'Aprano] >>It isn't necessary to look at complex numbers to see the difference >>between positive and negative zero. Just look at a graph of y=1/x. In >>particular, look at the behaviour of the graph around x=0. Now tell me >>that the sign of zero doesn't make a differ

Re: A World Beyond Capitalism 2005,

2005-06-23 Thread Benji York
Ivan Van Laningham wrote: > And what defines a "python activist" anyway? Blowing up Perl > installations worldwide? +1 QOTW -- Benji York -- http://mail.python.org/mailman/listinfo/python-list

Re: pickle broken: can't handle NaN or Infinity under win32

2005-06-23 Thread Robert Kern
Tim Peters wrote: > OK, I looked, and it made no difference to me. Really. If I had an > infinitely tall monitor, maybe I could see a difference, but I don't > -- the sign of 0 on the nose makes no difference to the behavior of > 1/x for any x other than 0. On my finite monitor, I see it looks

Re: Annoying behaviour of the != operator

2005-06-23 Thread Steven D'Aprano
Max wrote: > Jordan Rastrick wrote: >> Well, never, ever use equality or inequality operations with floating >> point numbers anyway, in any language, as they are notoriously >> unreliable due to the inherent inaccuracy of floating point. Thats >> another pitfall, I'll grant, but its a pretty well

Re: PEP 304 - is anyone really interested?

2005-06-23 Thread John Roth
"Patrick Maupin" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Thomas Heller wrote: > >> Although I was not interested originally, I think that's >> a use case I also have. Optional config files, which >> should not be compiled to .pyc or .pyo. Only removing >> the .py file doesn

Re: trouble subclassing str

2005-06-23 Thread Paul McGuire
Dang, that class should be: class PaddedStr(str): def __new__(cls,s,l,padc=' '): if l > len(s): s2 = "%s%s" % (s,padc*(l-len(s))) return str.__new__(cls,s2) else: return str.__new__(cls,s) -- Paul -- http://mail.python.org/mailman/listin

Re: key - key pairs

2005-06-23 Thread Paul McGuire
No need to update __getitem__, since the modified __setitem__ drops in the reverse values. But __delitem__ needs overriding, and some special guard needs to be added to __setitem__ to prevent orphaning any old value:key entries. -- Paul Here's one possible solution: class SymmetricDict(dict):

Favorite non-python language trick?

2005-06-23 Thread Joseph Garvin
As someone who learned C first, when I came to Python everytime I read about a new feature it was like, "Whoa! I can do that?!" Slicing, dir(), getattr/setattr, the % operator, all of this was very different from C. I'm curious -- what is everyone's favorite trick from a non-python language? An

<    1   2