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

2005-07-06 Thread Terry Hancock
On Tuesday 05 July 2005 03:43 pm, Tom Anderson wrote: > I understand that the backslash is popular in some ivory-tower functional > languages. Currently, a backslash can be used for explicit line joining, > and is illegal elsewhere on a line outside a string literal, so i think > it's available

Re: Lisp development with macros faster than Python development?..

2005-07-06 Thread Raymond Hettinger
[EMAIL PROTECTED] wrote: > I've been reading the beloved Paul Graham's "Hackers and Painters". > He claims he developed a web app at light speed using Lisp and lots > of macros. > > It got me curious if Lisp > is inherently faster to develop complex apps in. With Lisp or Forth, a master programme

Re: Lisp development with macros faster than Python development?..

2005-07-06 Thread Raymond Hettinger
[EMAIL PROTECTED] wrote: > The problem is that questions like 'What lang is fastest to develop > in?' > are hard to answer definitively. FWIW, Google's answer to that question is C++, Java, and Python. For any given problem, any of the three are acceptable. Each programmer or engineering team ge

Re: Lisp development with macros faster than Python development?..

2005-07-06 Thread Fuzzyman
So Lisp is for really good programmers, and Python is for mediocre programmers ? Best Regards, Fuzzy http://www.voidspace.org.uk/python -- http://mail.python.org/mailman/listinfo/python-list

Re: f*cking re module

2005-07-06 Thread Raymond Hettinger
> There's really not a single good re tutorial or documentation >I could found! With * being a greedy operator, your post's subject line matches, "firetrucking" which, of course, has nothing to do with regular expressions, or python.org's re how-to guide, or Amazon's 18 books on the subject, or th

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

2005-07-06 Thread Steven D'Aprano
I said I'd drop the discussion about lambda, but this isn't really the same discussion even if it is part of the same thread. That's my excuse, and I'm sticking to it. Terry Hancock wrote: > On Tuesday 05 July 2005 03:43 pm, Tom Anderson wrote: > >>I understand that the backslash is popular in

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

2005-07-06 Thread Antoon Pardon
Op 2005-07-01, Mike Meyer schreef <[EMAIL PROTECTED]>: > "iK" <[EMAIL PROTECTED]> writes: > >> Seems like he wants python programmers to solve their problems all in the >> same way. While that is great for corporate slaves it is terrible for the >> creative programmer. > > No, he wants Python to

Create datetime instance using a tuple.

2005-07-06 Thread Negroup
Hi, all. I would like to know if it is possible to create a datetime instance using a tuple instead of single values. I mean: >>> from datetime import datetime >>> t = (1, 2, 3) >>> dt = datetime(t) Traceback (most recent call last): File "", line 1, in ? TypeError: function takes at least 3 arg

Re: TEST

2005-07-06 Thread listmaster
Dear ITtoolbox Groups Subscriber, Your message has NOT been distributed to the ITtoolbox BusinessObjects-L discussion group. Please continue reading for further details and instructions. On Wednesday, May 26, 2004, ITtoolbox launched nine new discussion topics, each focusing on specific Busines

RE: threads and sleep?

2005-07-06 Thread Alex Stapleton
Is SYS V shared memory a totalyl stupid way of doing distributed locks between processes then? -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of Jonathan Ellis Sent: 06 July 2005 05:45 To: python-list@python.org Subject: Re: threads and sleep? Peter Hansen wr

Re: f*cking re module

2005-07-06 Thread Simon Brunning
On 6 Jul 2005 01:01:34 -0700, Raymond Hettinger <[EMAIL PROTECTED]> wrote: > With * being a greedy operator, your post's subject line matches, > "firetrucking" Nope: >>> print re.match('f*cking', 'firetrucking') None The OP was clearly showing his lack of regex nouce here. Clearly he wanted 'f.*

How to disable rangeselect in wxGrid

2005-07-06 Thread [EMAIL PROTECTED]
Hi ! I have a little problem with wxGrid. In Delphi I can set in grids how I want to select cells. I can select only individual cells, or ranges. In my program I don't wanna use ranges. But I don't find any methods or properties what can set this option. The range selection mode is disturb the u

Re: Python exception hook simple example needed

2005-07-06 Thread [EMAIL PROTECTED]
Hi ! I think I found an example: import sys def info(type, value, tb): if hasattr(sys, 'ps1') or not sys.stderr.isatty(): # we are in interactive mode or we don't have a tty-like # device, so we call the default hook print "yyy" sys.__excepthook__(type, value, tb) e

Re: Lisp development with macros faster than Python development?..

2005-07-06 Thread Michele Simionato
Fuzzyman: > So Lisp is for really good programmers, and Python is for > mediocre programmers ? Python is *also* for mediocre programmers. I see this as a strength, not as a weakness. Michele Simionato -- http://mail.python.org/mailman/listinfo/python-list

Re: Create datetime instance using a tuple.

2005-07-06 Thread Qiangning Hong
On 6 Jul 2005 02:01:55 -0700, Negroup <[EMAIL PROTECTED]> wrote: > Hi, all. > I would like to know if it is possible to create a datetime instance > using a tuple instead of single values. > > I mean: > >>> from datetime import datetime > >>> t = (1, 2, 3) > >>> dt = datetime(t) > Traceback (most

Re: precision problems in base conversion of rational numbers

2005-07-06 Thread Raymond Hettinger
[Terry Hancock] > > Needless to say, the conventional floating point numbers in Python > > are actually stored as *binary*, which is why there is a "decimal" > > module (which is new). > > > > If you're going to be converting between bases anyway, it probably > > makes little difference whether you

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

2005-07-06 Thread Antoon Pardon
Op 2005-07-02, Mike Meyer schreef <[EMAIL PROTECTED]>: > "Sean McIlroy" <[EMAIL PROTECTED]> writes: > >> Peter Hansen wrote: >> >>> Sean, what gave you the impression this would change? >> if that's the case then list comprehensions and/or "first class >> functions" are likely to be the next targe

Using Ghostscript DLL via ctypes in Py2.3/Win

2005-07-06 Thread Adam Twardoch
I've written a simple commanline wrapper for calling GhostScript from Python. It uses os.system under Windows and os.popen under unixes. The call looks basically like this: gs -q -dNODISPLAY -dNOPAUSE -dSAFER ps2ai.ps infile.eps >outfile.ai I'd prefer to use the GhostScript DLL API* and call it

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

2005-07-06 Thread Fuzzyman
Simon Brunning wrote: [snip..] > > The online Python Journal is posted at pythonjournal.cognizor.com. > [EMAIL PROTECTED] and [EMAIL PROTECTED] > welcome submission of material that helps people's understanding > of Python use, and offer Web presentation of your work. > Does the 'p

Re: Lisp development with macros faster than Python development?..

2005-07-06 Thread Andrew Durdin
On 6 Jul 2005 00:30:34 -0700, Raymond Hettinger <[EMAIL PROTECTED]> wrote: > > With Lisp or Forth, a master programmer has unlimited power and > expressiveness. With Python, even a regular guy can reach for the > stars. +1 QOTW -- http://mail.python.org/mailman/listinfo/python-list

frozenset question

2005-07-06 Thread Will McGugan
Hi, Are there any benefits in using a frozenset over a set, other than it being immutable? Will McGugan -- http://www.willmcgugan.com "".join({'*':'@','^':'.'}.get(c,0) or chr(97+(ord(c)-84)%26) for c in "jvyy*jvyyzpthtna^pbz") -- http://mail.python.org/mailman/listinfo/python-list

Re: frozenset question

2005-07-06 Thread Qiangning Hong
On 7/6/05, Will McGugan <[EMAIL PROTECTED]> wrote: > Hi, > > Are there any benefits in using a frozenset over a set, other than it > being immutable? A frozenset can be used as a key of a dict: .>> s1 = set([1]) .>> s2 = frozenset([2]) .>> {s1: 1} Traceback (most recent call last): File "", li

Re: f*cking re module

2005-07-06 Thread Jorgen Grahn
On 5 Jul 2005 08:04:21 -0700, jwaixs <[EMAIL PROTECTED]> wrote: ... > The python re module is, in my opinion, a non beginner user friendly > module. And it's not meant for beginning python programmers. I don't > have any experience with perl or related script/programming languages > like python. (I

Re: frozenset question

2005-07-06 Thread Will McGugan
Qiangning Hong wrote: > On 7/6/05, Will McGugan <[EMAIL PROTECTED]> wrote: > >>Hi, >> >>Are there any benefits in using a frozenset over a set, other than it >>being immutable? > > > A frozenset can be used as a key of a dict: Thanks, but I meant to imply that. I was wondering if frozenset was

Help with wx.PaintDC

2005-07-06 Thread flamesrock
wxGlade has made this tooo easy for me so far. But right now I'm very confused about something: self.bmp = wx.Bitmap('sample.bmp') dc = wx.PaintDC(self.notebook_region_overview) dc.DrawBitmap(self.bmp,0,0,False) self.notebook_region_overview is basically a wx.Panel, loc

Re: How do you program in Python?

2005-07-06 Thread Jorgen Grahn
On Sun, 03 Jul 2005 17:35:16 +0100, anthonyberet <[EMAIL PROTECTED]> wrote: ... > What I would really like is something like an old-style BASIC > interpreter, in which I could list, modify and test-run sections of I use no IDE, just emacs for editing my sources, and a terminal window or two. And

Tkinter grid layout

2005-07-06 Thread Richard Lewis
Hi there, I've got a tree control in Tkinter (using the ESRF Tree module) but I can't get it to layout how I want it. I'd like to have it so that it streches north/south (anchored to the top and bottom), is of a fixed width and is anchored to the left hand side. Here's my code (its derived from o

Re: Outlook COM: how to create a MailItem from a .msg file

2005-07-06 Thread Guy Lateur
Ok, we didn't have the IMAP service running; we do now (no SSL). Connecting to the server is not a problem anymore, but logging in is. It works with the administrator account, but not with my personal account. We have restricted access to all machines in 10.0.0.0/255.255.255.0, which includes m

Re: System Independent Wallpaper Changer

2005-07-06 Thread Toby Dickenson
On Wednesday 06 July 2005 01:12, Terrance N. Phillip wrote: > I've done some searching, and can't seem to find a programatic way of > getting *** that to happen. http://www.google.com/search?q=setwallpaper+dcop I hope this helps -- Toby Dickenson -- http://mail.python.org/mailman/listinfo/py

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

2005-07-06 Thread Daniel Schüle
Full Acknowledge -- http://mail.python.org/mailman/listinfo/python-list

Re: frozenset question

2005-07-06 Thread Steven D'Aprano
On Wed, 06 Jul 2005 11:30:14 +0100, Will McGugan wrote: > I was wondering if frozenset was faster or more efficient in some way. > > Thinking back to the dark ages of C++, you could optimize things that > you knew to be constant. Why would you want to? py> import sets py> import time py> bigs

Re: threads and sleep?

2005-07-06 Thread Peter Hansen
Jonathan Ellis wrote: > Peter Hansen wrote: >>Or investigate the use of Irmen's Pyro package and how it could let you >>almost transparently move your code to a *multi-process* architecture > > Unless you're doing anything that would require distributed locking. > Many if not most such projects do

Re: adding a character to the last string element of a list

2005-07-06 Thread Peter Hansen
Philippe C. Martin wrote: > I guess my slicing was wrong, l[-1] worked Note that that's _not_ a slice, however, but a reference to the last element in the list. You'd have to subclass list to be able to do something with "reference-slices". Probably returning a special object from __getslice_

Re: Using Ghostscript DLL via ctypes in Py2.3/Win

2005-07-06 Thread Peter Hansen
Adam Twardoch wrote: > I'd prefer to use the GhostScript DLL API* and call it using ctypes under > Windows. > Has anyone perhaps written something like that already and cares to share a > code snippet? There is a ctypes mailing list where you might have more success getting a reply (though I s

Re: VBR mp3 length

2005-07-06 Thread Lucas Raab
No One wrote: > Hello all, > If this isn't the correct newsgroup, please redirect me. > > I'm trying to extract the song length from variable bit rate mp3's. > Does anyone know of a library or bit of code that will do this? I've > tried pymad, but it seems to grab the bitrate of the first frame a

Re: threads and sleep?

2005-07-06 Thread Peter Hansen
Grant Edwards wrote: > On 2005-07-05, Grant Edwards <[EMAIL PROTECTED]> wrote: >>Or is the Python interpreter actually doing the context >>switches itself? > > Upon further thought, that just can't be the case. There has > to be multiple instances of the intepreter because the > interpreter can m

Re: Python exception hook simple example needed

2005-07-06 Thread Fuzzyman
Wax has a brilliant prebuilt dialog/handler. It's a wrapper over wxPython - so you still use wxPython objects, it's jsut all a lot easier. http://zephyrfalcon.org/labs Best Regards, Fuzzy http://www.voidspace.org.uk/python -- http://mail.python.org/mailman/listinfo/python-list

Re: Good starterbook for learning Python?

2005-07-06 Thread Fuzzyman
A book that will stay useful as a referene *after* you've used it to learn is 'Programming Python'. Best Regards, Fuzzy http://www.voidspace.org.uk/python -- http://mail.python.org/mailman/listinfo/python-list

Re: How do you program in Python?

2005-07-06 Thread Sybren Stuvel
Jorgen Grahn enlightened us with: > I use no IDE, just emacs for editing my sources, and a terminal > window or two. And CVS for version control. Almost the same here, except that I use VIM and Subversion instead of Emacs and CVS. > If I get stuck or if the problem is non-trivial, or if I'm writi

Re: Lisp development with macros faster than Python development?..

2005-07-06 Thread Fuzzyman
Fair enough ;-) I'd like to discover the power of Lisp, but I have a limited amount of time to sink into programming... so maybe I'm better off putting my energies and imagination into Python. *A language is a medium of expression.* - Paul Graham All the best. Fuzzy http://www.voidspace.org.uk/

Dr. Dobb's Python-URL! - weekly Python news and links (Jul 5)

2005-07-06 Thread Simon Brunning
QOTW: "That's what I love in that news group. Someone comes with a stupid and arrogant question, and someone else answers in a calm and reasonable way." - Gustavo Niemeyer "After 25 years doing this, I've become something of a Luddite as far as fancy IDEs and non-standard features go... and a huge

Re: Proposal: reducing self.x=x; self.y=y; self.z=z boilerplate code

2005-07-06 Thread NickC
Ralf, I'd be very interested to hear your opinion on the 'namespace' module, which looks at addressing some of these issues (the Record object, in particular). The URL is http://namespace.python-hosting.com, and any comments should be directed to the [EMAIL PROTECTED] discussion list. Regards, N

Re: Lisp development with macros faster than Python development?..

2005-07-06 Thread Antoon Pardon
Op 2005-07-06, Michele Simionato schreef <[EMAIL PROTECTED]>: > Fuzzyman: >> So Lisp is for really good programmers, and Python is for >> mediocre programmers ? > > > Python is *also* for mediocre programmers. I see this as a > strength, not as a weakness. But sometimes I get the impression people

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

2005-07-06 Thread George Sakkis
"Terry Reedy" <[EMAIL PROTECTED]> wrote: > "George Sakkis" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > > Still it's hard to explain why four specific python keywords - def, > > del, exec and elif - were chosen to be abbreviated, > > Precedence in other languages and CS usage?

Re: frozenset question

2005-07-06 Thread Will McGugan
Steven D'Aprano wrote: > There is no significant speed difference between immutable and mutable > sets, at least for queries. Regardless of whether it is successful or > unsuccessful, mutable or immutable, it takes about 0.025 second to do > each test of item in set. Why would you need to opti

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

2005-07-06 Thread steve . morin
map, filter, reduce and lambda Lisp constructs, bring flexibility to the language and is why I started programming in python to begin with. Removing these constructs will be a shame and one step closer to the death of some of the basic features that make python great. -- http://mail.python.org/ma

Re: Lisp development with macros faster than Python development?..

2005-07-06 Thread Larry Bates
You don't say how long it took to develop the "macros" but you should see what kind of website an experienced Zope/Plone programmer can whip up in a few minutes. Acceleration in programming has always been about the "Standard Library" (not only Python's standard library but also your standard libr

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

2005-07-06 Thread Tom Anderson
On Wed, 5 Jul 2005, George Sakkis wrote: > "Steven D'Aprano" <[EMAIL PROTECTED]> wrote: > >> On Tue, 05 Jul 2005 09:46:41 -0500, Terry Hancock wrote: > [snip] > >> Def would be short for ... defend? defile? defer? defame? default? deflect? >> >> There's always *something* to learn. Why def instead

Re: frozenset question

2005-07-06 Thread Michael Hudson
Will McGugan <[EMAIL PROTECTED]> writes: > Qiangning Hong wrote: > > On 7/6/05, Will McGugan <[EMAIL PROTECTED]> wrote: > > > >>Hi, > >> > >>Are there any benefits in using a frozenset over a set, other than it > >>being immutable? > > A frozenset can be used as a key of a dict: > > Thanks, but

Re: Lisp development with macros faster than Python development?..

2005-07-06 Thread Zachery Bir
Larry Bates <[EMAIL PROTECTED]> writes: > You don't say how long it took to develop the "macros" but > you should see what kind of website an experienced Zope/Plone > programmer can whip up in a few minutes. Zope/Plone (as frameworks) represent exactly the kinds of DSLs people have been building

Re: System Independent Wallpaper Changer

2005-07-06 Thread Terrance N. Phillip
Toby Dickenson wrote: > On Wednesday 06 July 2005 01:12, Terrance N. Phillip wrote: > > >>I've done some searching, and can't seem to find a programatic way of >>getting *** that to happen. > > > http://www.google.com/search?q=setwallpaper+dcop > > I hope this helps > That helps very much,

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

2005-07-06 Thread Tom Anderson
On Wed, 6 Jul 2005, Terry Hancock wrote: > On Tuesday 05 July 2005 03:43 pm, Tom Anderson wrote: > >> I understand that the backslash is popular in some ivory-tower >> functional languages. Currently, a backslash can be used for explicit >> line joining, and is illegal elsewhere on a line outsid

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

2005-07-06 Thread Jeff Epler
On Tue, Jul 05, 2005 at 09:49:33PM +0100, Tom Anderson wrote: > Are there any uses for NaN that aren't met by exceptions? Sure. If you can naturally calculate two things at once, but one might turn out to be a NaN under current rules. x, y = calculate_two_things() if isnan(x): pe

Re: Lisp development with macros faster than Python development?..

2005-07-06 Thread Tom Anderson
On Tue, 5 Jul 2005, Mike Meyer wrote: > "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> writes: > >>> Well, his Viaweb company was founded in about '95, right? So he >>> probably just used Lisp because Python wasn't as well known yet. ;-) >> >> That is what I thought too. It makes sense but I wasn't sur

Use cases for del

2005-07-06 Thread Peter Hansen
Tom Anderson wrote: > How about just getting rid of del? Removal from collections could be > done with a method call, and i'm not convinced that deleting variables > is something we really need to be able to do (most other languages > manage without it). Arguing the case for del: how would I, i

Re: Lisp development with macros faster than Python development?..

2005-07-06 Thread Peter Hansen
Tom Anderson wrote: > Perhaps the real question, then, is which language allows you to delete > lines of code most quickly. No, then the question becomes "which language allows you to quickly write very many lines of code which then have to be deleted". Of course, writing those lines manually w

Re: Good starterbook for learning Python?

2005-07-06 Thread Lennart
Op 6 Jul 2005 06:02:15 -0700 schreef Fuzzyman: > A book that will stay useful as a referene *after* you've used it to > learn is 'Programming Python'. > > Best Regards, > > Fuzzy > http://www.voidspace.org.uk/python A thanks! I've downloaded the book "dive into python". It costs me near 23 eu

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

2005-07-06 Thread François Pinard
[Tom Anderson] > > del -> delete > How about just getting rid of del? [...] i'm not convinced that > deleting variables is something we really need to be able to do While surely not in every program, I still use `del' often. Compare: x = None del x when the goal is to cut the referenc

Re: best options for oracle/python?

2005-07-06 Thread Paul Boddie
Mark Harrison <[EMAIL PROTECTED]> wrote in message news:<[EMAIL PROTECTED]>... > Any recommendations for Oracle bindings for the > DB-API 2.0 specification? This is for Oracle 10g > if that makes any difference. > > Also, any other Oracle related goodies that might > be useful? You might want to

Re: best options for oracle/python?

2005-07-06 Thread Grig Gheorghiu
Use cx_Oracle: Grig -- http://mail.python.org/mailman/listinfo/python-list

Re: Use cases for del

2005-07-06 Thread Jp Calderone
On Wed, 06 Jul 2005 09:45:56 -0400, Peter Hansen <[EMAIL PROTECTED]> wrote: >Tom Anderson wrote: >> How about just getting rid of del? Removal from collections could be >> done with a method call, and i'm not convinced that deleting variables >> is something we really need to be able to do (most ot

Re: Tkinter grid layout

2005-07-06 Thread Richard Lewis
On Wed, 06 Jul 2005 11:44:55 +0100, "Richard Lewis" <[EMAIL PROTECTED]> said: > Hi there, > > I've got a tree control in Tkinter (using the ESRF Tree module) but I > can't get it to layout how I want it. > > I'd like to have it so that it streches north/south (anchored to the top > and bottom),

Re: Use cases for del

2005-07-06 Thread Daniel Dittmar
Peter Hansen wrote: > Arguing the case for del: how would I, in doing automated testing, > ensure that I've returned everything to a "clean" starting point in all > cases if I can't delete variables? Sometimes a global is the simplest > way to do something... how do I delete a global if not wit

Re: frozenset question

2005-07-06 Thread Raymond Hettinger
Will McGugan wrote: > Are there any benefits in using a frozenset over a set, other than it > being immutable? No. The underlying implementation is identical with set. The only difference is the addition of a hash method and absence of mutating methods. Everything else is the same. Raymond -

Re: Lisp development with macros faster than Python development?..

2005-07-06 Thread François Pinard
[Raymond Hettinger] > [EMAIL PROTECTED] wrote: > > > It got me curious if Lisp is inherently faster to develop complex > > apps in. > With Lisp or Forth, a master programmer has unlimited power and > expressiveness. With Python, even a regular guy can reach for the > stars. A few years ago, I m

Re: More On - deepcopy, Tkinter

2005-07-06 Thread phil
Thanks, I used some of your methods and believe it is now working. I also did a lot of experiments, which I've needed to do, investigating when references vs values are passed and returned. Not as obvious as I thought. Duncan Booth wrote: > phil wrote: > > >> >> >>>The deepcopy protocol does

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

2005-07-06 Thread Ron Adam
Tom Anderson wrote: >> del -> delete > > > How about just getting rid of del? Removal from collections could be > done with a method call, and i'm not convinced that deleting variables > is something we really need to be able to do (most other languages > manage without it). Since this is a

Re: threads and sleep?

2005-07-06 Thread Grant Edwards
On 2005-07-06, Dennis Lee Bieber <[EMAIL PROTECTED]> wrote: > On Tue, 05 Jul 2005 16:01:23 -, Grant Edwards <[EMAIL PROTECTED]> > declaimed the following in comp.lang.python: > >> Or is the Python interpreter actually doing the context >> switches itself? > > It would seem to be close to doing

Re: threads and sleep?

2005-07-06 Thread Grant Edwards
On 2005-07-06, Alex Stapleton <[EMAIL PROTECTED]> wrote: > Is SYS V shared memory a totalyl stupid way of doing distributed locks > between processes then? Sys V semaphores would seem to be a more logical choice. -- Grant Edwards grante Yow! I'm pretending I'm

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

2005-07-06 Thread Dan Sommers
On Wed, 06 Jul 2005 14:33:47 GMT, Ron Adam <[EMAIL PROTECTED]> wrote: > Since this is a Python 3k item... What would be the consequence of > making None the default value of an undefined name? And then assigning > a name to None as a way to delete it? [ ... ] > Any drawbacks? Lots more hard-t

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

2005-07-06 Thread Steven Bethard
Terry Hancock wrote: > And a syntax just occured to me -- what about this: > > [y*x for x,y] > > ? > > (that is: > > [ for ] If you haven't already, see: http://wiki.python.org/moin/AlternateLambdaSyntax for other similar proposals. STeVe -- http://mail.python.org/mailman/listinfo/python-l

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

2005-07-06 Thread Steven Bethard
Ron Adam wrote: > Yes, I think a different key word would help. My current favorite > alternative is to put it in parentheses similar to list comprehensions > and use "let". > > (let x,y return x+y) If you haven't already, see: http://wiki.python.org/moin/AlternateLambdaSyntax for other simi

Re: Lisp development with macros faster than Python development?..

2005-07-06 Thread Rocco Moretti
Raymond Hettinger wrote: > [EMAIL PROTECTED] wrote: > >>The problem is that questions like 'What lang is fastest to develop >>in?' >>are hard to answer definitively. > > > FWIW, Google's answer to that question is C++, Java, and Python. For > any given problem, any of the three are acceptable.

Re: threads and sleep?

2005-07-06 Thread Grant Edwards
On 2005-07-06, Peter Hansen <[EMAIL PROTECTED]> wrote: >>>Or is the Python interpreter actually doing the context >>>switches itself? >> >> Upon further thought, that just can't be the case. There has >> to be multiple instances of the intepreter because the >> interpreter can make C system call

Re: Use cases for del

2005-07-06 Thread Duncan Booth
Peter Hansen wrote: > Tom Anderson wrote: >> How about just getting rid of del? Removal from collections could be >> done with a method call, and i'm not convinced that deleting variables >> is something we really need to be able to do (most other languages >> manage without it). > > Arguing t

Deleting variables [was Re: map/filter/reduce/lambda opinions and background unscientific mini-survey]

2005-07-06 Thread Steven D'Aprano
On Wed, 06 Jul 2005 14:28:55 +0100, Tom Anderson wrote: >> del -> delete > > How about just getting rid of del? Removal from collections could be done > with a method call, Which would be called object.del() I presume. And that opens a big can of worms. Suppose we have a list L = [4, 3, 2, 1,

Re: Lisp development with macros faster than Python development?..

2005-07-06 Thread Dan Sommers
On Wed, 06 Jul 2005 08:27:55 -0500, Larry Bates <[EMAIL PROTECTED]> wrote: [ reusable, stable, debugged, and documented libraries are a Good Thing ] Absolutely. Two related stories from my days working as a software engineer for a large telecomm company. Both stories begin with the annual r

Re: threads and sleep?

2005-07-06 Thread Jeffrey Maitland
Thanks for the info. I was doing some more diggging and I came across a module/class called POSH which should allow me to do what I want. My question now is, has anyone here used this and if so what it as easy to implement as what I am reading it is? (I have to wait for the sys admin to install

Re: Favorite non-python language trick?

2005-07-06 Thread Edvard Majakari
(sorry, my NUA had lost the original article) > >> I'm curious -- what is everyone's favorite trick from a non-python >> language? And -- why isn't it in Python? Ability to tag some methods 'deprecated' as in Java (from 1.5 onwards?). However, Python interpreter doesn't have to do it: pydoc and s

Re: Use cases for del

2005-07-06 Thread Steven D'Aprano
On Wed, 06 Jul 2005 10:00:02 -0400, Jp Calderone wrote: > On Wed, 06 Jul 2005 09:45:56 -0400, Peter Hansen <[EMAIL PROTECTED]> wrote: >>Tom Anderson wrote: >>> How about just getting rid of del? Removal from collections could be >>> done with a method call, and i'm not convinced that deleting vari

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

2005-07-06 Thread Ron Adam
Dan Sommers wrote: > On Wed, 06 Jul 2005 14:33:47 GMT, > Ron Adam <[EMAIL PROTECTED]> wrote: > > >>Since this is a Python 3k item... What would be the consequence of >>making None the default value of an undefined name? And then assigning >>a name to None as a way to delete it? > > > [ ... ]

Re: Favorite non-python language trick?

2005-07-06 Thread Thomas Heller
Edvard Majakari <[EMAIL PROTECTED]> writes: > (sorry, my NUA had lost the original article) >> >>> I'm curious -- what is everyone's favorite trick from a non-python >>> language? And -- why isn't it in Python? > > Ability to tag some methods 'deprecated' as in Java (from 1.5 > onwards?). However,

Re: Favorite non-python language trick?

2005-07-06 Thread Edvard Majakari
Thomas Heller <[EMAIL PROTECTED]> writes: > I don't see what's wrong with this code, and if one wanted, one could > also implement a decorator which calls warnings.warn when the function > is called: > > def c_buffer(init, size=None): > "deprecated, use create_string_buffer instead" > impo

Re: Tkinter grid layout

2005-07-06 Thread Eric Brunel
On Wed, 06 Jul 2005 11:44:55 +0100, Richard Lewis <[EMAIL PROTECTED]> wrote: > Hi there, > > I've got a tree control in Tkinter (using the ESRF Tree module) but I > can't get it to layout how I want it. > > I'd like to have it so that it streches north/south (anchored to the top > and bottom), is

latex/bibtex python paper?

2005-07-06 Thread schwehr
Hi All, Does anyone have a good template that I might use for writing a python paper in latex/bibtex? I've got the paper mostly done, but am having issues with the references. I am definitely not an expert at latex/bibtex. Right now, I have references defined like this: @article{imp, title =

Re: Favorite non-python language trick?

2005-07-06 Thread Simon Brunning
On 7/6/05, Edvard Majakari <[EMAIL PROTECTED]> wrote: > Ability to tag some methods 'deprecated' as in Java (from 1.5 > onwards?). However, Python interpreter doesn't have to do it: pydoc and > similar tools could detect, say, '@deprecated' in method comment string and > warn user about it. http:/

Re: adding a character to the last string element of a list

2005-07-06 Thread Philippe C. Martin
Thanks, Philippe Peter Hansen wrote: > Philippe C. Martin wrote: >> I guess my slicing was wrong, l[-1] worked > > Note that that's _not_ a slice, however, but a reference to the last > element in the list. > > You'd have to subclass list to be able to do something with > "reference-slices".

Re: frozenset question

2005-07-06 Thread Steven D'Aprano
On Wed, 06 Jul 2005 14:25:30 +0100, Will McGugan wrote: >> But if you are just trying to optimize for the sake of optimization, >> that's a terrible idea. Get your program working first. Then when it >> works, measure how fast it runs. If, and ONLY if, it is too slow, >> identify the parts of the

Re: Create datetime instance using a tuple.

2005-07-06 Thread Dan Bishop
Qiangning Hong wrote: > On 6 Jul 2005 02:01:55 -0700, Negroup <[EMAIL PROTECTED]> wrote: > > Hi, all. > > I would like to know if it is possible to create a datetime instance > > using a tuple instead of single values. > > > > I mean: > > >>> from datetime import datetime > > >>> t = (1, 2, 3) > >

Conditionally implementing __iter__ in new style classes

2005-07-06 Thread Thomas Heller
I'm trying to implement __iter__ on an abstract base class while I don't know whether subclasses support that or not. Hope that makes sense, if not, this code should be clearer: class Base: def __getattr__(self, name): if name == "__iter__" and hasattr(self, "Iterator"): re

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

2005-07-06 Thread Devan L
> Here's a couple of examples from my own code: > > # from a Banzhaf Power Index calculator > # adds things that aren't numbers > return reduce(operator.add, > (VoteDistributionTable({0: 1, v: 1}) for v in electoral_votes)) return sum([VoteDistributionTable({0:1, v:1} for v in electoral_votes]

Re: Conditionally implementing __iter__ in new style classes

2005-07-06 Thread Thomas Heller
Thomas Heller <[EMAIL PROTECTED]> writes: > I'm trying to implement __iter__ on an abstract base class while I don't > know whether subclasses support that or not. > Hope that makes sense, if not, this code should be clearer: > > class Base: > def __getattr__(self, name): > if name ==

Re: Conditionally implementing __iter__ in new style classes

2005-07-06 Thread harold fellermann
> I'm trying to implement __iter__ on an abstract base class while I > don't > know whether subclasses support that or not. > Hope that makes sense, if not, this code should be clearer: > > class Base: > def __getattr__(self, name): > if name == "__iter__" and hasattr(self, "Iterator")

Re: Use cases for del

2005-07-06 Thread Ron Adam
Steven D'Aprano wrote: > On Wed, 06 Jul 2005 10:00:02 -0400, Jp Calderone wrote: > > >>On Wed, 06 Jul 2005 09:45:56 -0400, Peter Hansen <[EMAIL PROTECTED]> wrote: >> >>>Tom Anderson wrote: >>> How about just getting rid of del? Removal from collections could be done with a method call, an

Re: How do you program in Python?

2005-07-06 Thread Dan
On 7/6/2005 5:38 AM, Jorgen Grahn wrote: > On Sun, 03 Jul 2005 17:35:16 +0100, anthonyberet <[EMAIL PROTECTED]> wrote: > ... > >>What I would really like is something like an old-style BASIC >>interpreter, in which I could list, modify and test-run sections of > You probably want to check out

Re: Conditionally implementing __iter__ in new style classes

2005-07-06 Thread infidel
I'm not sure I understand why you would want to. Just don't define __iter__ on your newstyle class and you'll get the expected behavior. -- http://mail.python.org/mailman/listinfo/python-list

Re: Programmers Contest: Fit pictures on a page

2005-07-06 Thread tassach
Don wrote: > Chung Leong wrote: > > > Isn't that an NP-complete problem or am I crazy? > > It is NP complete. Its known as the "cutting stock problem" (aka "Knapsack > problem"). Here's a Wikipedia page that describes it: > > http://en.wikipedia.org/wiki/Cutting_stock_problem > > There are commeric

Re: Conditionally implementing __iter__ in new style classes

2005-07-06 Thread infidel
Why not define an Iterator method in your Base class that does the iteration using __getitem__, and any subclass that wants to do something else just defines its own Iterator method? For that matter, you could just use the __iter__ methods of Base and Concrete instead of a separate method. -- ht

Re: Tkinter grid layout

2005-07-06 Thread Richard Lewis
On Wed, 06 Jul 2005 17:36:01 +0200, "Eric Brunel" <[EMAIL PROTECTED]> said: > On Wed, 06 Jul 2005 11:44:55 +0100, Richard Lewis > <[EMAIL PROTECTED]> wrote: > > > Hi there, > > > > I've got a tree control in Tkinter (using the ESRF Tree module) but I > > can't get it to layout how I want it. > >

Re: Conditionally implementing __iter__ in new style classes

2005-07-06 Thread infidel
Something like this: >>> class Base(object): ... def __getitem__(self, key): ... return key ... def __iter__(self): ... yield self[1] ... yield self['foo'] ... yield self[3.0] ... >>> class ConcreteIterable(Base): ... def __iter__(self):

  1   2   3   >