Nothing to repeat

2011-01-09 Thread Tom Anderson
Hello everyone, long time no see, This is probably not a Python problem, but rather a regular expressions problem. I want, for the sake of arguments, to match strings comprising any number of occurrences of 'spa', each interspersed by any number of occurrences of the 'm'. 'any number' includ

Parsing DTDs

2009-05-29 Thread Tom Anderson
Hello! I would like to parse XML DTDs. The goal is to be able to validate XML-like object structures against DTDs in a fairly flexible way, although i can get from a parsed DTD to a validation engine myself, so that's not an essential feature of the parser (although it would be nice!). What s

Re: strptime and timezones

2008-08-14 Thread Tom Anderson
On Wed, 13 Aug 2008, Christian Heimes wrote: Tom Anderson wrote: Secondly, do you really have to do this just to parse a date with a timezone? If so, that's ridiculous. No, you don't. :) Download the pytz package from the Python package index. It's *the* tool for timez

strptime and timezones

2008-08-13 Thread Tom Anderson
Hello! Possibly i'm missing something really obvious here. But ... If i have a date-time string of the kind specified in RFC 1123, like this: Tue, 12 Aug 2008 20:48:59 -0700 Can i turn that into a seconds-since-the-epoch time using the standard time module without jumping through substantial

Re: Question about idioms for clearing a list

2006-02-07 Thread Tom Anderson
On Tue, 7 Feb 2006, Ben Sizer wrote: > Raymond Hettinger wrote: >> [Steven D'Aprano] The Zen isn't "only one way to do it". If it were, we wouldn't need iterators, list comps or for loops, because they can all be handled with a while loop (at various costs of efficiency, clarit

Re: Dual Core outlook

2006-02-07 Thread Tom Anderson
On Tue, 7 Feb 2006, malv wrote: > Maybe this is too simplistic, but given two programs, one in Python the > other in Java or C#. Would this mean that running the latter on a dual > core processor would significantly increase execution speed, whereas the > Python program would be running in one

Re: would it be feasable to write python DJing software

2006-02-03 Thread Tom Anderson
On Fri, 3 Feb 2006, Ivan Voras wrote: > Levi Campbell wrote: > >> Hi, I'm thinking about writing a system for DJing in python, but I'm >> not sure if Python is fast enough to handle the realtime audio needed >> for DJing, could a guru shed some light on this subject and tell me if >> this is do

Re: learning python, using string help

2006-02-03 Thread Tom Anderson
On Fri, 2 Feb 2006, [EMAIL PROTECTED] wrote: > silly newbie mistake > > your code runs fine on my openbsd box. ( I didnt uncomment the return > map(...) line My apologies - i should have made it clearer in the comment that it was hardwired to return example data! > thanks for the awesome exampl

Re: learning python, using string help

2006-02-02 Thread Tom Anderson
On Thu, 2 Feb 2006, [EMAIL PROTECTED] wrote: > Well, I did want to add some formatting for example I getcha. This is really an HTML problem rather than a python problem, isn't it? What you need to do is output a table. FWIW, here's how i'd do it (assuming you've got HP-UX ruptime, since that's

Re: Why checksum? [was Re: Fuzzy Lookups]

2006-02-02 Thread Tom Anderson
On Thu, 1 Feb 2006, it was written: > Tom Anderson <[EMAIL PROTECTED]> writes: > >>> The obvious way is make a list of hashes, and sort the list. >> >> Obvious, perhaps, prudent, no. To make the list of hashes, you have to >> read all of every single file f

Re: Why checksum? [was Re: Fuzzy Lookups]

2006-02-01 Thread Tom Anderson
On Tue, 31 Jan 2006, it was written: > Steven D'Aprano <[EMAIL PROTECTED]> writes: > >> This isn't a criticism, it is a genuine question. Why do people compare >> local files with MD5 instead of doing a byte-to-byte compare? I often wonder that! >> Is it purely a caching thing (once you have th

Re: StringIO proposal: add __iadd__

2006-01-30 Thread Tom Anderson
On Sun, 29 Jan 2006, Alex Martelli wrote: > Paul Rubin wrote: > >> Maybe the standard versions of some of these things can be written in >> RPython under PyPy, so they'll compile to fast machine code, and then >> the C versions won't be needed. > > By all means, the C

Re: simple perl program in python gives errors

2006-01-30 Thread Tom Anderson
On Mon, 30 Jan 2006, Grant Edwards wrote: > On 2006-01-30, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > >> i was hoping one didnt have to initialize variables because perl >> defaults their value to zero. Also I noticed if I initialize a variable >> as 0 , then I can only do integer math not f

Re: Numarray, numeric, NumPy, scpy_core ??!!

2006-01-22 Thread Tom Anderson
On Sat, 21 Jan 2006, Robert Kern wrote: > Tom Anderson wrote: > >> Pardon my failure to RTFM, but does NumPy pick up the vecLib BLAS on Macs? > > Yes. Excellent, thanks. tom -- forget everything from school -- you are programmer -- http://mail.python.org/mailman/listinfo/python-list

Re: OT: excellent book on information theory

2006-01-21 Thread Tom Anderson
Slow and to the pointless, but ... On Wed, 18 Jan 2006, Terry Hancock wrote: > On Mon, 16 Jan 2006 12:15:25 -0500 > "Tim Peters" <[EMAIL PROTECTED]> wrote: > >> More "Britishisms" are surviving in the Scholastic editions as the >> series goes on, but as the list for Half-Blood Prince shows the e

Re: Numarray, numeric, NumPy, scpy_core ??!!

2006-01-21 Thread Tom Anderson
On Sat, 21 Jan 2006, Travis E. Oliphant wrote: > J wrote: > >> I will just jump in an use NumPy. I hope this one will stick and evolve >> into the mother of array packages. How stable is it ? For now I really >> just need basic linear algebra. i.e. matrix multiplication, dot, cross >> etc > > T

Re: Arithmetic sequences in Python

2006-01-21 Thread Tom Anderson
On Sat, 21 Jan 2006, it was written: > Tom Anderson <[EMAIL PROTECTED]> writes: > >>> listx/dictx/setx would be the display forms as well as the constructor >>> forms. >> >> Could these even replace the current forms? If you want the equivalent &g

Re: Arithmetic sequences in Python

2006-01-21 Thread Tom Anderson
On Fri, 20 Jan 2006, it was written: > [EMAIL PROTECTED] (Alex Martelli) writes: > >>> How would you make a one-element list, which we'd currently write as >>> [3]? Would you have to say list((3,))? >> >> Yep. I don't particularly like the "mandatory trailing comma" in the >> tuple's display fo

Re: Returning a tuple-struct

2006-01-21 Thread Tom Anderson
On Thu, 18 Jan 2006 [EMAIL PROTECTED] wrote: > Is there a better way? Thoughts? I was thinking along these lines: class NamedTuple(tuple): def __init__(self, indices, values): "indices should be a map from name to index" tuple.__init__(self, values)

Re: On Numbers

2006-01-18 Thread Tom Anderson
On Wed, 18 Jan 2006, Steven D'Aprano wrote: > On Tue, 17 Jan 2006 23:34:40 +0000, Tom Anderson wrote: > >>>> So I don't really know what point you are making. What solution(s) for >>>> 1**0.5 were you expecting? >>> >>> He's p

Re: Arithmetic sequences in Python

2006-01-17 Thread Tom Anderson
On Tue, 17 Jan 2006, Antoon Pardon wrote: > Op 2006-01-16, Alex Martelli schreef <[EMAIL PROTECTED]>: >> Paul Rubin wrote: >> >>> Steven D'Aprano <[EMAIL PROTECTED]> writes: For finite sequences, your proposal adds nothing new to existing solutions like range a

Re: Arithmetic sequences in Python

2006-01-17 Thread Tom Anderson
On Tue, 16 Jan 2006, it was written: > Tom Anderson <[EMAIL PROTECTED]> writes: > >> The natural way to implement this would be to make .. a normal >> operator, rather than magic, and add a __range__ special method to >> handle it. "a .. b" would tr

Re: Web application design question (long)

2006-01-17 Thread Tom Anderson
On Tue, 16 Jan 2006, Fried Egg wrote: > I am interested if anyone can shed any light on a web application > problem, I'm not going to help you with that, but i am going to mention the Dada Engine: http://dev.null.org/dadaengine/ And its most famous incarnation, the Postmodernism Generator: h

Re: On Numbers

2006-01-17 Thread Tom Anderson
On Mon, 16 Jan 2006, Erik Max Francis wrote: > Steven D'Aprano wrote: > >> The square root of 1 is +1 (the negative root being explicitly >> rejected). Pure mathematicians, who may be expected to care whether the >> root is the integer 1 or the real number 1, are unlikely to write >> 1**0.5, pr

Re: Arithmetic sequences in Python

2006-01-16 Thread Tom Anderson
On Mon, 16 Jan 2006, Alex Martelli wrote: > Steven D'Aprano <[EMAIL PROTECTED]> wrote: > >> On Mon, 16 Jan 2006 12:51:58 +0100, Xavier Morel wrote: >> >>> For those who'd need the (0..n-1) behavior, Ruby features something >>> that I find quite elegant (if not perfectly obvious at first), >>> (f

Re: Arithmetic sequences in Python

2006-01-16 Thread Tom Anderson
On Mon, 16 Jan 2006, Gregory Petrosyan wrote: > Please visit http://www.python.org/peps/pep-0204.html first. > > As you can see, PEP 204 was rejected, mostly because of not-so-obvious > syntax. But IMO the idea behind this pep is very nice. Agreed. Although i have to say, i like the syntax there

Re: Arithmetic sequences in Python

2006-01-16 Thread Tom Anderson
On Mon, 16 Jan 2006, it was written: > There's something to be said for that. Should ['a'..'z'] be a list or a > string? And while we're there, what should ['aa'..'zyzzogeton'] be? tom -- Socialism - straight in the mainline! -- http://mail.python.org/mailman/listinfo/python-list

Re: On Numbers

2006-01-16 Thread Tom Anderson
On Sun, 15 Jan 2006, Alex Martelli wrote: > Paul Rubin wrote: > >> Mike Meyer <[EMAIL PROTECTED]> writes: >> >>> I'd like to work on that. The idea would be that all the numeric types >>> are representations of reals with different properties that make them >>> appropr

Re: how do "real" python programmers work?

2006-01-13 Thread Tom Anderson
On Fri, 13 Jan 2006, Roy Smith wrote: > Mike Meyer <[EMAIL PROTECTED]> wrote: > >> we need a term for development environment built out of Unix tools > > We already have one. The term is "emacs". Emacs isn't built out of unix tools - it's a standalone program. Ah, of course - to an true bel

Re: how do "real" python programmers work?

2006-01-13 Thread Tom Anderson
On Thu, 12 Jan 2006, Mike Meyer wrote: > well, we need a term for development environment built out of Unix > tools Disintegrated development environment? Differentiated development environment? How about just a development environment? tom -- NOW ALL ASS-KICKING UNTIL THE END -- http:/

Re: how do "real" python programmers work?

2006-01-13 Thread Tom Anderson
On Thu, 12 Jan 2006, bblais wrote: > In Matlab, I do much the same thing, except there is no compile phase. I > have the editor on one window, the Matlab interactive shell in the > other. I often make a bunch of small scripts for exploration of a > problem, before writing any larger apps. I g

Re: try: except :

2006-01-10 Thread Tom Anderson
On Tue, 10 Jan 2006, Duncan Booth wrote: > Paul Rubin wrote: > >> Hallvard B Furuseth <[EMAIL PROTECTED]> writes: class NeverRaised(Exception): pass for ex in ZeroDivisionError, NeverRaised: >>> >>> Heh. Simple enough. Unless some obstinate person raises it anyway... >> >> Hmm, ok, how

Re: Help wanted with md2 hash algorithm

2006-01-10 Thread Tom Anderson
On Sun, 8 Jan 2006, Tom Anderson wrote: > On Fri, 6 Jan 2006 [EMAIL PROTECTED] wrote: > >> below you find my simple python version of MD2 algorithm as described >> in RFC1319 (http://rfc1319.x42.com/MD2). It produces correct results >> for strings shorter than 16 Byt

Re: Help wanted with md2 hash algorithm

2006-01-07 Thread Tom Anderson
On Fri, 6 Jan 2006 [EMAIL PROTECTED] wrote: > below you find my simple python version of MD2 algorithm > as described in RFC1319 (http://rfc1319.x42.com/MD2). > It produces correct results for strings shorter than 16 Bytes and wrong > results for longer strings. > > I can't find what's wrong. > >

Re: Memoization and encapsulation

2006-01-04 Thread Tom Anderson
On Wed, 4 Jan 2006 [EMAIL PROTECTED] wrote: > I think python is broken here-- why aren't lists hashable, or why isn't > there a straightforward way to make memoised() work? a = [1, 2, 3] d = {a: "foo"} a[0] = 0 print d[a] I feel your pain, but i don't think lists (and mutable objects generally)

Re: Calling GPL code from a Python application

2006-01-04 Thread Tom Anderson
On Wed, 4 Jan 2006, Mike Meyer wrote: > Terry Hancock <[EMAIL PROTECTED]> writes: > >> It is interesting to note that the FSF holds the position that the >> language that "gives you this right" *doesn't* -- it just clarifies the >> fact that you already hold that right, because it is provided by

Re: itertools.izip brokeness

2006-01-04 Thread Tom Anderson
On Wed, 4 Jan 2006, Raymond Hettinger wrote: > [EMAIL PROTECTED] wrote: > >> The whole point of using izip is to make the code shorter, more >> concise, and easier to write and understand. > > That should be the point of using anything in Python. The specific goal > for izip() was for an iterat

Re: Filename case-insensitivity on OS X

2006-01-03 Thread Tom Anderson
On Tue, 3 Jan 2006, Dan Sommers wrote: > On Tue, 03 Jan 2006 15:21:19 GMT, > Doug Schwarz <[EMAIL PROTECTED]> wrote: > >> Strictly speaking, it's not OS X, but the HFS file system that is case >> insensitive. Aaah, of course. Why on earth didn't Apple move to UFS/FFS/whatever with the switch to

Re: Filename case-insensitivity on OS X

2006-01-03 Thread Tom Anderson
On Tue, 3 Jan 2006, Scott David Daniels wrote: > Tom Anderson wrote: > >> Java has a java.io.File.getCanonicalPath method that does this, but i can't >> find an equivalent in python - is there one? > > What's wrong with: os.path.normcase(path) ? It doesn't

Re: itertools.izip brokeness

2006-01-03 Thread Tom Anderson
On Tue, 3 Jan 2006, it was written: > [EMAIL PROTECTED] writes: > >> The problem is that sometimes, depending on which file is the shorter, >> a line ends up missing, appearing neither in the izip() output, or in >> the subsequent direct file iteration. I would guess that it was in >> izip's b

Re: Spiritual Programming (OT, but Python-inspired)

2006-01-03 Thread Tom Anderson
On Mon, 2 Jan 2006 [EMAIL PROTECTED] wrote: > In this sense, we are like the ghost in the machine of a computer > system running a computer program, or programs, written in a procedural > language and style. Makes sense - i heard that Steve Russell invented continuations after reading the Tibeta

Filename case-insensitivity on OS X

2006-01-03 Thread Tom Anderson
Afternoon all, MacOS X seems to have some heretical ideas about the value of case in paths - it seems to believe that it doesn't exist, more or less, so "touch foo FOO" touches just one file, you can't have both 'makefile' and 'Makefile' in the same directory, "os.path.exists(some_valid_path.u

Re: Memoization and encapsulation

2006-01-01 Thread Tom Anderson
On Sat, 31 Dec 2005 [EMAIL PROTECTED] wrote: >just> I actually prefer such a global variable to the default arg >just> trick. The idiom I generally use is: > >just> _cache = {} >just> def func(x): >just> result = _cache.get(x) >just> if result is None: >just>

Re: putenv

2005-12-20 Thread Tom Anderson
On Tue, 20 Dec 2005, Steve Holden wrote: > Mike Meyer wrote: >> Terry Hancock <[EMAIL PROTECTED]> writes: >> >>> On Tue, 20 Dec 2005 05:35:48 - >>> Grant Edwards <[EMAIL PROTECTED]> wrote: >>> On 2005-12-20, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > I have csh script

Re: getopt and options with multiple arguments

2005-12-20 Thread Tom Anderson
On Mon, 19 Dec 2005, [EMAIL PROTECTED] wrote: > I want to be able to do something like: > > myscript.py * -o outputfile > > and then have the shell expand the * as usual, perhaps to hundreds of > filenames. But as far as I can see, getopt can only get one argument > with each option. In the abov

Re: how to remove duplicated elements in a list?

2005-12-20 Thread Tom Anderson
On Mon, 19 Dec 2005, Brian van den Broek wrote: > [EMAIL PROTECTED] said unto the world upon 2005-12-19 02:27: >> Steve Holden wrote: >> >>> Kevin Yuan wrote: >>> How to remove duplicated elements in a list? eg. [1,2,3,1,2,3,1,2,1,2,1,3] -> [1,2,3]? Thanks!! >>> >>> >>> list(set

Re: urllib.urlopen

2005-12-18 Thread Tom Anderson
On Sat, 17 Dec 2005, Dennis Lee Bieber wrote: > (Now there is an interesting technical term: > #define ERROR_ARENA_TRASHED 7) FreeBSD at one point had an EDOOFUS; Apple kvetched about this being offensive, so it was changed to EDONTPANIC. I shitteth thee not. tom -- information distribut

Re: IsString

2005-12-14 Thread Tom Anderson
On Tue, 13 Dec 2005, Steve Holden wrote: > Tom Anderson wrote: >> On Tue, 13 Dec 2005, Steven D'Aprano wrote: >> >>> On Mon, 12 Dec 2005 18:51:36 -0600, Larry Bates wrote: >>> >>> [snippidy-doo-dah] >>> >>>> I had the same th

Re: IsString

2005-12-14 Thread Tom Anderson
On Wed, 14 Dec 2005, Steven D'Aprano wrote: > On Tue, 13 Dec 2005 15:28:32 +0000, Tom Anderson wrote: > >> On Tue, 13 Dec 2005, Steven D'Aprano wrote: >> >>> On Mon, 12 Dec 2005 18:51:36 -0600, Larry Bates wrote: >>> >>> [snippidy-doo-dah] &g

Re: IsString

2005-12-14 Thread Tom Anderson
On Tue, 13 Dec 2005, Mike Meyer wrote: > You can show the same difference in behavior between Python and C (for > example) without using a function call. Really? You certainly don't do that with the code below. > Here's C: > > #include > > main() { > int i, *ref ; > i = 1 ; > ref = &i ; /

Re: IsString

2005-12-14 Thread Tom Anderson
On Tue, 13 Dec 2005, Xavier Morel wrote: > Tom Anderson wrote: > >> In what sense are the names-bound-to-references-to-objects not >> variables? > > In the sense that a variable has various meta-informations (at least a > type) No. In a statically typed language (or

Re: IsString

2005-12-14 Thread Tom Anderson
On Tue, 13 Dec 2005, Fredrik Lundh wrote: > Steve Holden wrote: > >> In Python a name (*not* a "variable", though people do talk loosely >> about "instance variables" and "class variables" just to be able to use >> terms familiar to users of other to languages) is simply *bound* to a >> value.

Re: const objects (was Re: Death to tuples!)

2005-12-14 Thread Tom Anderson
On Wed, 14 Dec 2005, Steven D'Aprano wrote: > On Wed, 14 Dec 2005 10:57:05 +0100, Gabriel Zachmann wrote: > >> I was wondering why python doesn't contain a way to make things "const"? >> >> If it were possible to "declare" variables at the time they are bound >> to objects that they should not al

Re: Python is incredible!

2005-12-13 Thread Tom Anderson
On Tue, 13 Dec 2005, Cameron Laird wrote: > In article <[EMAIL PROTECTED]>, > Tom Anderson <[EMAIL PROTECTED]> wrote: >> On Mon, 12 Dec 2005, Cameron Laird wrote: >> >>> While there is indeed much to love about Lisp, please be aware >>> that me

Re: Python is incredible!

2005-12-13 Thread Tom Anderson
On Mon, 12 Dec 2005, Xavier Morel wrote: > Luis M. Gonzalez wrote: > >> You are not the first lisper who fell inlove with Python... >> Check this out: >> http://www.paulgraham.com/articles.html > > Paul Graham is not in love with Python though, he's still very much in love > with Lisp. > > He mer

Re: IsString

2005-12-13 Thread Tom Anderson
On Tue, 13 Dec 2005, Steven D'Aprano wrote: > On Mon, 12 Dec 2005 18:51:36 -0600, Larry Bates wrote: > > [snippidy-doo-dah] > >> I had the same thought, but reread the post. He asks "if a given >> variable is a character or a number". I figured that even if he is >> coming from another languag

Re: OO in Python? ^^

2005-12-12 Thread Tom Anderson
On Mon, 12 Dec 2005, Donn Cave wrote: > In article <[EMAIL PROTECTED]>, > [EMAIL PROTECTED] (Alex Martelli) wrote: > >> Tom Anderson <[EMAIL PROTECTED]> wrote: >>... >> >> >>> For example, if i wrote code like this (using python syntax)

Re: OO in Python? ^^

2005-12-12 Thread Tom Anderson
On Mon, 12 Dec 2005, Bengt Richter wrote: On Mon, 12 Dec 2005 01:12:26 +, Tom Anderson <[EMAIL PROTECTED]> wrote: -- ø¤º°`°º¤øø¤º°`°º¤øø¤º°`°º¤øø¤º°`°º¤ø [OT} (just taking liberties with yo

Re: Developing a network protocol with Python

2005-12-12 Thread Tom Anderson
On Mon, 12 Dec 2005, Laszlo Zsolt Nagy wrote: > I think to be effective, I need to use TCP_NODELAY, and manually > buffered transfers. Why? > I would like to create a general messaging object that has methods like > > sendinteger > recvinteger > sendstring > recvstring Okay. So you're really d

Re: Python is incredible!

2005-12-12 Thread Tom Anderson
On Mon, 12 Dec 2005, Tolga wrote: > I am using Common Lisp for a while and nowadays I've heard so much about > Python that finally I've decided to give it a try becuase You read reddit.com, and you want to know why they switched? > Python is not very far away from Lisp family. That's an intere

Re: Python is incredible!

2005-12-12 Thread Tom Anderson
On Mon, 12 Dec 2005, Cameron Laird wrote: > While there is indeed much to love about Lisp, please be aware > that meaningful AI work has already been done in Python Wait - meaningful AI work has been done? ;) tom -- limited to concepts that are meta, generic, abstract and philosophical -- IEE

Re: Pattern matching with string and list

2005-12-12 Thread Tom Anderson
On Mon, 12 Dec 2005 [EMAIL PROTECTED] wrote: > I'd need to perform simple pattern matching within a string using a list > of possible patterns. For example, I want to know if the substring > starting at position n matches any of the string I have a list, as > below: > > sentence = "the color is

Re: how does exception mechanism work?

2005-12-12 Thread Tom Anderson
On Mon, 12 Dec 2005, it was written: > [EMAIL PROTECTED] writes: > >> Is this model correct or wrong? Where can I read about the mechanism >> behind exceptions? > > Usually you push exception handlers and "finally" clauses onto the > activation stack like you push return addresses for function c

Re: OO in Python? ^^

2005-12-11 Thread Tom Anderson
On Mon, 12 Dec 2005, Steven D'Aprano wrote: On Sun, 11 Dec 2005 05:48:00 -0800, bonono wrote: And I don't think Haskell make the programmer do a lot of work(just because of its static type checking at compile time). I could be wrong, but I think Haskell is *strongly* typed (just like Python)

Re: ANN: Dao Language v.0.9.6-beta is release!

2005-12-11 Thread Tom Anderson
On Sun, 11 Dec 2005, Steven D'Aprano wrote: On Sat, 10 Dec 2005 16:34:13 +0000, Tom Anderson wrote: On Sat, 10 Dec 2005, Sybren Stuvel wrote: Zeljko Vrba enlightened us with: Find me an editor which has folds like in VIM, regexp search/replace within two keystrokes (ESC,:), mar

Re: ANN: Dao Language v.0.9.6-beta is release!

2005-12-10 Thread Tom Anderson
On Sat, 10 Dec 2005, Sybren Stuvel wrote: > Zeljko Vrba enlightened us with: > >> Find me an editor which has folds like in VIM, regexp search/replace >> within two keystrokes (ESC,:), marks to easily navigate text in 2 >> keystrokes (mx, 'x), can handle indentation-level matching as well as >>

Re: Validating an email address

2005-12-09 Thread Tom Anderson
On Sat, 10 Dec 2005, Ben Finney wrote: > Tom Anderson <[EMAIL PROTECTED]> wrote: > >> A hoary old chestnut this - any advice on how to syntactically >> validate an email address? > > Yes: Don't. > >http://www.apps.ietf.org/rfc/rfc3696.html#sec-3>

Re: Encoding of file names

2005-12-09 Thread Tom Anderson
On Fri, 9 Dec 2005, "Martin v. Löwis" wrote: Tom Anderson wrote: Isn't the key thing that Windows is applying a non-roundtrippable character encoding? This is a fact, but it is not a key thing. Of course Windows is applying a non-roundtrippable character encoding. What e

Re: heartbeats

2005-12-09 Thread Tom Anderson
On Fri, 9 Dec 2005, Peter Hansen wrote: > Tom Anderson wrote: >> On Fri, 9 Dec 2005, Sybren Stuvel wrote: >>> You probably mean "really a ping, just not an ICMP echo request". >> >> What's a real ping, if not an ICMP echo request? That's pret

Re: heartbeats

2005-12-09 Thread Tom Anderson
On Fri, 9 Dec 2005, Sybren Stuvel wrote: > Yves Glodt enlightened us with: > >> In detail I need a daemon on my central server which e.g. which in a >> loop pings (not really ping but you know what I mean) each 20 seconds >> one of the clients. Do you mean pings one client every 20 sec, or each

Validating an email address

2005-12-09 Thread Tom Anderson
Hi all, A hoary old chestnut this - any advice on how to syntactically validate an email address? I'd like to support both the display-name-and-angle-bracket and bare-address forms, and to allow everything that RFC 2822 allows (and nothing more!). Currently, i've got some regexps which recogni

Re: Encoding of file names

2005-12-09 Thread Tom Anderson
On Thu, 8 Dec 2005, "Martin v. Löwis" wrote: utabintarbo wrote: Fredrik, you are a God! Thank You^3. I am unworthy For all those who followed this thread, here is some more explanation: Apparently, utabintarbo managed to get U+2592 (MEDIUM SHADE, a filled 50% grayish square) and U+2524 (B

Re: How to get the extension of a filename from the path

2005-12-09 Thread Tom Anderson
On Thu, 8 Dec 2005, gene tani wrote: > Lad wrote: > >> what is a way to get the the extension of a filename from the path? > > minor footnote: windows paths can be raw strings for os.path.split(), > or you can escape "/" > tho Tom's examp indicates unescaped, non-raw string works with > splitext(

Re: How to get the extension of a filename from the path

2005-12-08 Thread Tom Anderson
On Thu, 8 Dec 2005, Lad wrote: > what is a way to get the the extension of a filename from the path? > E.g., on my XP windows the path can be > C:\Pictures\MyDocs\test.txt > and I would like to get > the the extension of the filename, that is here > txt You want os.path.splitext: >>> import os

Re: ANN: Dao Language v.0.9.6-beta is release!

2005-12-04 Thread Tom Anderson
On Sun, 4 Dec 2005 [EMAIL PROTECTED] wrote: >> you're about 10 years late > > The same could be said for hoping that the GIL will be eliminated. > Utterly hopeless. > > Until... there was PyPy. Maybe now it's not so hopeless. No - structuring by indentation and the global lock are entirely diff

Re: Tabs bad (Was: ANN: Dao Language v.0.9.6-beta is release!)

2005-12-04 Thread Tom Anderson
On Sun, 4 Dec 2005, [utf-8] Björn Lindström wrote: This article should explain it: http://www.jwz.org/doc/tabs-vs-spaces.html Ah, Jamie Zawinski, that well-known fount of sane and reasonable ideas. It seems to me that the tabs-vs-spaces thing is really about who controls the indentation: wi

Re: ANN: Dao Language v.0.9.6-beta is release!

2005-12-03 Thread Tom Anderson
On Fri, 2 Dec 2005, [EMAIL PROTECTED] wrote: > Dave Hansen wrote: > >> TAB characters are evil. They should be banned from Python source >> code. The interpreter should stop translation of code and throw an >> exception when one is encountered. Seriously. At least, I'm serious >> when I say

Re: Comparison problem

2005-11-26 Thread Tom Anderson
On Sat, 26 Nov 2005, Peter Hansen wrote: > Tom Anderson wrote: >> On Sat, 26 Nov 2005, Chris wrote: >> >>> if item[0:1]=="-": >> >> item[0:1] seems a rather baroque way of writing item[0]! I'd actually >> suggest writing this line l

Re: icmp - should this go in itertools?

2005-11-26 Thread Tom Anderson
On Sat, 26 Nov 2005, Diez B. Roggisch wrote: > Tom Anderson wrote: > >> Is this any good? Would it be any use? Should this be added to itertools? > > Whilst not a total itertools-expert myself, I have one little objection > with this: the comparison won't let me kno

Re: icmp - should this go in itertools?

2005-11-26 Thread Tom Anderson
On Fri, 25 Nov 2005, Roy Smith wrote: > Tom Anderson <[EMAIL PROTECTED]> wrote: > >> It's modelled after the way cmp treats lists - if a and b are lists, >> icmp(iter(a), iter(b)) should always be the same as cmp(a, b). >> >> Is this any good? Wou

Re: Comparison problem

2005-11-26 Thread Tom Anderson
Chris, as well as addressing what i think is causing your problem, i'm going to point out some bits of your code that i think could be polished a little. It's intended in a spirit of constructive criticism, so i hope you don't mind! On Sat, 26 Nov 2005, Chris wrote: >if item[0:1]=="-": it

Re: Why are there no ordered dictionaries?

2005-11-25 Thread Tom Anderson
On Fri, 25 Nov 2005, Christoph Zwerschke wrote: > Tom Anderson wrote: > >> True, but that's not exactly rocket science. I think the rules governing >> when your [] acts like a dict [] and when it acts like a list [] are vastly >> more complex than the name of one at

Yet another ordered dictionary implementation

2005-11-25 Thread Tom Anderson
What up yalls, Since i've been giving it all that all over the ordered dictionary thread lately, i thought i should put my fingers where my mouth is and write one myself: http://urchin.earth.li/~twic/odict.py It's nothing fancy, but it does what i think is right. The big thing that i'm not ha

icmp - should this go in itertools?

2005-11-25 Thread Tom Anderson
Hi all, This is a little function to compare two iterators: def icmp(a, b): for xa in a: try: xb = b.next() d = cmp(xa, xb) if (d != 0): return d excep

Re: Which License Should I Use?

2005-11-25 Thread Tom Anderson
On Fri, 25 Nov 2005, mojosam wrote: > How do I decide on a license? You decide on what obligations you wish to impose on licensees, then pick a license which embodies those. There are basically three levels of obligation: 1. None. 2. Derivatives of the code must be open source. 3. Derivative

Re: Which License Should I Use?

2005-11-25 Thread Tom Anderson
On Fri, 25 Nov 2005, Robert Kern wrote: > You may also want to read this Licensing HOWTO: > > http://www.catb.org/~esr/faqs/Licensing-HOWTO.html > > It's a draft, but it contains useful information. It's worth mentioning that ESR, who wrote that, is zealously pro-BSD-style-license. That's not t

Re: Why are there no ordered dictionaries?

2005-11-25 Thread Tom Anderson
On Wed, 23 Nov 2005, Christoph Zwerschke wrote: > Tom Anderson wrote: > >>> I think it would be probably the best to hide the keys list from the >>> public, but to provide list methods for reordering them (sorting, slicing >>> etc.). >> >> one with u

Re: Why are there no ordered dictionaries?

2005-11-25 Thread Tom Anderson
On Wed, 23 Nov 2005, Carsten Haese wrote: > On Wed, 2005-11-23 at 15:17, Christoph Zwerschke wrote: >> Bengt Richter wrote: >> >> > E.g., it might be nice to have a mode that assumes d[key] is >> d.items()[k][1] when >> > key is an integer, and otherwise uses dict lookup, for cases where >> the us

Re: Why are there no ordered dictionaries?

2005-11-25 Thread Tom Anderson
On Wed, 23 Nov 2005, Christoph Zwerschke wrote: > Alex Martelli wrote: > >> However, since Christoph himself just misclassified C++'s std::map as >> "ordered" (it would be "sorted" in this new terminology he's now >> introducing), it seems obvious that the terminological confusion is >> rife. >

Re: Why are there no ordered dictionaries?

2005-11-22 Thread Tom Anderson
On Tue, 22 Nov 2005, Christoph Zwerschke wrote: > Fuzzyman schrieb: > >> Of course ours is ordered *and* orderable ! You can explicitly alter >> the sequence attribute to change the ordering. > > What I actually wanted to say is that there may be a confusion between a > "sorted dictionary" (one

Re: Why are there no ordered dictionaries?

2005-11-22 Thread Tom Anderson
On Tue, 22 Nov 2005, Christoph Zwerschke wrote: > One implementation detail that I think needs further consideration is in > which way to expose the keys and to mix in list methods for ordered > dictionaries. > > In Foord/Larosa's odict, the keys are exposed as a public member which > also seem

Re: Why are there no ordered dictionaries?

2005-11-22 Thread Tom Anderson
On Tue, 22 Nov 2005, Carsten Haese wrote: > On Tue, 2005-11-22 at 14:37, Christoph Zwerschke wrote: > >> In Foord/Larosa's odict, the keys are exposed as a public member which >> also seems to be a bad idea ("If you alter the sequence list so that it >> no longer reflects the contents of the dic

Re: user-defined operators: a very modest proposal

2005-11-22 Thread Tom Anderson
On Tue, 22 Nov 2005 [EMAIL PROTECTED] wrote: > Each unicode character in the class 'Sm' (Symbol, > Math) whose value is greater than 127 may be used as a user-defined operator. EXCELLENT idea, Jeff! > Also, to accomodate operators such as u'\N{DOUBLE INTEGRAL}', which are not > simple unary or b

Re: user-defined operators: a very modest proposal

2005-11-22 Thread Tom Anderson
On Tue, 22 Nov 2005, Steve R. Hastings wrote: > User-defined operators could be defined like the following: ]+[ Eeek. That really doesn't look right. Could you remind me of the reason we can't say [+]? It seems to me that an operator can never be a legal filling for an array literal or a subscr

Re: Any royal road to Bezier curves...?

2005-11-22 Thread Tom Anderson
On Tue, 22 Nov 2005, Warren Francis wrote: > For my purposes, I think you're right about the natural cubic splines. > Guaranteeing that an object passes through an exact point in space will > be more immediately useful than trying to create rules governing where > control points ought to be pla

Re: Backwards compatibility [was Re: is parameter an iterable?]

2005-11-22 Thread Tom Anderson
On Tue, 22 Nov 2005, Steven D'Aprano wrote: > Are there practical idioms for solving the metaproblem "solve problem X > using the latest features where available, otherwise fall back on older, > less powerful features"? > > For instance, perhaps I might do this: > > try: >built_in_feature >

Re: Any royal road to Bezier curves...?

2005-11-21 Thread Tom Anderson
On Mon, 21 Nov 2005, Tom Anderson wrote: > On Sun, 20 Nov 2005, Warren Francis wrote: > >> Basically, I'd like to specify a curved path of an object through space. 3D >> space would be wonderful, but I could jimmy-rig something if I could just >> get 2D... Are bez

Re: Why are there no ordered dictionaries?

2005-11-21 Thread Tom Anderson
On Sun, 20 Nov 2005, Alex Martelli wrote: > Christoph Zwerschke <[EMAIL PROTECTED]> wrote: > >> The 'sorted' function does not help in the case I have indicated, where >> "I do not want the keys to be sorted alphabetically, but according to >> some criteria which cannot be derived from the keys

Re: Any royal road to Bezier curves...?

2005-11-21 Thread Tom Anderson
On Sun, 20 Nov 2005, Warren Francis wrote: > Basically, I'd like to specify a curved path of an object through space. > 3D space would be wonderful, but I could jimmy-rig something if I could > just get 2D... Are bezier curves really what I want after all? No. You want a natural cubic spline:

Re: running functions

2005-11-18 Thread Tom Anderson
On Thu, 17 Nov 2005, Scott David Daniels wrote: > Gorlon the Impossible wrote: > >> I have to agree with you there. Threading is working out great for me >> so far. The multiprocess thing has just baffled me, but then again I'm >> learning. Any tips or suggestions offered are appreciated... > > Th

  1   2   3   >