Re: Single type for __builtins__ in Py3.0

2005-09-23 Thread Tom Anderson
On Fri, 23 Sep 2005, Collin Winter wrote: > If possible, I'd like to see this go in before 3.0. The reference manual > currently states [2] that __builtins__ can be either a dict or a module, > so changing it to always be a module would still be in keeping with > this. However, I realise that t

Re: Productivity and economics at software development

2005-09-23 Thread Tom Anderson
On Fri, 23 Sep 2005, Scott David Daniels wrote: > Adriano Monteiro wrote: > >> I'm making a little research project about programming languages e >> their respective IDEs. The goal is to trace each language silhouettes, >> where it fits better, their goods/bads and the costs of developing in >

Re: [RFC] Parametric Polymorphism

2005-09-25 Thread Tom Anderson
On Sun, 25 Sep 2005, Catalin Marinas wrote: > Sorry if this was previously discussed but it's something I miss in > Python. I get around this using isinstance() but it would be cleaner to > have separate functions with the same name but different argument types. > I think the idea gets quite cl

Re: Struggling with basics

2005-09-25 Thread Tom Anderson
On Sun, 25 Sep 2005, Jason wrote: > A week ago I posted a simple little hi-score routine that I was using to > learn Python. > > I've only just managed to examine the code, and the responses that people > gave, and I'm now seriously struggling to understand why things aren't > working correctly

Re: Proposal: add sys to __builtins__

2005-09-26 Thread Tom Anderson
On Sun, 25 Sep 2005, James Stroud wrote: > I'm into *real* purity. I would rather begin every script: > > from python import list, str, dict, sys, os > > Oh wait. I only use dict in less than 50% of my scripts: > > from python import list, str, sys, os > > That's better. What? How exactly is th

Re: Metaclasses, decorators, and synchronization

2005-09-26 Thread Tom Anderson
On Mon, 26 Sep 2005, Jp Calderone wrote: > On Sun, 25 Sep 2005 23:30:21 -0400, Victor Ng <[EMAIL PROTECTED]> wrote: >> You could do it with a metaclass, but I think that's probably overkill. >> >> It's not really efficient as it's doing test/set of an RLock all the >> time, but hey - you didn't a

Re: PEP 350: Codetags

2005-09-26 Thread Tom Anderson
On Mon, 26 Sep 2005, Micah Elliott wrote: > Please read/comment/vote. This circulated as a pre-PEP proposal > submitted to c.l.py on August 10, but has changed quite a bit since > then. I'm reposting this since it is now "Open (under consideration)" > at

Re: PEP 350: Codetags

2005-09-27 Thread Tom Anderson
On Tue, 27 Sep 2005, Bengt Richter wrote: > 5) Sometimes time of day can be handy, so maybe <2005-09-26 12:34:56> > could be recognized? ISO 8601 suggests writing date-and-times like 2005-09-26T12:34:56 - using a T as the separator between date and time. I don't really like the look of it, but

Re: Silly function call lookup stuff?

2005-09-28 Thread Tom Anderson
On Tue, 27 Sep 2005, Dan Sommers wrote: > On Wed, 28 Sep 2005 00:38:23 +0200, > Lucas Lemmens <[EMAIL PROTECTED]> wrote: > >> On Tue, 27 Sep 2005 13:56:53 -0700, Michael Spencer wrote: > >>> Lucas Lemmens wrote: > Why isn't the result of the first function-lookup cached so that followin

Re: A rather unpythonic way of doing things

2005-10-01 Thread Tom Anderson
On Thu, 29 Sep 2005, Peter Corbett wrote: > One of my friends has recently taken up Python, and was griping a bit > about the language (it's too "prescriptive" for his tastes). In > particular, he didn't like the way that Python expressions were a bit > crippled. So I delved a bit into the lang

Re: User-defined augmented assignment

2005-10-01 Thread Tom Anderson
On Thu, 29 Sep 2005, Pierre Barbier de Reuille wrote: > a discussion began on python-dev about this. It began by a bug report, > but is shifted and it now belongs to this discussion group. > > The problem I find with augmented assignment is it's too complex, it's > badly explained, it's error-pro

Re: Python 3! Finally!

2005-10-01 Thread Tom Anderson
On Fri, 30 Sep 2005, Stefan Behnel wrote: > I just firefoxed to Python.org and clicked on the bz2 link at > http://python.org/2.4.2/ and what did I get? > > Python-3.4.2.tar.bz2 !! > > Python 3 - what we've all been waiting for, finally, it's there! Not only that, but they've skipped the tiresome

Re: Exception raising, and performance implications.

2005-10-04 Thread Tom Anderson
On Mon, 3 Oct 2005, it was written: > "leo" <[EMAIL PROTECTED]> writes: > >> I come from a java background, where Exceptions are a big Avoid Me, but >> are the performance implications the same in Python? > > Well, you could measure it experimentally pretty easily, but anyway, > Python exception

Re: dictionary interface

2005-10-04 Thread Tom Anderson
On Tue, 4 Oct 2005, Robert Kern wrote: > Antoon Pardon wrote: > >> class Tree: >> >> def __lt__(self, term): >> return set(self.iteritems()) < set(term.iteritems()) >> >> def __eq__(self, term): >> return set(self.iteritems()) == set(term.iteritems()) >> >> Would this be a co

Re: dictionary interface

2005-10-05 Thread Tom Anderson
On Tue, 4 Oct 2005, Robert Kern wrote: > Tom Anderson wrote: >> On Tue, 4 Oct 2005, Robert Kern wrote: >> >>> Antoon Pardon wrote: >>> >>>> Anyone a reference? >>> >>> The function dict_compare in dictobject.c . >> >> Well

Idle bytecode query on apparently unreachable returns

2005-10-09 Thread Tom Anderson
Evening all, Here's a brief chat with the interpretator: Python 2.4.1 (#2, Mar 31 2005, 00:05:10) [GCC 3.3 20030304 (Apple Computer, Inc. build 1666)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> def fib(x): ... if (x == 1): ... return 1 ...

Python's garbage collection was Re: Python reliability

2005-10-10 Thread Tom Anderson
On Mon, 10 Oct 2005, it was written: > Ville Voipio <[EMAIL PROTECTED]> writes: > >> Just one thing: how reliable is the garbage collecting system? Should I >> try to either not produce any garbage or try to clean up manually? > > The GC is a simple, manually-updated reference counting system aug

Re: Function decorator that caches function results

2005-10-10 Thread Tom Anderson
On Mon, 10 Oct 2005, Steven D'Aprano wrote: > On Sun, 09 Oct 2005 17:39:23 +0200, Fredrik Lundh wrote: > >> only if you're obsessed with CPython implementation details. > > No. I'm obsessed with finding out what closures are, since nobody seems > to have a good definition of them! On the contrar

Re: Idle bytecode query on apparently unreachable returns

2005-10-12 Thread Tom Anderson
On Tue, 11 Oct 2005, Raymond Hettinger wrote: > [Tom Anderson]: > >> What puzzles me, though, are bytecodes 17, 39 and 42 - surely these >> aren't reachable? Does the compiler just throw in a default 'return >> None' epilogue, with routes there from

Re: Python's garbage collection was Re: Python reliability

2005-10-12 Thread Tom Anderson
On Wed, 12 Oct 2005, Jorgen Grahn wrote: > On Mon, 10 Oct 2005 20:37:03 +0100, Tom Anderson <[EMAIL PROTECTED]> wrote: >> On Mon, 10 Oct 2005, it was written: > ... >>> There is no way you can avoid making garbage. Python conses everything, >>> even inte

Re: Python's garbage collection was Re: Python reliability

2005-10-12 Thread Tom Anderson
On Mon, 10 Oct 2005, it was written: > Tom Anderson <[EMAIL PROTECTED]> writes: > >> Has anyone looked into using a real GC for python? I realise it would >> be a lot more complexity in the interpreter itself, but it would be >> faster, more reliable, and

Re: Python's garbage collection was Re: Python reliability

2005-10-12 Thread Tom Anderson
On Tue, 11 Oct 2005, Alex Martelli wrote: > Tom Anderson <[EMAIL PROTECTED]> wrote: > ... >> Has anyone looked into using a real GC for python? I realise it would be a > > If you mean mark-and-sweep, with generational twists, Yes, more or less. > that's what

Re: Function decorator that caches function results

2005-10-12 Thread Tom Anderson
On Tue, 10 Oct 2005, it was written: > Tom Anderson <[EMAIL PROTECTED]> writes: > >> Okay, a crack at a definition: a closure is a function in which some of >> the variable names refer to variables outside the function. > > That's misleading, You're

Re: sqlstring -- a library to build a SELECT statement

2005-10-20 Thread Tom Anderson
On Thu, 20 Oct 2005, [EMAIL PROTECTED] wrote: > On this line of thought, what about the += operator? That might be more > intuative than //. I could even use -= for not in. You're going to have to explain to me how using an assignment operator for something other than assignment is intuitive!

Re: sqlstring -- a library to build a SELECT statement

2005-10-20 Thread Tom Anderson
On Thu, 20 Oct 2005, Pierre Quentel wrote: [EMAIL PROTECTED] a écrit : My solution is sqlstring. A single-purpose library: to create SQL statement objects. With the same starting point - I don't like writing SQL strings inside Python code either - I have tested a different approach : use th

Re: A macro editor

2005-10-20 Thread Tom Anderson
On Thu, 20 Oct 2005, Diez B. Roggisch wrote: > So - _I_ think the better user-experience comes froma well-working easy > to use REPL to quickly give the scripts a try. I'd agree with that. Which is better, a difficult language with lots of fancy tools to help you write it, or an easy language?

Re: Python vs Ruby

2005-10-20 Thread Tom Anderson
On Thu, 20 Oct 2005, Amol Vaidya wrote: > "Casey Hawthorne" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > >> What languages do you know already? What computer science concepts do >> you know? What computer programming concepts do you know? Have you >> heard of Scheme? Good que

Re: Python vs Ruby

2005-10-21 Thread Tom Anderson
On Thu, 20 Oct 2005, Mike Meyer wrote: > "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> writes: > >> other than haskell and SQL, the others are more or less the same to me >> so getting familiar with them is not too difficult. > > There are actually lots of good "train your brain" type languages. > Mem

Re: Python vs Ruby

2005-10-21 Thread Tom Anderson
On Fri, 21 Oct 2005, vdrab wrote: > You can tell everything is well in the world of dynamic languages when > someone posts a question with nuclear flame war potential like "python > vs. ruby" and after a while people go off singing hymns about the beauty > of Scheme... +1 QOTW > I love this p

Re: Binding a variable?

2005-10-21 Thread Tom Anderson
On Fri, 21 Oct 2005, Paul Dale wrote: > Is it possible to bind a list member or variable to a variable such that > > temp = 5 > list = [ temp ] > temp == 6 > list > > would show > > list = [ 6 ] As you know by now, no. Like any problem in programming, this can be solved with a layer of abstracti

Re: Python variables are bound to types when used?

2005-10-23 Thread Tom Anderson
On Sat, 22 Oct 2005, Fredrik Lundh wrote: > [EMAIL PROTECTED] wrote: > >>> reset your brain: >>> >>> http://effbot.org/zone/python-objects.htm Is it really a good idea to say that objects have names? Isn't it cleaner to describe objects without any reference to names or variables or whatnot

Re: Syntax across languages

2005-10-23 Thread Tom Anderson
On Sun, 23 Oct 2005, Fredrik Lundh wrote: > [EMAIL PROTECTED] wrote: > >> - ~== for approximate FP equality > > str(a) == str(b) This is taken from the AI 754 standard, i take it? :) Seriously, that's horrible. Fredrik, you are a bad man, and run a bad railway. However, looking at the

Re: Oh what a twisted thread we weave....

2005-10-29 Thread Tom Anderson
On Sat, 28 Oct 2005, GregM wrote: > ST_zeroMatch = 'You found 0 products' > ST_zeroMatch2 = 'There are no products matching your selection' > > # why does this always drop through even though the If should be true. > if (ST_zeroMatch or ST_zeroMatch2) in self.webpg: This code - i do

Re: Most efficient way of storing 1024*1024 bits

2005-11-03 Thread Tom Anderson
On Wed, 2 Nov 2005, Dan Bishop wrote: Tor Erik Sønvisen wrote: I need a time and space efficient way of storing up to 6 million bits. The most space-efficient way of storing bits is to use the bitwise operators on an array of bytes: Actually, no, it's to xor all the bits together and store

Re: Running autogenerated code in another python instance

2005-11-03 Thread Tom Anderson
On Thu, 3 Nov 2005, Paul Cochrane wrote: > On Wed, 02 Nov 2005 06:33:28 +, Bengt Richter wrote: > >> On Wed, 2 Nov 2005 06:08:22 + (UTC), Paul Cochrane <[EMAIL PROTECTED]> >> wrote: >> >>> I've got an application that I'm writing that autogenerates python >>> code which I then execute wi

Re: PyFLTK - an underrated gem for GUI projects

2005-11-09 Thread Tom Anderson
On Mon, 6 Nov 2005, it was written: > aum <[EMAIL PROTECTED]> writes: > >> To me, wxPython is like a 12-cylinder Hummer, ... Whereas PyFLTK feels >> more like an average suburban 4-door sedan > > Interesting. What would Tkinter be at that car dealership? A '70s VW Beetle - it's been going for e

Re: need help extracting data from a text file

2005-11-09 Thread Tom Anderson
On Mon, 7 Nov 2005, Kent Johnson wrote: > [EMAIL PROTECTED] wrote: > >> i have a text file with a bunch of values scattered throughout it. i am >> needing to pull out a value that is in parenthesis right after a >> certain word, like the first time the word 'foo' is found, retrieve the >> value

Re: [OT] Map of email origins to Python list

2005-11-09 Thread Tom Anderson
On Mon, 7 Nov 2005, Claire McLister wrote: > We've been working with Google Maps, and have created a web service to map > origins of emails to a group. Top stuff! The misses are, if anything, more interesting than the hits! I, apparently, am in Norwich. I have been to Norwich a few times, and,

Re: How to use generators?

2005-11-09 Thread Tom Anderson
On Wed, 9 Nov 2005, Sybren Stuvel wrote: > Ian Vincent enlightened us with: > >> I have never used generators before but I might have now found a use >> for them. I have written a recursive function to solve a 640x640 maze >> but it crashes, due to exceeding the stack. The only way around this

Re: web interface

2005-11-09 Thread Tom Anderson
On Mon, 7 Nov 2005, Ajar wrote: > I have a stand alone application which does some scientific > computations. I want to provide a web interface for this app. The app is > computationally intensive and may take long time for running. Can > someone suggest me a starting point for me? (like pointe

Re: Iterator addition

2005-11-12 Thread Tom Anderson
On Thu, 9 Nov 2005, it was written: > [EMAIL PROTECTED] (Alex Martelli) writes: > >>> Is there a good reason to not define iter1+iter2 to be the same as >> >> If you mean for *ALL* built-in types, such as generators, lists, files, >> dicts, etc, etc -- I'm not so sure. > > Hmm, there might also be

Re: Hash map with multiple keys per value ?

2005-11-12 Thread Tom Anderson
On Fri, 11 Nov 2005, Chris Stiles wrote: > Is there an easier and cleaner way of doing this ? Is there example > code floating around that I might have a look at ? I'm not aware of a way which can honestly be called better. However, i do feel your pain about representing the alias relationship

Re: Iterator addition

2005-11-13 Thread Tom Anderson
On Sun, 13 Nov 2005, Reinhold Birkenfeld wrote: > [EMAIL PROTECTED] wrote: > >> Tom Anderson: > >>> And we're halfway to looking like perl already! Perhaps a more >>> pythonic thing would be to define a "then" operator: >>> >>&

Re: running functions

2005-11-17 Thread Tom Anderson
On Wed, 16 Nov 2005, [EMAIL PROTECTED] wrote: > Gorlon the Impossible wrote: > >> Is it possible to run this function and still be able to do other >> things with Python while it is running? Is that what threading is >> about? > > Threading's a good answer if you really need to share all your me

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

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: 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 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: 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-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: 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: 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: 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: 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, 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-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-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: > 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: 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: 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

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

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

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

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: 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: 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: 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: 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: 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-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: 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: 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: 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

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: 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

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: 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: 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: 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: Favorite non-python language trick?

2005-06-24 Thread Tom Anderson
On Fri, 24 Jun 2005, Joseph Garvin wrote: > Claudio Grondi wrote: > > So far we've got lisp macros and a thousand response's to the lua trick. > Anyone else have any actual non-python language tricks they like? Higher-order functions like map, filter and reduce. As of Python 3000, they're non-p

Re: Favorite non-python language trick?

2005-06-25 Thread Tom Anderson
On Fri, 24 Jun 2005, Roy Smith wrote: > Tom Anderson <[EMAIL PROTECTED]> wrote: > >> The one thing i really do miss is method overloading by parameter type. >> I used this all the time in java > > You do things like that in type-bondage languages I love that expr

Re: Favorite non-python language trick?

2005-06-25 Thread Tom Anderson
On Sat, 25 Jun 2005, Konstantin Veretennicov wrote: > On 6/25/05, Mandus <[EMAIL PROTECTED]> wrote: > >> It is really a consensus on this; that removing map, filter, reduce is >> a good thing? It will render a whole lot of my software unusable :( > > I think you'll be able to use "from __past__ i

Re: Better console for Windows?

2005-06-28 Thread Tom Anderson
On Tue, 27 Jun 2005, Brett Hoerner wrote: > Rune Strand wrote: > > Christ, thanks. When you install Windows it should pop up first thing > and ask if you want to be annoyed, Y/N. What, and not install if you say no? Perhaps your best way to get a proper shell on windows is just to install a p

Re: Modules for inclusion in standard library?

2005-06-30 Thread Tom Anderson
On Wed, 29 Jun 2005, it was written: > Rocco Moretti <[EMAIL PROTECTED]> writes: > >> Except that (please correct me if I'm wrong) there is somewhat of a >> policy for not including interface code for third party programs which >> are not part of the operating system. > > I've never heard of Pyt

Re: Boss wants me to program

2005-06-30 Thread Tom Anderson
On Wed, 29 Jun 2005, phil wrote: >> Wow! How about a sextant? Simple device really. And a great practical >> demonstration of trigonometry. > > Excellent idea, even found a few how to sites. We'll do it. > Any others? A ballista? For many years when i was a kid, my dad wanted to build a ballist

Re: map vs. list-comprehension

2005-06-30 Thread Tom Anderson
On Fri, 1 Jul 2005, Mike P. wrote: "Björn Lindström" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] "F. Petitjean" <[EMAIL PROTECTED]> writes: res = [ bb+ii*dd for bb,ii,dd in zip(b,i,d) ] Hoping that zip will not be deprecated. Nobody has suggested that. The ones that are pla

Re: When someone from Britain speaks, Americans hear a "British accent"...

2005-06-30 Thread Tom Anderson
On Thu, 30 Jun 2005, Benji York wrote: > python-needs-more-duct-tape'ly yours, You're in luck: Python 3000 will replace duck typing with duct taping. tom -- I know you wanna try and get away, but it's the hardest thing you'll ever know -- http://mail.python.org/mailman/listinfo/python-list

Re: When someone from Britain speaks, Americans hear a "British accent"...

2005-06-30 Thread Tom Anderson
On Thu, 30 Jun 2005, Simon Brunning wrote: > On 29 Jun 2005 15:34:11 -0700, Luis M. Gonzalez <[EMAIL PROTECTED]> wrote: > >> What's exactly the "cockney" accent? Is it related to some place or >> it's just a kind of slang? > > The cockney accent used to be pretty distinct, but these days it's >

Re: When someone from Britain speaks, Americans hear a "British accent"...

2005-06-30 Thread Tom Anderson
On Wed, 29 Jun 2005, Michael Hoffman wrote: > Steven D'Aprano wrote: > >> Herb starts with H, not E. It isn't "ouse" or "ospital" or "istory". It >> isn't "erb" either. You just sound like tossers when you try to >> pronounce herb in the original French. Yes, i find this insanely irritating. >

Re: Python for everything?

2005-07-01 Thread Tom Anderson
On Thu, 30 Jun 2005 [EMAIL PROTECTED] wrote: > can Python "do it all"? More or less. There are two places where python falls down, IMHO. One is performance: python isn't generally as fast as C or Java, even with Psyco. However, the number of cases where performance - and absolute straight-line

Re: map vs. list-comprehension

2005-07-01 Thread Tom Anderson
On Thu, 30 Jun 2005, Roy Smith wrote: > Terry Hancock <[EMAIL PROTECTED]> wrote: > >> One of the strengths of Python has been that the language itself is >> small (which it shares with C and (if I understand correctly, not being >> a lisp programmer?) Lisp), but with all the syntax enhancements

Re: map vs. list-comprehension

2005-07-01 Thread Tom Anderson
On Fri, 1 Jul 2005, George Sakkis wrote: > "Terry Hancock" wrote: > > Keeping the language small is a worthwhile goal, but it should be traded > off with conciseness and readability; otherwise we could well be content > with s-expressions. There's quite a number of satisfied LISP programmers ou

Re:

2005-07-01 Thread Tom Anderson
On Fri, 1 Jul 2005, Adriaan Renting wrote: > I'm not a very experienced Python programmer yet, so I might be > mistaken, but there are a few things that would make me prefer C++ over > Python for large (over 500.000 LOC) projects. Hmm. I don't know C++, but here goes ... > - namespaces Aren't

map/filter/reduce/lambda opinions and background unscientific mini-survey

2005-07-01 Thread Tom Anderson
Comrades, During our current discussion of the fate of functional constructs in python, someone brought up Guido's bull on the matter: http://www.artima.com/weblogs/viewpost.jsp?thread=98196 He says he's going to dispose of map, filter, reduce and lambda. He's going to give us product, any and

Re: Re:

2005-07-02 Thread Tom Anderson
On Fri, 1 Jul 2005, Andreas Kostyrka wrote: > Am Freitag, den 01.07.2005, 08:25 -0700 schrieb George Sakkis: > >>> Again, how? Is there a way to force that an external user of my lib can >>> not use my internal data/methods/classes, unless he uses odd compiler >>> hacks? >> >> I never understood h

Re: map/filter/reduce/lambda opinions and background unscientificmini-survey

2005-07-02 Thread Tom Anderson
On Fri, 1 Jul 2005, Ivan Van Laningham wrote: > Personally, I find that Lisp & its derivatives put your head in a very > weird place. Even weirder than PostScript/Forth/RPN, when you come > right down to it. +1 QOTW! tom -- REMOVE AND DESTROY -- http://mail.python.org/mailman/listinfo/pyth

Re: map vs. list-comprehension

2005-07-02 Thread Tom Anderson
On Fri, 1 Jul 2005, Sion Arrowsmith wrote: > Tom Anderson <[EMAIL PROTECTED]> wrote: >> On Thu, 30 Jun 2005, Roy Smith wrote: >> >>> Even some of the relatively recent library enhancements have been kind >>> of complicated. The logging module, f

Re: Modules for inclusion in standard library?

2005-07-02 Thread Tom Anderson
On Fri, 1 Jul 2005, Scott David Daniels wrote: > Daniel Dittmar wrote: >> Rocco Moretti wrote: >> > Except that (please correct me if I'm wrong) there is somewhat of a > policy for not including interface code for third party programs > which are not part of the operating system. (I.

Re: A brief question.

2005-07-02 Thread Tom Anderson
On Sat, 2 Jul 2005, Tom Brown wrote: > On Saturday 02 July 2005 10:55, Nathan Pinno wrote: > >> Brief question for anyone who knows the answer, because I don't. Is >> there anyway to make Python calculate square roots? > > from math import sqrt That's one way. I'd do: root = value ** 0.5 Does

Re: math.nroot [was Re: A brief question.]

2005-07-03 Thread Tom Anderson
On Sun, 3 Jul 2005, Steven D'Aprano wrote: > On Sun, 03 Jul 2005 02:22:23 +0200, Fredrik Johansson wrote: > >> On 7/3/05, Tom Anderson <[EMAIL PROTECTED]> wrote: >>> That's one way. I'd do: >>> >>> root = value ** 0.5 >>

  1   2   3   >