Re: Restore a unified diff

2005-01-04 Thread Tim Peters
[Nick Allen] > After using ndiff from difflib, the function restore > would return the sequence that generated the delta. It can actually reproduce either sequence from which the delta was generated. But this is really trivial: ndiff was intended to produce diff output for humans to read, and in

Re: Restore a unified diff

2005-01-05 Thread Tim Peters
[Nick Allen] >>> Unfortunately, restore does not do the same for unified_diff. I do >>> not see any similar function that is intended for unified_diff. >>> Does anyone know how to "restore" from a unified diff generated >>> delta? [Tim Peters] >&g

RE: OT: spacing of code in Google Groups

2005-01-06 Thread Tim Golden
C) Copyright 1985-2000 Microsoft Corp. o:\scripts\work_in_progress\tim>c:\tools\cut --help Usage: c:\tools\cut [OPTION]... [FILE]... Print selected parts of lines from each FILE to standard output. TJG This e-mail has been

Re: smtp question

2005-01-06 Thread Tim Roberts
. Everything else, including the From: and To: lines, will be taken as part of the message body. I assume you meant to use \r\n, but \n will work just as well and is less error prone. >print "Message length is " + repr(len(msg)) Easier is: print "Message length is", len(msg) More efficient is: print "Message length is %d" % len(msg) -- - Tim Roberts, [EMAIL PROTECTED] Providenza & Boekelheide, Inc. -- http://mail.python.org/mailman/listinfo/python-list

Tkinter Puzzler

2005-01-07 Thread Tim Daneliuk
ne) Any ideas why the first form does not fly? TIA, -------- Tim Daneliuk [EMAIL PROTECTED] PGP Key: http://www.tundraware.com/PGP/ -- http://mail.python.org/mailman/listinfo/python-list

Re: Tkinter Puzzler

2005-01-07 Thread Tim Daneliuk
Tim Daneliuk wrote: I am trying to initialize a menu in the following manner: for entry in [("Up", KeyUpDir), ("Back", KeyBackDir), ("Home", KeyHomeDir), ("Startdir", KeyStartDir), ("Root", KeyRootDir)]: func = entry[1] UI.ShortBtn.menu

RE: [Pyro] Newbie Question Regarding Pyro

2005-01-07 Thread Tim Golden
[John French] | I'm putting together a new project which I'm using to learn | Python and have questions about pyro. You're welcome to ask here, but you might find that posting on Pyro's own mailing list produces answers from people who don't follow c.l.py's higher traffic. | If the server needs

Re: sorting on keys in a list of dicts

2005-01-07 Thread Tim Peters
[Nick Coghlan] ... > Python 2.3 has a stable sort, and Python 2.4 brought the guarantee that it > shall > remain that way. I'm not sure about Python 2.2 and earlier. No list.sort() implementation before 2.3 was stable. It was confusing, though, because the samplesort/binary_insertion_sort hybrid

Tkinter, Alt, and Windows

2005-01-07 Thread Tim Daneliuk
nyone else run into this behavior and have a fix??? TIA, ---- Tim Daneliuk [EMAIL PROTECTED] PGP Key: http://www.tundraware.com/PGP/ -- http://mail.python.org/mailman/listinfo/python-list

Re: Tkinter, Alt, and Windows

2005-01-07 Thread Tim Daneliuk
Tim Daneliuk wrote: Arggg. I have a program that runs comfortably across both Unix variants and Windows ... except I wish to bind an Alt-ButtonRelease-3 combination to popup a menu. This works flawlessly under Unix, but with windows, the menu appears briefly and then disappears. I&#

Re: Returning same type as self for arithmetic in subclasses

2005-01-07 Thread Tim Peters
[Max M] > """ > I subclass datetime and timedelta > > >>> dt = myDatetime(1970,1,1) > >>> type(dt) > > > >>> td = myTimedelta(hours=1) > >>> type(td) > > > But when I do arithmetic with these classes, they return datetime and > timedelta, ... > >>> new_time = dt + td > >>> new_time > datetime.

Getting List Of All Filesystem Mounts

2005-01-08 Thread Tim Daneliuk
Is there some pure Python/portable way to get a list of all currently mounted filesystems? Tim Daneliuk [EMAIL PROTECTED] PGP Key: http://www.tundraware.com/PGP/ -- http://mail.python.org/mailman/listinfo

Re: Installing IPython on win2k

2005-01-08 Thread Tim G
Dave Merrill wrote: > Hi, I'm new to python, and ipython, but not to programming, having trouble > getting ipython installed on windows 2000, python 233. Any help would be > much appreciated; I'm sure I'm being some basic flavor of dense... First of all, rest assured that it does work (and quite e

Re: time module precision

2005-01-08 Thread Tim Peters
[Jane Austine] > What is the precision (and accuracy) of time module on a Windows XP > machine? There are many functions in the time module. You shouldn't assume that any two have similar behavior (because, in fact, they may not). > threading module depends on time module so it's precision(and >

Re: Getting rid of "self."

2005-01-09 Thread Tim Roberts
elf): exec(magic()) print hi hi = "baby" print hi def other(self): exec(magic()) print hi a = A() a.meth() a.other() That's way too fragile to be useful. -- - Tim Roberts, [EMAIL PROTECTED] Providenza & Boekelheide, Inc. -- http://mail.python.org/mailman/listinfo/python-list

Re: time module precision

2005-01-09 Thread Tim Peters
[Tim Peters] >> Python's time.sleep() calls the Win32 API Sleep() function on >> Windows. All behavior is inherited from the latter. See MS's docs: >> >> >> <http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dllproc/base/sleep.asp> [EM

Re: Writing huge Sets() to disk

2005-01-10 Thread Tim Peters
[Martin MOKREJÅ] > just imagine, you want to compare how many words are in English, German, > Czech, Polish disctionary. You collect words from every language and record > them in dict or Set, as you wish. Call the set of all English words E; G, C, and P similarly. > Once you have those Set's o

Re: Dr. Dobb's Python-URL! - weekly Python news and links (Jan 9)

2005-01-10 Thread Tim Churches
n would be more like 'duh toypn' - the underlying principle being one of elimination of all unnecessary syllables, vowels and consonants, thus eliminating the need to move the lips (which reduces effort and stops flies getting in). Tim C Sydney, Australia -- http://mail.python.org/mailman/listinfo/python-list

Re: Writing huge Sets() to disk

2005-01-10 Thread Tim Peters
[Martin MOKREJÅ] > ... > > I gave up the theoretical approach. Practically, I might need up > to store maybe those 1E15 keys. We should work on our multiplication skills here . You don't have enough disk space to store 1E15 keys. If your keys were just one byte each, you would need to have 4 th

Python and Tsunami Warning Systems

2005-01-10 Thread Tim Churches
gspot.com/ It seems to me that this would be a valuable and feasible type of project for the Python community to get involved in (or perhaps take the lead on). Something the PSF might even consider resourcing to some degree? Tim C -- http://mail.python.org/mailman/listinfo/python-list

Re: Writing huve ge Sets() to disk

2005-01-10 Thread Tim Peters
[Tim Peters] >> As I mentioned before, if you store keys in sorted text files, >> you can do intersection and difference very efficiently just by using >> the Unix `comm` utiltity. [Martin MOKREJÅ] > Now I got your point. I understand the comm(1) is written in C, but it stil

Re: Securing a future for anonymous functions in Python

2005-01-10 Thread Tim Peters
... [Anna] >> BTW - I am *quite* happy with the proposal for "where:" syntax - I >> think it handles the problems I have with lambda quite handily. [Steve Holden] > Whereas I find it to be an excrescence, proving (I suppose) that one > man's meat is another person's poison, or something. I've be

Re: Writing huge Sets() to disk

2005-01-10 Thread Tim Peters
;t collide. If you have collisions, > time starts to depend of element quantity. But I'm not sure > > Tim sure can enlighten us. I can only point the way to enlightenment -- you have to contemplate your own navel (or Guido's, but he's kind of shy that way). What Istv

Re: Python.org, Website of Satan

2005-01-11 Thread Tim Churches
SSUM is an anagram of SAVIOUR MUD SONG - besmirching the name of our Lord through filthy canticles! Tim C -- http://mail.python.org/mailman/listinfo/python-list

Detecting shutdown of remote socket endpoint.

2005-01-11 Thread Tim Gosselin
I am writing a tcp tunnel but cannot find a way of detecting when a socket shuts down its read end without writing to the socket. For testing the write end of the remote endpoint I just do a: if not sock.recv(buffsize) I cannot write to the socket and check if send returns 0 though, because that

Re: Python.org, Website of Satan

2005-01-11 Thread Tim Daneliuk
be practiced non-routably... -- -------- Tim Daneliuk [EMAIL PROTECTED] PGP Key: http://www.tundraware.com/PGP/ -- http://mail.python.org/mailman/listinfo/python-list

Re: Re: Python.org, Website of Satan

2005-01-12 Thread Tim Churches
TimC <[EMAIL PROTECTED]> wrote: > > Writing code that has to be indented *exactly* or it just won't > work. I bet they all use eVIl VI too. > > -- > TimC -- http://astronomy.swin.edu.au/staff/tconnors/ Hey, two (real, actual) TimCs from the same country posting to the same list on the same st

[ANN]: twander 3.160 Released And Available

2005-01-12 Thread Tim Daneliuk
tion - about 3100/1300 lines of code/comments - A RCT (Really Cool Tool) that will have you addicted in a day or two See the web page for more information, a screen shot, and the complete documentation. -- Tim Daneliuk [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

[ANN]: twander 3.160 Released And Available

2005-01-12 Thread Tim Daneliuk
tion - about 3100/1300 lines of code/comments - A RCT (Really Cool Tool) that will have you addicted in a day or two See the web page for more information, a screen shot, and the complete documentation. -- Tim Daneliuk [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

RE: Excel module for Python

2005-01-12 Thread Tim Golden
[Simon Brunning] [sam <[EMAIL PROTECTED]>] wrote: | > No, I don't use MS windows. I need to generate Excel file | by printing | > data to it, just like Perl module Spreadsheet::WriteExcel. | | If you need to write out formulae, formratting, that kind of thing, | then I think you'll need to write

Re: Octal notation: severe deprecation

2005-01-13 Thread Tim Roberts
le that the creation and destruction of an object might have useful side effects. -- - Tim Roberts, [EMAIL PROTECTED] Providenza & Boekelheide, Inc. -- http://mail.python.org/mailman/listinfo/python-list

Re: why are people still using classic classes?

2005-01-13 Thread Tim Roberts
ill no compelling reason to break the old habits and type those 6 extra characters. Once a person has a case where the new classes make a difference, I suspect they catch the new habit and never look back. I haven't crossed that threshhold yet. -- - Tim Roberts, [EMAIL PROTECTED] Providenza &

Re: lambda

2005-01-13 Thread Tim Leslie
Because if it takes more than a single line it deserves a name. Also, if you have more than one line in this function, how do you plan to reference it if not by name? Tim On Thu, 13 Jan 2005 20:53:09 +1000, Egor Bolonev <[EMAIL PROTECTED]> wrote: > why functions created with lambda for

Unclear On Class Variables

2005-01-13 Thread Tim Daneliuk
* rather than the class. It is late and I am probably missing the obvious. Enlightenment appreciated ... -- Tim Daneliuk [EMAIL PROTECTED] PGP Key: http://www.tundraware.com/PGP/ -- http://mail.python.org/mailman

Re: python 2.3.4 for windows: float("NaN") throws exception

2005-01-13 Thread Tim Peters
[EMAIL PROTECTED] > my python 2.3.4 for windows refuse to execute line float("NaN"). It > says: > > >>> float("NaN") > Traceback (most recent call last): > File "", line 1, in ? > ValueError: invalid literal for float(): NaN > > The same line works as expected on Linux and Solaris with python 2.3.

Re: python 2.3.4 for windows: float("NaN") throws exception

2005-01-13 Thread Tim Peters
[EMAIL PROTECTED] > C99 and Fortran 2003 have IEEE arithmetic. Not that simple (e.g., C99 doesn't *require* it; but it has a pile of specified IEEE behaviors a conforming C99 compiler can choose to support (or not), along with a preprocessor symbol those that do so choose can #define to advertise

Re: Pickled text file causing ValueError (dos/unix issue)

2005-01-14 Thread Tim Peters
[Aki Niimura] > I started to use pickle to store the latest user settings for the tool > I wrote. It writes out a pickled text file when it terminates and it > restores the settings when it starts. ... > I guess DOS text format is creating this problem. Yes. > My question is "Is there any elegant

Re: python and macros (again) [Was: python3: 'where' keyword]

2005-01-14 Thread Tim Jarman
Skip Montanaro wrote: > > Fredrik> no, expressions CAN BE USED as statements. that doesn't mean > Fredrik> that they ARE statements, unless you're applying belgian > logic. > > Hmmm... I'd never heard the term "belgian logic" before. Googling > provided a few uses, but no formal d

Re: Writing huge Sets() to disk

2005-01-14 Thread Tim Peters
[Martin MOKREJÅ] > This comm(1) approach doesn't work for me. It somehow fails to > detect common entries when the offset is too big. > > file 1: > > A > F > G > I > K > M > N > R > V > AA > AI > FG > FR > GF > GI > GR > IG > IK > IN > IV > KI > MA > NG > RA > RI > VF > AIK > FGR > FRA > GFG > GIN

Re: Why 'r' mode anyway? (was: Re: Pickled text file causing ValueError (dos/unix issue))

2005-01-14 Thread Tim Peters
[Irmen de Jong] > I've been wondering why there even is the choice between binary mode > and text mode. Why can't we just do away with the 'text mode' ? > What does it do, anyways? At least, if it does something, I'm sure > that it isn't something that can be done in Python itself if > really requi

Re: Pickled text file causing ValueError (dos/unix issue)

2005-01-14 Thread Tim Peters
[Tim Peters] >>Yes: regardless of platform, always open files used for pickles >> in binary mode. ... [John Machin] > Tim, the manual as of version 2.4 does _not_ mention the need > to use 'b' on OSes where it makes a difference, not even in the > examples at the

Re: oddities in the datetime module

2005-01-14 Thread Tim Peters
[Max M] > ... > First of, it should be possible to easily convert between the > datetime objects. Why? All the conversions people asked for when the module was being designed were implemented. > And eg. the date object doesn't have a datetime() method. Which > it could easily have. But not a *s

Re: Why 'r' mode anyway?

2005-01-14 Thread Tim Peters
[Tim Peters] >> That differences may exist is reflected in the C >> standard, and the rules for text-mode files are more restrictive >> than most people would believe. [Irmen de Jong] > Apparently. Because I know only about the Unix <-> Windows > difference (wind

Re: from __future__ import decorators

2005-01-15 Thread Tim Roberts
Jacek Generowicz <[EMAIL PROTECTED]> wrote: > >I have some code, which makes copious use of the @decorator syntax I'm very curious to know what kind of application you are writing in which "copious use of the @decorator syntax" actually solved a problem productively

Re: Threading Or Other Suggestions?!?

2005-01-15 Thread Tim Roberts
s, I was thinking about threads... does anyone have other/better >suggestion(s)? Does anyone see any difficulty/memory problems in using >threads? Yes. Threads are used to run multiple parts of your own program. To run another program, you need to launch a new process. You can still monitor i

Re: hash patent by AltNet; Python is prior art?

2005-01-15 Thread Tim Churches
ly one day within my lifetime we'll have a governemt here in Australia which will roll back the damage done to our patent system by trying to make just like the US system, just so we can conclude an unbelieveably inequitable free trade agreement with the US. But that's our problem.

Re: python mode indentation problem

2005-01-15 Thread Tim Peters
[Xah Lee] ... > © who the fuck coded the python mode in emacs? The major contributors are listed at the top of python-mode.el. > fuckhead please peruse: > © http://xahlee.org/UnixResource_dir/writ/responsible_license.html OK, I read it, but have no idea what point you're trying to make here. If

Re: interpret 4 byte as 32-bit float (IEEE-754)

2005-01-16 Thread Tim Peters
[Bengt Richter] ... > But I don't know how to build QNaNs: You can subtract infinity from infinity. While all Python behavior in the presence of NaNs, infinities, and signed zeroes is a platform-dependent accident, it you're on a box that has such things, and figure out some (accidental!) way to

Re: Native widgets for Python

2005-01-17 Thread Tim Heaney
Stephen Thorne <[EMAIL PROTECTED]> writes: > > there's someone writing 'dabo', which is apparently "wxpython but > more python". It looks like dabo uses, not replaces, wxPython http://dabodev.com/about -- http://mail.python.org/mailman/listinfo/python-list

Re: Py_Object* Py_BuildValue, Py_INCREF necessary?

2005-01-17 Thread Tim Peters
[Torsten Mohr] > when i write an extension module in C and return a Py_Object* > that i've built with Py_BuildValue, do i need to use Py_INCREF > on that before i return it to python from my extension module > or not? The docs for Py_BuildValue() say it returns a new reference (and it does). So t

Re: news feed problem -- anyone else?

2005-01-17 Thread Tim Daneliuk
wing *free* newsfeed: http://individual.net/ HTH, -------- Tim Daneliuk [EMAIL PROTECTED] PGP Key: http://www.tundraware.com/PGP/ -- http://mail.python.org/mailman/listinfo/python-list

Re: Fuzzy matching of postal addresses

2005-01-17 Thread Tim Churches
hon, which includes, inter alia, a hidden Markov model address parser. It might be overkill or (at this stage of its development) too slow for your application. The next version (ina month or two) will include a geocoding engine which could also be used for what you want to do, I suspect. Tim C -

RE: script to automate GUI application (newbie)

2005-01-18 Thread Tim Golden
[bogdan romocea] | I have a GUI application (Windows; apparently written in Java) which I | want to use through a script (without a mouse or keyboard). First, one | of several buttons needs to be clicked (no keyboard shortcuts | available, but I can measure the coordinates in pixels from the top |

Re: Re: Fuzzy matching of postal addresses

2005-01-18 Thread Tim Churches
on your data (or use the simpler deterministic engine if you like). Provided that your data are not too large (eg more than a few hundred thousand records), Febrl should work fairly well. We'd be pleased to get any feedback you may have. Tim C -- http://mail.python.org/mailman/listinfo/python-list

RE: Print to Windows default Printer

2005-01-19 Thread Tim Golden
[Samantha] | I am new to Python and I am having considerable trouble | trying to print | (using a simple script) to the default printer rather than the screen. | Thanks for any help. | S It may be that something here will help you: http://tgolden.sc.sabren.com/python/win32_how_do_i/print.html

Re: simultaneous multiple requests to very simple database

2005-01-19 Thread Tim Jarman
Olaf Zetanien wrote: > > Use Firebird as sql backend. Is designed as you request (readers not lock > writers and writers not lock readers). Google for "firebird optimistic > lock". > > Off course, you have python driver: http://kinterbasdb.sf.net and can > deploy on windows and linux with a ver

Re: Zen of Python

2005-01-19 Thread Tim Peters
different meaning. It's not that "Flat is better than > nested" it's that "Too flat is bad and too flat is nested so be as < nested (or as flat) as you have to be and no more." Perhaps Tim > Peters is far too concise for my feeble mind Always happy to help a fellow

Re: Zen of Python

2005-01-19 Thread Tim Peters
[Paul Rubin] > Huh? [1,2,[3,4,5],[6,7]],8 is a perfectly valid Python list. You're claiming not to know any relevant difference between Python lists and Lisp lists? Heh. > And you can break out of a containing loop from a nested loop > with try/raise. Heh heh. Yes, you can. I've neve

RE: Print to Windows default Printer

2005-01-20 Thread Tim Golden
[Samantha] | Thanks Tim. I didn't realize it would be so difficult. | S Strictly, if all you want to do is print text and you have mapped LPTx: to some printer (local or network) then the venerable "PRINT " or "COPY LPTx:" may well be what you want. You can issue these v

RE: Automatic Windows printer creation?

2005-01-20 Thread Tim Golden
[Roger Upole] | | You can probably do it through WMI. (class is Win32_Printer) | WMI works well with win32com, and there's also a wrapper module | | http://tgolden.sc.sabren.com/python/wmi.html | | for simplified access. | I imagine getting all the device parameters and port | configuration rig

RE: Oddity is shutil.copyfileobj

2005-01-20 Thread Tim Golden
[Neil Benn] | I'm running a program which is using | shutil.copyfileobj on a Win2K Pro, python 2.3 box. Just for (possible) reassurance, I've just run the following code snippet on my Win2k Python 2.3.4 box and it seemed to work without adding any oddities to the file name. I'm copying to a "r

[ANN] tconfpy 2.112 Released And Available

2005-01-20 Thread Tim Daneliuk
cluding Unix 'man', Plain Text, html, pdf, and ~ Postscript. 'tconfpy' is a Pure Python module and is platform-independent. It should work identically on any platform on which Python runs. - -- Tim D

Re: why no time() + timedelta() ?

2005-01-20 Thread Tim Peters
[josh] > Why can't timedelta arithmetic be done on time objects? Obviously, because it's not implemented . > (e.g. datetime.time(5)-datetime.timedelta(microseconds=3) > > Nonzero "days" of the timedelta could either be ignored, or > trigger an exception. And if the result is less than 0, or >= 2

RE: Print to Windows default Printer

2005-01-20 Thread Tim Golden
[Samantha] [... snip my explanation of PRINT / COPY LPTx: ...] | Thanks Tim, | That is exactly what I want to do. | How do I map the printer to LPT1? | S Depends on a lot of things: whether the printer is local or networked; what version of Windows you're running, &. As a very basic

RE: Print to Windows default Printer

2005-01-20 Thread Tim Golden
[Samantha] | The printer is on LPT1, but I sure can't get the temp file to | print for some | reason. | I am using Windows XP SP2. | S i'm afraid I have to step out here (metaphorically speaking): I'm using Win2K and have no access to XP boxes. The technique works fine here; it may be that eithe

Re: PyCon Preliminary Program Announced!

2005-01-20 Thread Tim Peters
[Bryan] > can anyone tell me how the talks work? there are between 9 > and 12 talks for each time slot. do all talks start at the same > time? or are there just four talks at a time and the columns show > what talks are in a given room? The web page needs better formatting. In general, there ar

Re: Is there a library to parse Mozilla "mork" documents?

2005-01-20 Thread Tim Roberts
han the same file would be in, say, INI format. I wrote a Python script to parse it, but it isn't terribly robust. I was able to produce a dictionary, but I didn't do anything with the results. You're welcome to take a look: http://www.probo.com/timr/parsemsf.py -- - Ti

Re: global variable, ok for string, bad for int

2005-01-21 Thread Tim Roberts
27;:1, 'deux':2} > >def print_value(): > print vardict['un'] ># ok, that works > > > >#!/bin/python >varint = 1 > >def print_value(): > print varint ># ok, that failed > >python 2.3.4

RE: Print to Windows default Printer

2005-01-21 Thread Tim Golden
[Samantha] | Thanks for the URL. I finally am able to print the temp file. | Not exactly | what I wanted, but it will work. The code I used to print was this: | | os.system ("start /min notepad /P temp.txt") | | Thanks ALL! | S Glad you got it sorted. What you describe is, in fact, the sli

Re: PyCon Preliminary Program Announced!

2005-01-21 Thread Tim Peters
[A.M. Kuchling] > Suggestions for improvement are welcome. Perhaps the Wiki version of > the schedule, at http://www.python.org/moin/PyConDC2005/Schedule, > may be better. It is, but the 2004 schedule was really what I had in mind (very readable!): http://www.python.org/pycon/dc2004/schedule

Re: Zen of Python

2005-01-21 Thread Tim Peters
[Paul Rubin] >> You snipped out the examples I gave, like [x*x for x in range(5)] >> leaving unnecessary residue in the name space. Was it not >> obvious from the beginning that that was a kludge? If it was >> obviously a kludge, was it not obvious that there would be >> reason to want to fix it

Re: Tuple size and memory allocation for embedded Python

2005-01-21 Thread Tim Peters
[Jinming Xu] >> Python seems unstable, when allocating big memory. For >> example, the following C++ code creates a tuple of tuples: >> >> PyObject* arCoord = PyTuple_New(n); >> double d = 1.5; >> for(int i=0; i> { >> PyObject* coord = PyTuple_New(2); >> PyTuple_SetItem(coord

re Insanity

2005-01-22 Thread Tim Daneliuk
MPT...] string in the line. Ideas anyone? -- ---- Tim Daneliuk [EMAIL PROTECTED] PGP Key: http://www.tundraware.com/PGP/ -- http://mail.python.org/mailman/listinfo/python-list

Re: Comments in configuration files

2005-01-22 Thread Tim Daneliuk
27;tconfpy' recognizes a superset of the language recognized by 'ConfigParser'. But you have to be careful because the semantics are somewhat different. -- -------- Tim Daneliuk [EMAIL PROTECTED] PGP Key: h

Re: What YAML engine do you use?

2005-01-22 Thread Tim Parkin
tests rather than conform to a constantly changing BNF and it seems to have few warts. Tim -- http://mail.python.org/mailman/listinfo/python-list

Re: Zen of Python

2005-01-22 Thread Tim Peters
[Tim Peters] >> But at that time, Python didn't have lexical scoping, and it wasn't >> clear that it ever would. So what's the bigger wart? Making >> listcomps exactly equivalent to an easily-explained Python for-loop >> nest, or introducing a notion of lex

Re: getting file size

2005-01-22 Thread Tim Roberts
son I >should do both? When reading to the end of a file, won't tell() be just >as accurate as os.path.getsize()? On Windows, those two are not equivalent. Besides the newline conversion done by reading text files, the solution in 2. will stop as soon as it sees a ctrl-Z. If you used

Re: Insanity

2005-01-23 Thread Tim Daneliuk
Fredrik Lundh wrote: Tim Daneliuk wrote: Given an arbitrary string, I want to find each individual instance of text in the form: "[PROMPT:optional text]" I tried this: y=re.compile(r'\[PROMPT:.*\]') Which works fine when the text is exactly "[PROMPT:whatever]"

Re: re Insanity

2005-01-23 Thread Tim Daneliuk
Orlando Vazquez wrote: Tim Daneliuk wrote: For some reason, I am having the hardest time doing something that should be obvious. (Note time of posting ;) Given an arbitrary string, I want to find each individual instance of text in the form: "[PROMPT:optional text]" I tried t

Re: Insanity

2005-01-23 Thread Tim Daneliuk
Fredrik Lundh wrote: Tim Daneliuk wrote: Thanks - very helpful. One followup - your re works as advertised. But if I use: r'\[PROMPT:[^]].*\]' it seems not to. the '.*' instead of just '*' it matches the entire string ... it's not "just '*'

Re: Classical FP problem in python : Hamming problem

2005-01-23 Thread Tim Peters
[Francis Girard] > ... > In the meantime, I couldn't resist to test the new Python features about > laziness on a classical FP problem, i.e. the "Hamming" problem. ... > Nevertheless, while the Haskell version prints Hamming sequence for as long as > I can stand it, and with very little memory cons

Re: Weakref.ref callbacks and eliminating __del__ methods

2005-01-23 Thread Tim Peters
[Mike C. Fletcher] > I'm looking at rewriting parts of Twisted and TwistedSNMP to eliminate > __del__ methods (and the memory leaks they create). A worthy goal! > Looking at the docs for 2.3's weakref.ref, there's no mention of whether the > callbacks are held with a strong reference. A callback

RE: Pointer: CfV de.comp.lang.python

2005-01-24 Thread Tim Golden
[Christian Helmbold] | I ask german speaking python programmers to contest the election to | establish the german python newsgroup de.comp.lang.python. It strikes me that this would have been one of the few occasions when it *would* have made sense to write in a language other than English on c.

Re: Memory Usage

2005-01-24 Thread Tim Peters
[<[EMAIL PROTECTED]>] > Would a Python process consume more memory on a PC with lots of > memory? > > For example, say I have the same Python script running on two WinXP > computers that both have Python 2.4.0. One computer has 256 MB of Ram > while the other has 2 GB of Ram. On the machine with le

Re: Weakref.ref callbacks and eliminating __del__ methods

2005-01-24 Thread Tim Peters
[Tim] >> I'll note that one fairly obvious pattern works very well for weakrefs >> and __del__ methods (mutatis mutandis): don't put the __del__ method >> in self, put it in a dead-simple object hanging *off* of self. Like >> the simple: >> >> clas

Re: Classical FP problem in python : Hamming problem

2005-01-24 Thread Tim Peters
[Francis Girard] > For all the algorithms that run after their tail in an FP way, like the > Hamming problem, or the Fibonacci sequence, (but unlike Sieve of Eratosthene > -- there's a subtle difference), i.e. all those algorithms that typically > rely upon recursion to get the beginning of the gen

Re: is there better 32 clock() timing?

2005-01-25 Thread Tim Roberts
on Windows? The ONLY way to get small-integer microsecond responses in Windows is to write a kernel driver, and even then there are no guarantees. Windows is NOT a real-time system. If you have an environment where an unexpected delay of a millisecond or more is going to cause damage, then you n

Re: Why can't use cursor.nextset() in adodbapi package?

2005-01-25 Thread Tim Roberts
gt; > >>> crsr.nextset() If you are only issuing one SELECT, like most applications, then nextset() serves no purpose. If you did something like this: sql = "select * from wjtmp; select count(*) from wjtmp;" That's when you need nextset(). Personally, I've never used it. -- - Tim Roberts, [EMAIL PROTECTED] Providenza & Boekelheide, Inc. -- http://mail.python.org/mailman/listinfo/python-list

RE: how to ncurses on win32 platform

2005-01-25 Thread Tim Golden
[Jorgen Grahn] | [Alan Gauld ] | > You can use ncurses via cygwin. | > There are DOS ports too but I couldn't get any of them to | > work on my XP box, YMMV... | | Or, as Alex Martelli wrote in "Python in a nutshell": | |"The curses package works only on Unix-like platforms | (there are per

Re: threading.py Condition wait overflow error

2005-01-25 Thread Tim Peters
[Mark English] > Every once in a while since I moved to Python 2.4 I've been seeing the > following exception in threading.py Condition: > > File "mctest3.py", line 1598, in WaitForMessages >self.condResponses.wait(1.0) > File "C:\Program Files\Python24\lib\threading.py", line 221, in wait >

Re: re Insanity

2005-01-26 Thread Tim Daneliuk
Aahz wrote: In article <[EMAIL PROTECTED]>, Tim Daneliuk <[EMAIL PROTECTED]> wrote: Given an arbitrary string, I want to find each individual instance of text in the form: "[PROMPT:optional text]" I tried this: y=re.compile(r'\[PROMPT:.*\]') Which wor

Re: python memory blow out

2005-01-26 Thread Tim Peters
[Simon Wittber] >> According to the above post: >>a) If the allocation is > 256 bytes, call the system malloc. >>b) If the allocation is < 256, use its own malloc implementation, which >> allocates memory in 256 kB chunks and never releases it. >> >> I imagine this means that large me

Re: threading.py Condition wait overflow error

2005-01-26 Thread Tim Peters
[Tim Peters] ... >> The most common cause for "impossible exceptions" > is flawed C code in an extension that fails to >> check a Python C API call for an error return. [Mark English] > Yes, I use a lot of C modules which I wrote. Then you know where to start lookin

tkinter: Can You Underline More Than 1 Char In A Menu Title

2005-01-27 Thread Tim Daneliuk
differently in different circumstances. Is it possible to underline more than a single character as I am doing with the 'underline=0' above. I tried 'underline=(0,2)' but that didn't work. Ideas? TIA, -- ---

Re: On benchmarks, heaps, priority queues

2005-01-27 Thread Tim Peters
[EMAIL PROTECTED], on ] > Yes I know in theory the insertion sort approach should be bad for > large enough values, but the weird thing is that if you mix inserts and > deletes (with enough deletes) even 1M elements is not a large enough > value. Anyway,

Re: tkinter: Can You Underline More Than 1 Char In A Menu Title

2005-01-27 Thread Tim Daneliuk
Jeff Epler wrote: On Thu, Jan 27, 2005 at 06:38:22AM -0500, Tim Daneliuk wrote: Is it possible to underline more than a single character as I am doing with the 'underline=0' above. I tried 'underline=(0,2)' but that didn't work. No. Jeff I love

RE: win32com/makepy question

2005-01-28 Thread Tim Golden
[Tom Willis] | It seems in COM late binding is something that should be | avoided if possible. | | Because python seems to be really good at doing thing dynamically I'm | wondering why no one has figured out how to make the functionality in | makepy fire automagically when you need it. I (near

Re: Who should security issues be reported to?

2005-01-28 Thread Tim Peters
[EMAIL PROTECTED] > Who are the appropriate people to report security problems to > in respect of a module included with the Python distribution? > I don't feel it appropriate to be reporting it on general mailing > lists. The Python project has no non-public resources for this. Filing a bug repo

Re: Textual markup languages (was Re: What YAML engine do you use?)

2005-01-29 Thread Tim Parkin
nt and that the semantic structure is important. People who have used non-wysiwyg editors have found that their initial reticence has been quickly overtaken by their joy at not having to fight with 'style' and the reassurance that their content is now 'redesign proof'. Tim Parkin http://www.pollenation.net -- http://mail.python.org/mailman/listinfo/python-list

Re: pickle, cPickle, & HIGHEST_PROTOCOL

2005-01-30 Thread Tim Peters
[A.B., Khalid] > I wonder if someone can explain what is wrong here. I am pickling a > list of dictionaries (see code attached) and unpickling it back using > the HIGHEST_PROTOCOL of pickle and cPickle. ... > ... on Win98. Pickles are binary data. Therefore you should open pickle files in binary

<    9   10   11   12   13   14   15   16   17   18   >